DefineVisitsTask#

class lsst.obs.base.DefineVisitsTask(config: DefineVisitsConfig, *, butler: Butler, **kwargs: Any)#

Bases: Task

Driver Task for defining visits (and their spatial regions) in Gen3 Butler repositories.

Parameters#

configDefineVisitsConfig

Configuration for the task.

butlerButler

Writeable butler instance. Will be used to read camera datasets and insert/sync dimension data.

**kwargs

Additional keyword arguments are forwarded to the lsst.pipe.base.Task constructor.

Notes#

Each instance of DefineVisitsTask reads from / writes to the same Butler. Each invocation of DefineVisitsTask.run processes 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 (GroupExposuresTask and ComputeVisitRegionsTask), 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 the exposure dimension record’s rotation angle and boresight rather than by loading the raw.wcs dataset 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 because raw.wcs datasets 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#

dataIdsIterable [ dict or DataCoordinate ]

Exposure-level data IDs. These must all correspond to the same instrument, and are expected to be on-sky science exposures.

collectionsSequence [ str ] or str or None

Collections to be searched for camera geometry, overriding self.butler.collections.defaults. Can be any of the types supported by the collections argument to butler construction.

update_recordsbool, optional

If True (False is default), update existing visit records and visit_detector_region records. 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.

incrementalbool, optional

If True indicate that exposures are being ingested incrementally and visit definition will be run on partial visits. This will allow the visit record to be updated if it already exists, but (unlike update_records=True) it will only update the visit_detector_region records if the visit record’s region changes. If there is any risk that files are being ingested incrementally it is critical that this parameter is set to True and not to rely on update_records.

Raises#

lsst.daf.butler.registry.ConflictingDefinitionError

Raised if a visit ID conflict is detected and the existing visit differs from the new one.