24 from lsst.daf.butler
import Butler
29 def ingestRaws(repo, output_run, config=None, config_file=None, directory=None, file=None, transfer="auto",
30 ingest_task="lsst.obs.base.RawIngestTask"):
31 """Ingests raw frames into the butler registry
36 URI to the repository.
38 The path to the location, the run, where datasets should be put.
39 config : `dict` [`str`, `str`] or `None`
40 Key-vaule pairs to apply as overrides to the ingest config.
41 config_file : `str` or `None`
42 Path to a config file that contains overrides to the ingest config.
43 directory : `str` or `None`
44 Path to the directory containing the raws to ingest.
45 file : `str` or `None`
46 Path to a file containing raws to ingest.
47 transfer : `str` or None
48 The external data transfer type, by default "auto".
50 The fully qualified class name of the ingest task to use by default
51 lsst.obs.base.RawIngestTask.
55 `Exception` is raised if operations on configuration object fail.
57 butler = Butler(repo, run=output_run)
59 ingestConfig = TaskClass.ConfigClass()
60 ingestConfig.transfer = transfer
62 if config_file
is not None:
63 configOverrides.addFileOverride(config_file)
64 if config
is not None:
65 for name, value
in config:
66 configOverrides.addValueOverride(name, value)
67 configOverrides.applyTo(ingestConfig)
68 ingester = TaskClass(config=ingestConfig, butler=butler)
69 files = [file]
if file
is not None else []
70 if directory
is not None:
71 suffixes = (
".fits",
".fits.gz",
".fits.fz")
73 [os.path.join(directory, f)
for f
in os.listdir(directory)
if f.lower().endswith(suffixes)])