ingest_guider¶
- lsst.obs.lsst.ingest_guider(butler: ~lsst.daf.butler._butler.Butler, locations: list[str | urllib.parse.ParseResult | lsst.resources._resourcePath.ResourcePath | pathlib.Path], *, file_filter: str = '.*SG.*_guider\\.fits$', group_files: bool = True, run: str | None = None, transfer: str = 'auto', register_dataset_type: bool = False, track_file_attrs: bool = True, on_success: ~collections.abc.Callable[[list[lsst.daf.butler._file_dataset.FileDataset]], ~typing.Any] = <function _do_nothing>, on_metadata_failure: ~collections.abc.Callable[[~lsst.resources._resourcePath.ResourcePath, Exception], ~typing.Any] = <function _do_nothing>, on_undefined_exposure: ~collections.abc.Callable[[~lsst.resources._resourcePath.ResourcePath, str], ~typing.Any] = <function _do_nothing>, on_ingest_failure: ~collections.abc.Callable[[list[lsst.daf.butler._file_dataset.FileDataset], Exception], ~typing.Any] = <function _do_nothing>, fail_fast: bool = False) list[lsst.daf.butler._dataset_ref.DatasetRef]¶
Ingest the given files into the butler repository.
- Parameters:
- butler
lsst.daf.butler.Butler Butler in which to ingest the guider files.
- locations
list[lsst.resources.ResourcePathExpression] Guider files to ingest or directories of guider files.
- file_filter
str, optional The file filter to use if directories are to be searched.
- group_files: `bool`, optional
If
Truefiles are ingested in groups based on the directories they are found in. IfFalsedirectories are searched and all files are ingested together. If explicit files are given they are treated as their own group.- run
strorNone, optional The name of the run that will be receiving these datasets. By default. if
None, a value of<INSTRUMENT>/raw/guideris used.- transfer
str, optional Transfer mode to use for ingest. Default is “auto”. If “direct” mode is used ingestion of a file that is already present in the butler repo will not be an error.
- register_dataset_type
bool, optional If
Truethe dataset type will be created if it is not defined. Default isFalse.- track_file_attrs
bool, optional Control whether file attributes such as the size or checksum should be tracked by the datastore. Whether this parameter is honored depends on the specific datastore implementation.
- on_success
Callable, optional A callback invoked when all of the raws associated with a group are ingested. Will be passed a list of
FileDatasetobjects, each containing one or more resolvedDatasetRefobjects. If this callback raises it will interrupt the entire ingest process, even iffail_fastisFalse.- on_metadata_failure
Callable, optional A callback invoked when a failure occurs trying to translate the metadata for a file. Will be passed the URI and the exception, in that order, as positional arguments. Guaranteed to be called in an
exceptblock, allowing the callback to re-raise or replace (withraise ... from) default exception handling.- on_undefined_exposure
Callable, optional A callback invoked when a guider file can’t be ingested because the corresponding exposure dimension record does not yet exist. Will be passed the URI and the OBSID.
- on_ingest_failure
Callable, optional A callback invoked when dimension record or dataset insertion into the database fails for an exposure. Will be passed a list of
FileDatasetobjects corresponding to the files being ingested, and the exception as positional arguments. Guaranteed to be called in anexceptblock, allowing the callback to re-raise or replace (withraise ... from) to override the usual error handling (beforefail_fastlogic occurs).- fail_fast
bool, optional If
Trueingest will abort if there is any issue with any files. IfFalse, an attempt will be made
- butler
- Returns:
- refs
list[DatasetRef] Butler datasets that were ingested.
- refs
Notes
Always uses a dataset type named “guider_raw” with dimensions instrument, detector, exposure. The exposure must already be defined.