From 19485aa98208f2d7118e654bb053ecdc653485c5 Mon Sep 17 00:00:00 2001 From: chris-simpson Date: Thu, 9 Jan 2025 12:18:29 -1000 Subject: [PATCH] tidy up my confusion between um and nm --- gemini_instruments/bhros/adclass.py | 2 +- gemini_instruments/f2/adclass.py | 4 +- gemini_instruments/flamingos/adclass.py | 4 +- gemini_instruments/gemini/adclass.py | 8 +- gemini_instruments/ghost/adclass.py | 4 +- gemini_instruments/gmos/adclass.py | 8 +- gemini_instruments/gnirs/adclass.py | 4 +- gemini_instruments/graces/adclass.py | 4 +- gemini_instruments/gsaoi/adclass.py | 4 +- gemini_instruments/niri/adclass.py | 6 +- gemini_instruments/niri/lookup.py | 98 ++++++++++++------------- 11 files changed, 73 insertions(+), 73 deletions(-) diff --git a/gemini_instruments/bhros/adclass.py b/gemini_instruments/bhros/adclass.py index c866722b4..04ae795ff 100644 --- a/gemini_instruments/bhros/adclass.py +++ b/gemini_instruments/bhros/adclass.py @@ -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 ------- diff --git a/gemini_instruments/f2/adclass.py b/gemini_instruments/f2/adclass.py index 5774ba546..26b569049 100644 --- a/gemini_instruments/f2/adclass.py +++ b/gemini_instruments/f2/adclass.py @@ -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 ------- @@ -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. diff --git a/gemini_instruments/flamingos/adclass.py b/gemini_instruments/flamingos/adclass.py index 9bc5b67bc..f2fed217d 100644 --- a/gemini_instruments/flamingos/adclass.py +++ b/gemini_instruments/flamingos/adclass.py @@ -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 diff --git a/gemini_instruments/gemini/adclass.py b/gemini_instruments/gemini/adclass.py index 36c016700..779da397c 100644 --- a/gemini_instruments/gemini/adclass.py +++ b/gemini_instruments/gemini/adclass.py @@ -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 ------- @@ -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): @@ -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. @@ -892,7 +892,7 @@ def dispersion(self): else: return None - return dispersion + return 1e-9 * dispersion @astro_data_descriptor def dispersion_axis(self): diff --git a/gemini_instruments/ghost/adclass.py b/gemini_instruments/ghost/adclass.py index 3226a89a2..615a0ac2f 100644 --- a/gemini_instruments/ghost/adclass.py +++ b/gemini_instruments/ghost/adclass.py @@ -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 diff --git a/gemini_instruments/gmos/adclass.py b/gemini_instruments/gmos/adclass.py index 095dff341..2675b972e 100644 --- a/gemini_instruments/gmos/adclass.py +++ b/gemini_instruments/gmos/adclass.py @@ -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 @@ -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. @@ -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) diff --git a/gemini_instruments/gnirs/adclass.py b/gemini_instruments/gnirs/adclass.py index 798402608..9c5948a44 100644 --- a/gemini_instruments/gnirs/adclass.py +++ b/gemini_instruments/gnirs/adclass.py @@ -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) diff --git a/gemini_instruments/graces/adclass.py b/gemini_instruments/graces/adclass.py index f2789f8af..1e34c7514 100644 --- a/gemini_instruments/graces/adclass.py +++ b/gemini_instruments/graces/adclass.py @@ -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): diff --git a/gemini_instruments/gsaoi/adclass.py b/gemini_instruments/gsaoi/adclass.py index cdffca9ad..85aac5544 100644 --- a/gemini_instruments/gsaoi/adclass.py +++ b/gemini_instruments/gsaoi/adclass.py @@ -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: diff --git a/gemini_instruments/niri/adclass.py b/gemini_instruments/niri/adclass.py index 7795a3498..3594d31ec 100644 --- a/gemini_instruments/niri/adclass.py +++ b/gemini_instruments/niri/adclass.py @@ -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() @@ -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. diff --git a/gemini_instruments/niri/lookup.py b/gemini_instruments/niri/lookup.py index 412342312..9859a8390 100644 --- a/gemini_instruments/niri/lookup.py +++ b/gemini_instruments/niri/lookup.py @@ -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, }