Skip to content

Commit

Permalink
tidy up my confusion between um and nm
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-simpson committed Jan 9, 2025
1 parent ce8b25f commit 19485aa
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion gemini_instruments/bhros/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _tag_instrument(self):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/f2/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def camera(self, stripID=False, pretty=False):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
Expand Down Expand Up @@ -305,7 +305,7 @@ def detector_y_offset(self):
@gmu.return_requested_units
def dispersion(self):
"""
Returns the dispersion in microns per pixel as a list (one value per
Returns the dispersion in nm 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.
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/flamingos/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def _tag_dark(self):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
float
The central wavelength setting in um
The central wavelength setting in nm
"""
return 1500.0

Expand Down
8 changes: 4 additions & 4 deletions gemini_instruments/gemini/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def cass_rotator_pa(self):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in meters or the specified units
Returns the central wavelength in nm or the specified units
Returns
-------
Expand All @@ -626,7 +626,7 @@ def central_wavelength(self):

if wave_in_microns < 0:
return None
return wave_in_microns
return 1000 * wave_in_microns

@astro_data_descriptor
def coadds(self):
Expand Down Expand Up @@ -873,7 +873,7 @@ def disperser(self, stripID=False, pretty=False):
@gmu.return_requested_units
def dispersion(self):
"""
Returns the dispersion in meters per pixel as a list (one value per
Returns the dispersion in nm 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.
Expand All @@ -892,7 +892,7 @@ def dispersion(self):
else:
return None

return dispersion
return 1e-9 * dispersion

@astro_data_descriptor
def dispersion_axis(self):
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/ghost/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ def central_wavelength(self): # pragma: no cover

if val is None:
if self.arm() == 'red':
val = 0.75
val = 750
elif self.arm() == 'blue':
val = 0.44
val = 440
else:
return None

Expand Down
8 changes: 4 additions & 4 deletions gemini_instruments/gmos/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ def array_name(self):
@gmu.return_requested_units
def central_wavelength(self, pretty=False):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
float
The central wavelength setting in um
The central wavelength setting in nm
"""
# Keywords should be the same, but CENTWAVE was only added post-2007
# Header value is in microns
Expand Down Expand Up @@ -433,7 +433,7 @@ def disperser(self, stripID=False, pretty=False):
@gmu.return_requested_units
def dispersion(self):
"""
Returns the dispersion in microns per binned pixel as a list (one value per
Returns the dispersion in nm per binned 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.
Expand Down Expand Up @@ -474,7 +474,7 @@ def dispersion(self):

if dispersion is not None:
grating_order = self.phu.get('GRORDER', 1)
dispersion = 1e-6 * dispersion / grating_order
dispersion = 1e-9 * dispersion / grating_order

if not self.is_single:
dispersion = [dispersion] * len(self)
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/gnirs/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ def array_name(self):
@gmu.return_requested_units
def dispersion(self,):
"""
Returns the dispersion in meters per pixel as a list (one value per
Returns the dispersion in nm 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.
Returns
-------
list/float
The dispersion(s) in microns
The dispersion(s) in nm/pixel
"""

grating = self._grating(pretty=True, stripID=True)
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/graces/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def _tag_bias(self):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
float
The central wavelength setting
"""
return 0.7
return 700

@astro_data_descriptor
def dec(self):
Expand Down
4 changes: 2 additions & 2 deletions gemini_instruments/gsaoi/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def array_name(self):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
float
The central wavelength setting in um
The central wavelength setting in nm
"""
central_wavelength = self.phu.get('WAVELENG', -1) # in Angstroms
if central_wavelength < 0.0:
Expand Down
6 changes: 3 additions & 3 deletions gemini_instruments/niri/adclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def array_section(self, pretty=False):
@gmu.return_requested_units
def central_wavelength(self):
"""
Returns the central wavelength in microns
Returns the central wavelength in nm
Returns
-------
float
The central wavelength setting in um
The central wavelength setting in nm
"""
# Use the lookup dict, keyed on camera, focal_plane_mask and grism
camera = self.camera()
Expand Down Expand Up @@ -254,7 +254,7 @@ def disperser(self, stripID=False, pretty=False):
@gmu.return_requested_units
def dispersion(self):
"""
Returns the dispersion in meters per pixel as a list (one value per
Returns the dispersion in nm 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.
Expand Down
98 changes: 49 additions & 49 deletions gemini_instruments/niri/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,63 +167,63 @@
# Dictionary keys:
# (camera, focal plane mask, grism)
# Dictionary values:
# central wavelength (Å) (apparently this is the center of "useful wvl range"; it is used as cenwave in the archive),
# central wavelength (nm) (apparently this is the center of "useful wvl range"; it is used as cenwave in the archive),
# wavelength at central pixel (nm) (as measured by OS),
# resolution (from NIRI webpage)
spec_wavelengths = {
('f6', 'f6-2pix', 'Jgrism') : CenwaveAndRes(12330.0, 1211.0, 770),
('f6', 'f6-4pix', 'Jgrism') : CenwaveAndRes(12330.0, 1211.0, 610),
('f6', 'f6-6pix', 'Jgrism') : CenwaveAndRes(12330.0, 1211.0, 460),
('f6', 'f6-2pixBl', 'Jgrism') : CenwaveAndRes(11840.0, 1162.0, 770),
('f6', 'f6-4pixBl', 'Jgrism') : CenwaveAndRes(11840.0, 1162.0, 650),
('f6', 'f6-6pixBl', 'Jgrism') : CenwaveAndRes(11840.0, 1162.0, 480),
('f6', 'f6-2pix', 'Hgrism') : CenwaveAndRes(16950.0, 1665.0, 1650),
('f6', 'f6-4pix', 'Hgrism') : CenwaveAndRes(16950.0, 1665.0, 825),
('f6', 'f6-6pix', 'Hgrism') : CenwaveAndRes(16950.0, 1665.0, 520),
('f6', 'f6-2pixBl', 'Hgrism') : CenwaveAndRes(16250.0, 1595.0, 1650),
('f6', 'f6-4pixBl', 'Hgrism') : CenwaveAndRes(16250.0, 1595.0, 940),
('f6', 'f6-6pixBl', 'Hgrism') : CenwaveAndRes(16250.0, 1595.0, 550),
('f6', 'f6-2pix', 'Kgrism') : CenwaveAndRes(22630.0, 2223.0, 1300),
('f6', 'f6-4pix', 'Kgrism') : CenwaveAndRes(22630.0, 2223.0, 780),
('f6', 'f6-6pix', 'Kgrism') : CenwaveAndRes(22630.0, 2223.0, 520),
('f6', 'f6-2pixBl', 'Kgrism') : CenwaveAndRes(21670.0, 2127.0, 1300),
('f6', 'f6-4pixBl', 'Kgrism') : CenwaveAndRes(21670.0, 2127.0, 780),
('f6', 'f6-6pixBl', 'Kgrism') : CenwaveAndRes(21670.0, 2127.0, 520),
('f6', 'f6-2pix', 'Lgrism') : CenwaveAndRes(35740.0, 3521.0, 1100),
('f6', 'f6-4pix', 'Lgrism') : CenwaveAndRes(35740.0, 3521.0, 690),
('f6', 'f6-6pix', 'Lgrism') : CenwaveAndRes(35740.0, 3521.0, 460),
('f6', 'f6-2pixBl', 'Lgrism') : CenwaveAndRes(34350.0, 3365.0, 1100),
('f6', 'f6-4pixBl', 'Lgrism') : CenwaveAndRes(34350.0, 3365.0, 770),
('f6', 'f6-6pixBl', 'Lgrism') : CenwaveAndRes(34350.0, 3365.0, 490),
('f6', 'f6-2pix', 'Mgrism') : CenwaveAndRes(51400.0, 5080.0, 1100),
('f6', 'f6-4pix', 'Mgrism') : CenwaveAndRes(51400.0, 5080.0, 770),
('f6', 'f6-6pix', 'Mgrism') : CenwaveAndRes(51400.0, 5080.0, 460),
('f6', 'f6-2pixBl', 'Mgrism') : CenwaveAndRes(49400.0, 4940.0, 1100), # copy from non-Bl
('f6', 'f6-4pixBl', 'Mgrism') : CenwaveAndRes(49400.0, 4940.0, 770), # copy from non-Bl
('f6', 'f6-6pixBl', 'Mgrism') : CenwaveAndRes(49400.0, 4940.0, 460), # copy from non-Bl
('f32', 'f32-6pix', 'Jgrism') : CenwaveAndRes(12030.0, 1203.0, 1000), # same as f32 4-pix
('f32', 'f32-9pix', 'Jgrism') : CenwaveAndRes(12030.0, 1203.0, 620), # same as f32 7-pix
('f32', 'f6-2pix', 'Jgrism') : CenwaveAndRes(12030.0, 1203.0, 450), # same as f32 10-pix
('f32', 'f32-6pix', 'Hgrism') : CenwaveAndRes(16412.0, 1641.2, 880),
('f32', 'f32-9pix', 'Hgrism') : CenwaveAndRes(16412.0, 1641.2, 630),
('f32', 'f6-2pix', 'Hgrism') : CenwaveAndRes(16412.0, 1641.2, 500),
('f32', 'f32-6pix', 'Kgrism') : CenwaveAndRes(21840.0, 2184.0, 1280),
('f32', 'f32-9pix', 'Kgrism') : CenwaveAndRes(21840.0, 2184.0, 775),
('f32', 'f6-2pix', 'Kgrism') : CenwaveAndRes(21840.0, 2184.0, 570)
('f6', 'f6-2pix', 'Jgrism') : CenwaveAndRes(1233.0, 1211.0, 770),
('f6', 'f6-4pix', 'Jgrism') : CenwaveAndRes(1233.0, 1211.0, 610),
('f6', 'f6-6pix', 'Jgrism') : CenwaveAndRes(1233.0, 1211.0, 460),
('f6', 'f6-2pixBl', 'Jgrism') : CenwaveAndRes(1184.0, 1162.0, 770),
('f6', 'f6-4pixBl', 'Jgrism') : CenwaveAndRes(1184.0, 1162.0, 650),
('f6', 'f6-6pixBl', 'Jgrism') : CenwaveAndRes(1184.0, 1162.0, 480),
('f6', 'f6-2pix', 'Hgrism') : CenwaveAndRes(1695.0, 1665.0, 1650),
('f6', 'f6-4pix', 'Hgrism') : CenwaveAndRes(1695.0, 1665.0, 825),
('f6', 'f6-6pix', 'Hgrism') : CenwaveAndRes(1695.0, 1665.0, 520),
('f6', 'f6-2pixBl', 'Hgrism') : CenwaveAndRes(1625.0, 1595.0, 1650),
('f6', 'f6-4pixBl', 'Hgrism') : CenwaveAndRes(1625.0, 1595.0, 940),
('f6', 'f6-6pixBl', 'Hgrism') : CenwaveAndRes(1625.0, 1595.0, 550),
('f6', 'f6-2pix', 'Kgrism') : CenwaveAndRes(2263.0, 2223.0, 1300),
('f6', 'f6-4pix', 'Kgrism') : CenwaveAndRes(2263.0, 2223.0, 780),
('f6', 'f6-6pix', 'Kgrism') : CenwaveAndRes(2263.0, 2223.0, 520),
('f6', 'f6-2pixBl', 'Kgrism') : CenwaveAndRes(2167.0, 2127.0, 1300),
('f6', 'f6-4pixBl', 'Kgrism') : CenwaveAndRes(2167.0, 2127.0, 780),
('f6', 'f6-6pixBl', 'Kgrism') : CenwaveAndRes(2167.0, 2127.0, 520),
('f6', 'f6-2pix', 'Lgrism') : CenwaveAndRes(3574.0, 3521.0, 1100),
('f6', 'f6-4pix', 'Lgrism') : CenwaveAndRes(3574.0, 3521.0, 690),
('f6', 'f6-6pix', 'Lgrism') : CenwaveAndRes(3574.0, 3521.0, 460),
('f6', 'f6-2pixBl', 'Lgrism') : CenwaveAndRes(3435.0, 3365.0, 1100),
('f6', 'f6-4pixBl', 'Lgrism') : CenwaveAndRes(3435.0, 3365.0, 770),
('f6', 'f6-6pixBl', 'Lgrism') : CenwaveAndRes(3435.0, 3365.0, 490),
('f6', 'f6-2pix', 'Mgrism') : CenwaveAndRes(5140.0, 5080.0, 1100),
('f6', 'f6-4pix', 'Mgrism') : CenwaveAndRes(5140.0, 5080.0, 770),
('f6', 'f6-6pix', 'Mgrism') : CenwaveAndRes(5140.0, 5080.0, 460),
('f6', 'f6-2pixBl', 'Mgrism') : CenwaveAndRes(4940.0, 4940.0, 1100), # copy from non-Bl
('f6', 'f6-4pixBl', 'Mgrism') : CenwaveAndRes(4940.0, 4940.0, 770), # copy from non-Bl
('f6', 'f6-6pixBl', 'Mgrism') : CenwaveAndRes(4940.0, 4940.0, 460), # copy from non-Bl
('f32', 'f32-6pix', 'Jgrism') : CenwaveAndRes(1203.0, 1203.0, 1000), # same as f32 4-pix
('f32', 'f32-9pix', 'Jgrism') : CenwaveAndRes(1203.0, 1203.0, 620), # same as f32 7-pix
('f32', 'f6-2pix', 'Jgrism') : CenwaveAndRes(1203.0, 1203.0, 450), # same as f32 10-pix
('f32', 'f32-6pix', 'Hgrism') : CenwaveAndRes(1641.2, 1641.2, 880),
('f32', 'f32-9pix', 'Hgrism') : CenwaveAndRes(1641.2, 1641.2, 630),
('f32', 'f6-2pix', 'Hgrism') : CenwaveAndRes(1641.2, 1641.2, 500),
('f32', 'f32-6pix', 'Kgrism') : CenwaveAndRes(2184.0, 2184.0, 1280),
('f32', 'f32-9pix', 'Kgrism') : CenwaveAndRes(2184.0, 2184.0, 775),
('f32', 'f6-2pix', 'Kgrism') : CenwaveAndRes(2184.0, 2184.0, 570)
}


dispersion_by_config = {
# Dictionary keys are in the following order:
# 'camera, disperser'
# Dispersion is in Å/pix.
# Dispersion is in nm/pix.
# This is a concise version of gnirs$data/nsappwave.fits table.
("f6", "Jgrism") : -3.604,
("f6", "Hgrism") : -5.157,
("f6", "Kgrism") : -7.086,
("f6", "Lgrism") : -11.39,
("f6", "Mgrism") : -16.51,
("f32", "Jgrism") : 3.041,
("f32", "Hgrism") : 2.964,
("f32", "Kgrism") : 4.396,
("f6", "Jgrism") : -0.3604,
("f6", "Hgrism") : -0.5157,
("f6", "Kgrism") : -0.7086,
("f6", "Lgrism") : -1.139,
("f6", "Mgrism") : -1.651,
("f32", "Jgrism") : 0.3041,
("f32", "Hgrism") : 0.2964,
("f32", "Kgrism") : 0.4396,
}

0 comments on commit 19485aa

Please sign in to comment.