96 def adjustQuantum(self, inputs, outputs, label, data_id):
97 """Validates the `lsst.daf.butler.DatasetRef` bands against the
98 subtask's list of bands to fit and drops unnecessary bands.
99
100 Parameters
101 ----------
102 inputs : `dict`
103 Dictionary whose keys are an input (regular or prerequisite)
104 connection name and whose values are a tuple of the connection
105 instance and a collection of associated `DatasetRef` objects.
106 The exact type of the nested collections is unspecified; it can be
107 assumed to be multi-pass iterable and support `len` and ``in``, but
108 it should not be mutated in place. In contrast, the outer
109 dictionaries are guaranteed to be temporary copies that are true
110 `dict` instances, and hence may be modified and even returned; this
111 is especially useful for delegating to `super` (see notes below).
112 outputs : `Mapping`
113 Mapping of output datasets, with the same structure as ``inputs``.
114 label : `str`
115 Label for this task in the pipeline (should be used in all
116 diagnostic messages).
117 data_id : `lsst.daf.butler.DataCoordinate`
118 Data ID for this quantum in the pipeline (should be used in all
119 diagnostic messages).
120
121 Returns
122 -------
123 adjusted_inputs : `Mapping`
124 Mapping of the same form as ``inputs`` with updated containers of
125 input `DatasetRef` objects. All inputs involving the 'band'
126 dimension are adjusted to put them in consistent order and remove
127 unneeded bands.
128 adjusted_outputs : `Mapping`
129 Mapping of updated output datasets; always empty for this task.
130
131 Raises
132 ------
133 lsst.pipe.base.NoWorkFound
134 Raised if there are not enough of the right bands to run the task
135 on this quantum.
136 """
137
138 bands_fit, bands_read_only = self.config.get_band_sets()
139 bands_needed = bands_fit + [band for band in bands_read_only if band not in bands_fit]
140
141 adjusted_inputs = {}
142 for connection_name, (connection, dataset_refs) in inputs.items():
143
144 if 'band' in connection.dimensions:
145 datasets_by_band = {dref.dataId['band']: dref for dref in dataset_refs}
146 if not set(bands_needed).issubset(datasets_by_band.keys()):
147 raise pipeBase.NoWorkFound(
148 f'DatasetRefs={dataset_refs} have data with bands in the'
149 f' set={set(datasets_by_band.keys())},'
150 f' which is not a superset of the required bands={bands_needed} defined by'
151 f' {self.config.__class__}.fit_coadd_multiband='
152 f'{self.config.fit_coadd_multiband._value.__class__}\'s attributes'
153 f' bands_fit={bands_fit} and bands_read_only()={bands_read_only}.'
154 f' Add the required bands={set(bands_needed).difference(datasets_by_band.keys())}.'
155 )
156
157
158 adjusted_inputs[connection_name] = (
159 connection,
160 [datasets_by_band[band] for band in bands_needed]
161 )
162
163
164 inputs.update(adjusted_inputs)
165 super().adjustQuantum(inputs, outputs, label, data_id)
166 return adjusted_inputs, {}
167
168
daf::base::PropertySet * set