97def registerDcrSubfilters(repo, num_subfilters, band_names):
98 """Construct a set of subfilters for chromatic modeling and add them to a
104 URI to the location to read the repo.
105 num_subfilters : `int`
106 The number of subfilters to add.
107 band_names : `list` [`str`]
108 The filter band names to add.
112 insertResults : ``InsertResults``
113 A class that contains the results of the subfilters that were inserted
114 or already exist in each filter band, that has a __str__ method so it
115 can be easily printed to the CLI output.
118 with Butler.from_config(repo, writeable=
True)
as butler:
119 for filterName
in band_names:
121 with butler.registry.transaction():
122 for sub
in range(num_subfilters):
123 butler.registry.insertDimensionData(
124 "subfilter", {
"band": filterName,
"subfilter": sub}
126 results.add(filterName, sub,
True)
127 except IntegrityError:
128 records = butler.registry.queryDimensionRecords(
"subfilter", dataId={
"band": filterName})
129 for record
in records:
130 results.add(filterName, record.id,
False)