-
Notifications
You must be signed in to change notification settings - Fork 125
Description
The GNIRS spectrograph has multiple echelle gratings, and therefore the echelle-specific properties in the Class need to return different value based on which grating was used:
PypeIt/pypeit/spectrographs/gemini_gnirs.py
Lines 533 to 594 in 66b3791
| @property | |
| def norders(self): | |
| """ | |
| Number of orders for this spectograph. | |
| """ | |
| self.check_disperser() | |
| if '10/mmLBSX' in self.dispname: | |
| return 4 | |
| elif '32/mm' in self.dispname: | |
| return 6 | |
| else: | |
| msgs.error('Unrecognized disperser') | |
| @property | |
| def order_spat_pos(self): | |
| """ | |
| Return the expected spatial position of each echelle order. | |
| """ | |
| self.check_disperser() | |
| if '10/mmLBSX' in self.dispname: | |
| return np.array([0.050, 0.215, 0.442, 0.759]) | |
| elif '32/mm' in self.dispname: | |
| #ToDo: create self.date similar to self.dispname and use that to decide which numbers to use | |
| ## Old data, i.e. before 2011 | |
| #return np.array([0.241211 , 0.3173828, 0.387695, 0.456054, 0.530273, 0.640625]) | |
| ##New data | |
| return np.array([0.2955097 , 0.37635756, 0.44952223, 0.51935601, 0.59489503, 0.70210309]) | |
| else: | |
| msgs.error('Unrecognized disperser') | |
| @property | |
| def orders(self): | |
| """ | |
| Return the order number for each echelle order. | |
| """ | |
| self.check_disperser() | |
| if '10/mmLBSX' in self.dispname: | |
| return np.arange(6,2,-1, dtype=int) | |
| elif '32/mm' in self.dispname: | |
| return np.arange(8,2,-1,dtype=int) | |
| else: | |
| msgs.error('Unrecognized disperser') | |
| @property | |
| def spec_min_max(self): | |
| """ | |
| Return the minimum and maximum spectral pixel expected for the | |
| spectral range of each order. | |
| """ | |
| # TODO: Why aren't these numbers in fraction of the detector | |
| # size instead of the pixel number? | |
| self.check_disperser() | |
| if '10/mmLBSX' in self.dispname: | |
| spec_max = np.asarray([1022, 1022, 1022, 1022]) | |
| spec_min = np.asarray([450, 0, 0, 0]) | |
| return np.vstack((spec_min, spec_max)) | |
| elif '32/mm' in self.dispname: | |
| spec_max = np.asarray([1022, 1022, 1022, 1022, 1022, 1022]) | |
| spec_min = np.asarray([512, 280, 0, 0, 0, 0]) | |
| return np.vstack((spec_min, spec_max)) | |
| else: | |
| msgs.error('Unrecognized disperser') |
The problem with the present implementation is the use of self.dispname -- which is defined in config_specific_par() -- and how it gets propagated throughout the remainder of the PypeIt code base. For instance, the solution to #1977 (in PR #2013) involved additional gymnastics to satisfy Gemini/GNIRS that ends up calling config_specific_par().
This is the only spectrograph to use self.dispname, and it would be helpful to find another mechanism for specifying the echelle order information. In fact, there is a TODO in the GNIRS class about finding a way around this hack:
PypeIt/pypeit/spectrographs/gemini_gnirs.py
Lines 470 to 472 in 66b3791
| # TODO This is a hack for now until we figure out how to set dispname | |
| # and other meta information in the spectrograph class itself | |
| self.dispname = self.get_meta_value(scifile, 'dispname') |