diff --git a/CHANGES.rst b/CHANGES.rst index d934986232..aeb18a96b7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ - Hotfix for GTC/OSIRIS lamp list - Hotfix for Arc1D stats annotations on the QA - Hotfix for metadata (correctly set config_independent frames when multiple configurations are being setup) +- Hotfix for metadata (support lists in ``config_independent_frames()``) - Hotfix for rebin (speed-up and conserves flux) - Hotfix for skysub regions GUI that used np.bool - Hotfix to stop pypeit_setup from crashing on data from lbt_luci1, lbt_luci2, magellan_fire, diff --git a/pypeit/metadata.py b/pypeit/metadata.py index 544d5d3b20..4cf7ce9bfc 100644 --- a/pypeit/metadata.py +++ b/pypeit/metadata.py @@ -854,11 +854,21 @@ def set_configurations(self, configs=None, force=False, fill=None): for ftype, metakey in ignore_frames.items(): # TODO: For now, use this assert to check that the - # metakey is either not set or a string - assert metakey is None or isinstance(metakey, str), \ + # metakey is either not set, or is a string/list + assert metakey is None or isinstance(metakey, str) or isinstance(metakey, list), \ 'CODING ERROR: metadata keywords set by config_indpendent_frames are not ' \ 'correctly defined for {0}; values must be None or a string.'.format( self.spectrograph.__class__.__name__) + # If a list is input, check all elements of the list are strings + if isinstance(metakey, list): + for ll in metakey: + assert isinstance(ll, str), \ + 'CODING ERROR: metadata keywords set by config_indpendent_frames are not ' \ + 'correctly defined for {0}; values must be None or a string.'.format( + self.spectrograph.__class__.__name__) + elif isinstance(metakey, str): + # If metakey is a string, convert it to a one-element list + metakey = [metakey] # Get the list of frames of this type without a # configuration @@ -878,17 +888,20 @@ def set_configurations(self, configs=None, force=False, fill=None): self.table['setup'][indx] = new_cfg_key continue - # Find the unique values of meta for this configuration - uniq_meta = np.unique(self.table[metakey][in_cfg].data) - # Warn the user that the matching meta values are not - # unique for this configuration. - if uniq_meta.size != 1: - msgs.warn('When setting the instrument configuration for {0} '.format(ftype) - + 'frames, configuration {0} does not have unique '.format(cfg_key) - + '{0} values.' .format(meta)) - # Find the frames of this type that match any of the - # meta data values - indx &= np.isin(self.table[metakey], uniq_meta) + # Loop through the meta keys + for mkey in metakey: + # Find the unique values of meta for this configuration + uniq_meta = np.unique(self.table[mkey][in_cfg].data) + # Warn the user that the matching meta values are not + # unique for this configuration. + if uniq_meta.size != 1: + msgs.warn('When setting the instrument configuration for {0} '.format(ftype) + + 'frames, configuration {0} does not have unique '.format(cfg_key) + + '{0} values.' .format(meta)) + # Find the frames of this type that match any of the + # meta data values + indx &= np.isin(self.table[mkey], uniq_meta) + # assign new_cfg_key = np.full(len(self.table['setup'][indx]), 'None', dtype=object) for c in range(len(self.table['setup'][indx])): diff --git a/pypeit/spectrographs/not_alfosc.py b/pypeit/spectrographs/not_alfosc.py index d87673ea96..42589cc3e4 100644 --- a/pypeit/spectrographs/not_alfosc.py +++ b/pypeit/spectrographs/not_alfosc.py @@ -123,7 +123,7 @@ def default_pypeit_par(cls): par['calibrations']['wavelengths']['lamps'] = ['HeI', 'NeI', 'ArI'] par['calibrations']['wavelengths']['sigdetect'] = 10.0 # Set the default exposure time ranges for the frame typing - par['calibrations']['biasframe']['exprng'] = [None, 0.001] + par['calibrations']['biasframe']['exprng'] = [None, 1] par['calibrations']['darkframe']['exprng'] = [999999, None] # No dark frames par['calibrations']['pinholeframe']['exprng'] = [999999, None] # No pinhole frames par['calibrations']['arcframe']['exprng'] = [None, None] # Long arc exposures on this telescope