DefineVisitsTask#
- class lsst.obs.base.DefineVisitsTask(config: DefineVisitsConfig, *, butler: Butler, **kwargs: Any)#
Bases:
TaskDriver Task for defining visits (and their spatial regions) in Gen3 Butler repositories.
Parameters#
- config
DefineVisitsConfig Configuration for the task.
- butler
Butler Writeable butler instance. Will be used to read
cameradatasets and insert/sync dimension data.- **kwargs
Additional keyword arguments are forwarded to the
lsst.pipe.base.Taskconstructor.
Notes#
Each instance of
DefineVisitsTaskreads from / writes to the same Butler. Each invocation ofDefineVisitsTask.runprocesses an independent group of exposures into one or more new visits, all belonging to the same visit system and instrument.The actual work of grouping exposures and computing regions is delegated to pluggable subtasks (
GroupExposuresTaskandComputeVisitRegionsTask), respectively. The defaults are to create one visit for every exposure, and to use exactly one (arbitrary) detector-level raw dataset’s WCS along with camera geometry to compute regions for all detectors, but the raw WCS is recomputed from theexposuredimension record’s rotation angle and boresight rather than by loading theraw.wcsdataset directly. Other implementations can be created and configured for instruments for which these choices are unsuitable (e.g. because visits and exposures are not one-to-one, or becauseraw.wcsdatasets for different detectors may not be consistent with camera geometry).Defining the same visit the same way multiple times (e.g. via multiple invocations of this task on the same exposures, with the same configuration) is safe, but it may be inefficient, as most of the work must be done before new visits can be compared to existing visits.
Methods Summary
run(dataIds, *[, collections, ...])Add visit definitions to the registry for the given exposures.
Methods Documentation
- run(dataIds: Iterable[DataCoordinate | Mapping[str, Any]], *, collections: Sequence[str] | str | None = None, update_records: bool = False, incremental: bool = False) None#
Add visit definitions to the registry for the given exposures.
Parameters#
- dataIds
Iterable[dictorDataCoordinate] Exposure-level data IDs. These must all correspond to the same instrument, and are expected to be on-sky science exposures.
- collections
Sequence[str] orstrorNone Collections to be searched for camera geometry, overriding
self.butler.collections.defaults. Can be any of the types supported by thecollectionsargument to butler construction.- update_records
bool, optional If
True(Falseis default), update existingvisitrecords andvisit_detector_regionrecords. THIS IS AN ADVANCED OPTION THAT SHOULD ONLY BE USED TO FIX REGIONS AND/OR METADATA THAT ARE KNOWN TO BE BAD, AND IT CANNOT BE USED TO REMOVE EXPOSURES OR DETECTORS FROM A VISIT.- incremental
bool, optional If
Trueindicate that exposures are being ingested incrementally and visit definition will be run on partial visits. This will allow thevisitrecord to be updated if it already exists, but (unlikeupdate_records=True) it will only update thevisit_detector_regionrecords if thevisitrecord’s region changes. If there is any risk that files are being ingested incrementally it is critical that this parameter is set toTrueand not to rely onupdate_records.
Raises#
- lsst.daf.butler.registry.ConflictingDefinitionError
Raised if a visit ID conflict is detected and the existing visit differs from the new one.
- dataIds
- config