Skip to content

Commit

Permalink
fix ode to have github actions skip non-raw files, and revert some de…
Browse files Browse the repository at this point in the history
…scriptor returns to pre-NIR LS levels
  • Loading branch information
chris-simpson committed Feb 1, 2024
1 parent 1b13fd4 commit 0fa73fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 62 deletions.
57 changes: 0 additions & 57 deletions gemini_instruments/niri/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,63 +268,6 @@ def disperser(self, stripID=False, pretty=False):
else:
return 'MIRROR'

@astro_data_descriptor
def dispersion(self, asMicrometers=False, asNanometers=False, asAngstroms=False):
"""
Returns the dispersion in meters per pixel as a list (one value per
extension) or a float if used on a single-extension slice. It is
possible to control the units of wavelength using the input arguments.
Parameters
----------
asMicrometers : bool
If True, return the wavelength in microns
asNanometers : bool
If True, return the wavelength in nanometers
asAngstroms : bool
If True, return the wavelength in Angstroms
Returns
-------
list/float
The dispersion(s)
"""

camera = self.camera()
disperser = self.disperser(stripID=True)
config = (camera, disperser)

try:
dispersion = lookup.dispersion_by_config[config]
except KeyError:
dispersion = None

unit_arg_list = [asMicrometers, asNanometers, asAngstroms]
output_units = "meters" # By default
if unit_arg_list.count(True) == 1:
# Just one of the unit arguments was set to True. Return the
# central wavelength in these units
if asMicrometers:
output_units = "micrometers"
if asNanometers:
output_units = "nanometers"
if asAngstroms:
output_units = "angstroms"

if dispersion is not None:
dispersion = gmu.convert_units('angstroms', dispersion, output_units)

if not self.is_single:
dispersion = [dispersion] * len(self)

return dispersion

@returns_list
@astro_data_descriptor
def dispersion_axis(self):
return 1

@astro_data_descriptor
def filter_name(self, stripID=False, pretty=False):
#TODO: Complete rewrite here so serious testing required
Expand Down
8 changes: 4 additions & 4 deletions gemini_instruments/test/lut_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
('detector_x_bin', 1),
('detector_y_bin', 1),
('disperser', 'JH_G5801'),
('dispersion', [-6.51e-10]),
('dispersion', None),
('dispersion_axis', [2]),
('effective_wavelength', 1.39999997616e-06),
('elevation', 36.3891416667),
Expand Down Expand Up @@ -340,7 +340,7 @@
('GNIRS', 'N20120117S0019.fits'): (
('airmass', 1.154),
('ao_seeing', None),
('array_name', ['SN7638228.1']),
('array_name', [None]),
('array_section', [(0, 1024, 0, 1022)]),
('azimuth', -55.4880138888889),
('camera', 'ShortBlue_G5538'),
Expand All @@ -358,8 +358,8 @@
('detector_x_bin', 1),
('detector_y_bin', 1),
('disperser', 'MIRROR'),
('dispersion', [-3.876e-10]),
('dispersion_axis', [2]),
('dispersion', None),
('dispersion_axis', None),
('effective_wavelength', 1.25e-06),
('elevation', 60.1851833333),
('exposure_time', 60.0),
Expand Down
2 changes: 1 addition & 1 deletion gemini_instruments/test/test_astrodata_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def __iter__(self):
@pytest.mark.dragons_remote_data
@pytest.mark.parametrize("fn,ad,tag_set", FixtureIterator(tags_fixture_data))
def test_descriptor(fn, ad, tag_set):
assert ad.tags == tag_set or ad.tags is None
assert fn is None or ad.tags == tag_set

0 comments on commit 0fa73fd

Please sign in to comment.