-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
import numpy as np | ||
import pytest | ||
from astropy.io import fits | ||
from astropy.wcs import WCS | ||
|
||
__all__ = ['BaseImviz_WCS_NoWCS'] | ||
|
||
|
||
class BaseImviz_WCS_NoWCS: | ||
@pytest.fixture(autouse=True) | ||
def setup_class(self, imviz_app): | ||
hdu = fits.ImageHDU(np.zeros((10, 10)), name='SCI') | ||
|
||
# Apply some celestial WCS from | ||
# https://learn.astropy.org/rst-tutorials/celestial_coords1.html | ||
hdu.header.update({'CTYPE1': 'RA---TAN', | ||
'CUNIT1': 'deg', | ||
'CDELT1': -0.0002777777778, | ||
'CRPIX1': 1, | ||
'CRVAL1': 337.5202808, | ||
'NAXIS1': 10, | ||
'CTYPE2': 'DEC--TAN', | ||
'CUNIT2': 'deg', | ||
'CDELT2': 0.0002777777778, | ||
'CRPIX2': 1, | ||
'CRVAL2': -20.833333059999998, | ||
'NAXIS2': 10}) | ||
|
||
# Data with WCS | ||
imviz_app.load_data(hdu, data_label='has_wcs') | ||
|
||
# Data without WCS | ||
imviz_app.load_data(hdu, data_label='no_wcs') | ||
imviz_app.app.data_collection[1].coords = None | ||
|
||
self.wcs = WCS(hdu.header) | ||
self.imviz = imviz_app | ||
self.viewer = imviz_app.app.get_viewer('viewer-1') | ||
import numpy as np | ||
import pytest | ||
from astropy.io import fits | ||
from astropy.wcs import WCS | ||
|
||
__all__ = ['BaseImviz_WCS_NoWCS'] | ||
|
||
|
||
class BaseImviz_WCS_NoWCS: | ||
@pytest.fixture(autouse=True) | ||
def setup_class(self, imviz_app): | ||
hdu = fits.ImageHDU(np.zeros((10, 10)), name='SCI') | ||
|
||
# Apply some celestial WCS from | ||
# https://learn.astropy.org/rst-tutorials/celestial_coords1.html | ||
hdu.header.update({'CTYPE1': 'RA---TAN', | ||
'CUNIT1': 'deg', | ||
'CDELT1': -0.0002777777778, | ||
'CRPIX1': 1, | ||
'CRVAL1': 337.5202808, | ||
'NAXIS1': 10, | ||
'CTYPE2': 'DEC--TAN', | ||
'CUNIT2': 'deg', | ||
'CDELT2': 0.0002777777778, | ||
'CRPIX2': 1, | ||
'CRVAL2': -20.833333059999998, | ||
'NAXIS2': 10}) | ||
|
||
# Data with WCS | ||
imviz_app.load_data(hdu, data_label='has_wcs') | ||
|
||
# Data without WCS | ||
imviz_app.load_data(hdu, data_label='no_wcs') | ||
imviz_app.app.data_collection[1].coords = None | ||
|
||
self.wcs = WCS(hdu.header) | ||
self.imviz = imviz_app | ||
self.viewer = imviz_app.app.get_viewer('viewer-1') | ||
|
||
# Since we are not really displaying, need this to test zoom. | ||
self.viewer.shape = (100, 100) | ||
self.viewer.state._set_axes_aspect_ratio(1) |