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.
117 butler = Butler(repo, writeable=
True)
119 for filterName
in band_names:
121 with butler.registry.transaction():
122 for sub
in range(num_subfilters):
123 butler.registry.insertDimensionData(
"subfilter", {
"band": filterName,
"subfilter": sub})
124 results.add(filterName, sub,
True)
125 except IntegrityError:
126 records = butler.registry.queryDimensionRecords(
"subfilter", dataId={
"band": filterName})
127 for record
in records:
128 results.add(filterName, record.id,
False)