Skip to content

Commit 9db4966

Browse files
committed
Merge branch 'release/4.x' into bugfix/wavecal_snr
2 parents b3898de + b044f00 commit 9db4966

8 files changed

Lines changed: 820 additions & 29 deletions

File tree

gemini_instruments/gnirs/lookup.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,14 @@
191191
# Dispersion values are in nm/pix (updated by CJS 20250109)
192192
# The dispersion values are based on wvl. coverages for each filter/mode listed in GNIRS instrument pages.
193193
("10/mm", "Short") : {"M": -1.939},
194-
("10/mm", "Long") : {"X": -0.324, "J": -0.389, "H": -0.485, "K": -0.647, "L": -0.972, "M": -1.943},
195-
("32/mm", "Short") : {"X": -0.323, "J": -0.388, "H": -0.484, "K": -0.646, "L": -0.969, "M": -1.934},
196-
("32/mm", "Long") : {"X": -0.107, "J": -0.129, "H": -0.162, "K": -0.216, "L": -0.324, "M": -0.645},
197-
("111/mm", "Short") : {"X": -0.092, "J": -0.110, "H": -0.139, "K": -0.185, "L": -0.273, "M": -0.562},
198-
("111/mm", "Long") : {"X": -0.0309, "J": -0.0371, "H": -0.0464,"K": -0.0618,"L": -0.0922,"M": -0.1875}
194+
("10/mm", "Long") : {"I": -0.244, "Z": -0.273, "X": -0.324, "J": -0.389, "H": -0.485, "K": -0.647, "L": -0.972, "M": -1.943},
195+
("32/mm", "Short") : {"I": -0.244, "Z": -0.273, "X": -0.323, "J": -0.388, "H": -0.484, "K": -0.646, "L": -0.969, "M": -1.934},
196+
("32/mm", "Long") : { "Z": -0.090, "X": -0.107, "J": -0.129, "H": -0.162, "K": -0.216, "L": -0.324, "M": -0.645}, # I is a guesses, the order is only partially visible
197+
("111/mm", "Short") : {"I": -0.069, "Z": -0.079, "X": -0.092, "J": -0.110, "H": -0.139, "K": -0.185, "L": -0.273, "M": -0.562}, # all values ok
198+
("111/mm", "Long") : {"I": -0.023, "Z": -0.027, "X": -0.0309, "J": -0.0371, "H": -0.0464,"K": -0.0618,"L": -0.0922,"M": -0.1875}
199199
}
200200

201201
# XD order number mapping to filter names
202202
xd_orders = {
203-
1: "L",
204-
2: "M",
205-
3: "K",
206-
4: "H",
207-
5: "J",
208-
6: "X"
203+
1: "L", 2: "M", 3: "K", 4: "H", 5: "J", 6: "X", 7: "Z", 8: "I"
209204
}

geminidr/gemini/primitives_qa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def report(self, results, header=None):
12481248
body.append(('(Requested IQ could not be determined)', ''))
12491249

12501250
# allow comparison if "elip" is None
1251-
if results.get("elip") or 0 > 0.1:
1251+
if result.get("elip") != None and results.get("elip", 0) > 0.1:
12521252
body.append(('', 'WARNING: high ellipticity'))
12531253
self.comments.append('High ellipticity')
12541254
if 'NON_SIDEREAL' in self.ad_tags:

geminidr/gnirs/lookups/MDF_XD.py

Lines changed: 94 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# definitions based on a key generated from the 'telescope', '_prism', 'decker',
1212
# '_grating', and 'camera' attributes of a file.
1313

14-
def get_slit_info(key, central_wavelength=None):
14+
def get_slit_info(key, central_wavelength=None, grating_order=None):
1515
"""
1616
Returns the slit information for GNIRS cross-dispersed data.
1717
@@ -21,13 +21,92 @@ def get_slit_info(key, central_wavelength=None):
2121
A tuple containing slit information: x_ccd, y_ccd, and width_pixels.
2222
"""
2323
if callable(slit_info[key]):
24-
info = slit_info[key](central_wavelength)
24+
info = slit_info[key](central_wavelength, grating_order)
2525
else:
2626
info = slit_info[key]
2727

2828
return info
2929

30-
def _gem_north_lxd_lcxd_111_longblue(central_wavelength):
30+
def _dynamic_x_ccd(solutions, central_wavelength, grating_order):
31+
"""
32+
Returns x position information for GNIRS XD orders, given a central
33+
wavelength and grating order. The specific dynamic solution for the
34+
configuration needs to be provided.
35+
36+
37+
Parameters
38+
----------
39+
solutions: dict
40+
1 degree polynomial solution for each order. Eg:
41+
solutions = {
42+
# order: (slope, constant) 1 degree polynomial
43+
'order3': (-203.125, 806.54),
44+
'order4': (-156.250, 814.42),
45+
'order5': (-162.500, 905.83),
46+
'order6': (-196.875, 1053.79),
47+
'order7': (-250.000, 1245.67),
48+
'order8': (-318.750, 1480.58),
49+
}
50+
central_wavelength : float
51+
The central wavelength in nm to determine the slit positions. As
52+
returned by the descriptor, default units (nm).
53+
grating_order: int
54+
The grating order for which the central wavelength is provided.
55+
Returns
56+
-------
57+
list
58+
A list containing x_ccd.
59+
"""
60+
61+
if central_wavelength is None:
62+
raise ValueError("central_wavelength must be provided for this configuration.")
63+
central_wavelength *= 1.e6 # Convert from meters to um (descriptor default)
64+
# Calculate central_wavelength for order 3:
65+
central_wavelength_ord3 = central_wavelength * grating_order / 3.0
66+
67+
x_ccd = []
68+
for solution in solutions:
69+
slope, constant = solutions[solution]
70+
x_ccd.append(slope * central_wavelength_ord3 + constant)
71+
72+
return x_ccd
73+
74+
75+
def _gem_north_sxd_scxd_111_shortblue_5538(central_wavelength, grating_order):
76+
"""
77+
Returns slit information for the Gemini North ShortBlue camera, 111 l/mm grating,
78+
SXD configuration.
79+
80+
Parameters
81+
----------
82+
central_wavelength : float
83+
The central wavelength in nm to determine the slit positions.
84+
grating_order: int
85+
The grating order for which the central wavelength is provided.
86+
Returns
87+
-------
88+
tuple
89+
A tuple containing x_ccd, y_ccd, and width_pixels.
90+
"""
91+
92+
solutions = {
93+
# order: (slope, constant) 1 degree polynomial
94+
'order3': (-203.125, 806.54),
95+
'order4': (-156.250, 814.42),
96+
'order5': (-162.500, 905.83),
97+
'order6': (-196.875, 1053.79),
98+
'order7': (-250.000, 1245.67),
99+
'order8': (-318.750, 1480.58),
100+
}
101+
102+
x_ccd = tuple(_dynamic_x_ccd(solutions, central_wavelength, grating_order))
103+
y_ccd = 512
104+
width_pixels = 47
105+
106+
return (x_ccd, y_ccd, width_pixels)
107+
108+
109+
def _gem_north_lxd_lcxd_111_longblue(central_wavelength, grating_order):
31110
"""
32111
Returns slit information for the Gemini North Long camera, 111 l/mm grating,
33112
LXD configuration.
@@ -36,17 +115,14 @@ def _gem_north_lxd_lcxd_111_longblue(central_wavelength):
36115
----------
37116
central_wavelength : float
38117
The central wavelength in nm to determine the slit positions.
39-
118+
grating_order: int
119+
The grating order for which the central wavelength is provided.
40120
Returns
41121
-------
42122
tuple
43123
A tuple containing x_ccd, y_ccd, and width_pixels.
44124
"""
45-
if central_wavelength is None:
46-
raise ValueError("central_wavelength must be provided for this configuration.")
47-
central_wavelength *= 1.e6 # Convert from meters to um (descriptor default)
48125

49-
# x position calculation based on central wavelength
50126
solutions = {
51127
# order: (slope, constant) 1 degree polynomial
52128
'order3': (-387.148, 1021.51),
@@ -57,12 +133,8 @@ def _gem_north_lxd_lcxd_111_longblue(central_wavelength):
57133
# order 8 is hardly visible in the flats. Also can fall off the
58134
# detector at some wavelength settings.
59135
}
60-
x_ccd = []
61-
for solution in solutions:
62-
slope, constant = solutions[solution]
63-
x_ccd.append(slope * central_wavelength + constant)
64136

65-
x_ccd = tuple(x_ccd)
137+
x_ccd = tuple(_dynamic_x_ccd(solutions, central_wavelength, grating_order))
66138
y_ccd = 512
67139
width_pixels = 100
68140

@@ -93,6 +165,15 @@ def _gem_north_lxd_lcxd_111_longblue(central_wavelength):
93165
175, # y_ccd
94166
47 # width_pixels
95167
),
168+
# North, Short, 111 l/mm, SXD
169+
'Gemini-North_SXD_G5536_SCXD_G5531_111/mm_G5534_ShortBlue_G5538':
170+
_gem_north_sxd_scxd_111_shortblue_5538,
171+
172+
# 'Gemini-North_SXD_G5536_SCXD_G5531_111/mm_G5534_ShortBlue_G5538': (
173+
# (275, 389, 466, 534, 607, 685), # x_ccd
174+
# 175, # y_ccd
175+
# 47 # width_pixels
176+
# ),
96177
# North, Short, 111 l/mm, LXD
97178
# --------------------------------- Long camera -------------------------------
98179
# North, Long, 10 l/mm, SXD

geminidr/gnirs/lookups/argon.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
8622.8379 # NOAO
5050
8637.0195 # NOAO
5151
8656.7598 # NOAO
52+
8668.0000 # from GNIRS XD Ar lamp calibration image
5253
8670.3242 # NOAO
5354
8764.1260 # NOAO
5455
8783.0342 # NOAO

geminidr/gnirs/lookups/orders_XD.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
(2210, 1660, 1330, 1110, 950, 830), # nm
2828
(-0.1853, -0.13882, -0.11117, -0.09242, -0.08, -0.0694), # nm/pixel
2929
),
30+
'Gemini-North_SXD_G5536_SCXD_G5531_111/mm_G5534_ShortBlue_G5538': (
31+
(2210, 1660, 1330, 1110, 950, 830), # nm
32+
(-0.1853, -0.13882, -0.11117, -0.09242, -0.08, -0.0694), # nm/pixel
33+
),
3034
# North, Short, 111 l/mm, LXD
3135
# --------------------------------- Long camera -------------------------------
3236
# North, Long, 10 l/mm, SXD
@@ -46,8 +50,9 @@
4650
),
4751
# North, Long, 32 l/mm, LXD
4852
'Gemini-North_LXD_G5535_LCXD_G5531_32/mm_G5533_LongBlue_G5542': (
49-
(2210, 1660, 1330, 1110),
50-
(-0.1853, -0.13882, -0.11117, -0.09242),
53+
(2210, 1660, 1330, 1110, 950),
54+
#(-0.1853, -0.13882, -0.11117, -0.09242, -0.07), # bad values from IRAF
55+
(-0.2155, -0.1616, -0.1294, -0.1078, -0.09),
5156
),
5257
# North, Long, 111 l/mm, SXD
5358
# North, Long, 111 l/mm, LXD

geminidr/gnirs/primitives_gnirs_crossdispersed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def addMDF(self, adinputs=None, suffix=None):
5555
'_grating', 'camera')
5656
mdf_key = "_".join(getattr(ad, desc)()
5757
for desc in mdf_key_parts)
58-
x_ccd, y_ccd, length_pix = get_slit_info(mdf_key, ad.central_wavelength())
58+
x_ccd, y_ccd, length_pix = get_slit_info(mdf_key, ad.central_wavelength(), ad._grating_order())
5959
mdf_table = Table([range(1, len(x_ccd) + 1), x_ccd], names=['slit_id', 'x_ccd'])
6060
mdf_table['y_ccd'] = y_ccd
6161
mdf_table['specorder'] = mdf_table['slit_id'] + 2

geminidr/gnirs/tests/crossdispersed/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
"""
33
Tests for GNIRS XD Primitives.
44
"""
5+
CREATED_INPUTS_PATH_FOR_TESTS = "./geminidr/gnirs/crossdispersed/"

0 commit comments

Comments
 (0)