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
0 commit comments