|
10 | 10 | # primitives_gnirs_crossdispersed imports this dictionary to find the slit |
11 | 11 | # definitions based on a key generated from the 'telescope', '_prism', 'decker', |
12 | 12 | # '_grating', and 'camera' attributes of a file. |
| 13 | + |
| 14 | +def get_slit_info(key, central_wavelength=None): |
| 15 | + """ |
| 16 | + Returns the slit information for GNIRS cross-dispersed data. |
| 17 | +
|
| 18 | + Returns |
| 19 | + ------- |
| 20 | + tuple |
| 21 | + A tuple containing slit information: x_ccd, y_ccd, and width_pixels. |
| 22 | + """ |
| 23 | + if callable(slit_info[key]): |
| 24 | + info = slit_info[key](central_wavelength) |
| 25 | + else: |
| 26 | + info = slit_info[key] |
| 27 | + |
| 28 | + return info |
| 29 | + |
| 30 | +def _gem_north_lxd_lcxd_111_longblue(central_wavelength): |
| 31 | + """ |
| 32 | + Returns slit information for the Gemini North Long camera, 111 l/mm grating, |
| 33 | + LXD configuration. |
| 34 | +
|
| 35 | + Parameters |
| 36 | + ---------- |
| 37 | + central_wavelength : float |
| 38 | + The central wavelength in nm to determine the slit positions. |
| 39 | +
|
| 40 | + Returns |
| 41 | + ------- |
| 42 | + tuple |
| 43 | + A tuple containing x_ccd, y_ccd, and width_pixels. |
| 44 | + """ |
| 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) |
| 48 | + |
| 49 | + # x position calculation based on central wavelength |
| 50 | + solutions = { |
| 51 | + # order: (slope, constant) 1 degree polynomial |
| 52 | + 'order3': (-387.148, 1021.51), |
| 53 | + 'order4': (-294.465, 1032.95), |
| 54 | + 'order5': (-309.060, 1215.08), |
| 55 | + 'order6': (-370.932, 1489.49), |
| 56 | + 'order7': (-438.000, 1776.67), # falls off the detector below 2.06 um |
| 57 | + # order 8 is hardly visible in the flats. Also can fall off the |
| 58 | + # detector at some wavelength settings. |
| 59 | + } |
| 60 | + x_ccd = [] |
| 61 | + for solution in solutions: |
| 62 | + slope, constant = solutions[solution] |
| 63 | + x_ccd.append(slope * central_wavelength + constant) |
| 64 | + |
| 65 | + x_ccd = tuple(x_ccd) |
| 66 | + y_ccd = 512 |
| 67 | + width_pixels = 100 |
| 68 | + |
| 69 | + return (x_ccd, y_ccd, width_pixels) |
| 70 | + |
13 | 71 | slit_info = { |
14 | 72 |
|
15 | 73 | # Not all configurations have data present in the archive - some notes: |
|
64 | 122 | ), |
65 | 123 | # North, Long, 111 l/mm, SXD |
66 | 124 | # North, Long, 111 l/mm, LXD |
67 | | -'Gemini-North_LXD_G5535_LCXD_G5531_111/mm_G5534_LongBlue_G5542': ( |
68 | | - (198, 410, 560, 699, 850), # x_ccd |
69 | | - 512, # y_ccd |
70 | | - 100 # width_pixels |
71 | | - ), |
| 125 | +'Gemini-North_LXD_G5535_LCXD_G5531_111/mm_G5534_LongBlue_G5542': |
| 126 | + _gem_north_lxd_lcxd_111_longblue, |
72 | 127 |
|
73 | 128 | # ------------------------------- Gemini South -------------------------------- |
74 | 129 | # ------------------------------- Short camera |
|
101 | 156 | # but the configuration isn't meaningfully affected. Define such cases here. |
102 | 157 | slit_info['Gemini-South_SXD_G5509_SC_XD_111/mm_G5505_ShortBlue_G5521'] =\ |
103 | 158 | slit_info['Gemini-South_SXD_G5509_SC_XD_111/mm_G5505_ShortBlue_G5513'] |
| 159 | + |
| 160 | + |
0 commit comments