Skip to content

Commit 8f57511

Browse files
committed
Make --collections and alias for --prefix in write-curated-calibrations.
1 parent 2b7fa98 commit 8f57511

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

doc/changes/DM-46632.misc.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Make the `--collection` argument to `butler write-curated-calibrations` an alias for `--prefix`.
2+
3+
The previous behavior of `--collection` was to set the name of the `CALIBRATION` collection but not any of the `RUN` collections also created, which was never what the user actually wanted.

python/lsst/obs/base/_instrument.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,11 @@ def writeCuratedCalibrations(
239239
Butler to use to store these calibrations.
240240
collection : `str`, optional
241241
Name to use for the calibration collection that associates all
242-
datasets with a validity range. If this collection already exists,
243-
it must be a `~CollectionType.CALIBRATION` collection, and it must
244-
not have any datasets that would conflict with those inserted by
245-
this method. If `None`, a collection name is worked out
246-
automatically from the instrument name and other metadata by
247-
calling ``makeCalibrationCollectionName``, but this
248-
default name may not work well for long-lived repositories unless
249-
``labels`` is also provided (and changed every time curated
250-
calibrations are ingested).
242+
datasets with a validity range. Since this just sets the name of
243+
the `~CollectionType.CALIBRATION` collection, not the
244+
`~CollectionType.RUN` collections that references, this should
245+
almost always be `None`, in favor of either initializing the
246+
`Instrument` with a collection prefix or passing ``labels``.
251247
labels : `Sequence` [ `str` ], optional
252248
Extra strings to include in collection names, after concatenating
253249
them with the standard collection name delimiter. If provided,

python/lsst/obs/base/cli/cmd/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def ingest_raws(*args, **kwargs):
172172
@click.option(
173173
"--collection",
174174
required=False,
175-
help="Name of the calibration collection that associates datasets with validity ranges.",
175+
help="Backwards-compatibility alias for --prefix.",
176176
)
177177
@click.option(
178178
"--label",

python/lsst/obs/base/script/writeCuratedCalibrations.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ def writeCuratedCalibrations(repo, instrument, collection, labels, prefix=None):
3737
instrument : `str`
3838
The name or the fully qualified class name of an instrument.
3939
collection : `str` or `None`
40-
The path to the collection that associates datasets with validity
41-
ranges.
42-
Can be `None` in which case the collection name will be determined
43-
automatically.
40+
Backwards-compatibility alias for ``prefix``.
4441
labels : `Sequence` [ `str` ]
4542
Extra strings to include in the names of collections that datasets are
4643
inserted directly into, and if ``collection`` is `None`, the automatic
@@ -58,10 +55,13 @@ def writeCuratedCalibrations(repo, instrument, collection, labels, prefix=None):
5855
Raised if the instrument is not a subclass of
5956
`lsst.obs.base.Instrument`.
6057
"""
58+
if prefix is None and collection is not None:
59+
prefix = collection
60+
collection = None
6161
butler = Butler(repo, writeable=True)
6262
instr = Instrument.from_string(instrument, butler.registry, collection_prefix=prefix)
6363
if collection is None and not labels:
6464
labels = instr.get_curated_calibration_labels()
6565
if not labels:
66-
raise ValueError("At least one label or --collection must be provided.")
66+
raise ValueError("At least one of label or --prefix must be provided.")
6767
instr.writeCuratedCalibrations(butler, collection=collection, labels=labels)

0 commit comments

Comments
 (0)