Coverage for python / lsst / obs / lsst / cli / cmd / commands.py: 98%
45 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-24 08:43 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-24 08:43 +0000
1# This file is part of obs_lsst.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21import click
23from lsst.daf.butler.cli.opt import (
24 config_option,
25 config_file_option,
26 locations_argument,
27 options_file_option,
28 repo_argument,
29 regex_option,
30 run_option,
31 transfer_option,
32 register_dataset_types_option,
33)
34from lsst.pipe.base.cli.opt import instrument_argument
35from lsst.daf.butler.cli.utils import ButlerCommand
36from ... import script
37from ..._ingest_guider import DEFAULT_GUIDER_REGEX
38from ..._ingestAuxCalibs import DEFAULT_PHOTODIODE_REGEX
41@click.command(cls=ButlerCommand, short_help="Ingest photodiode data.")
42@repo_argument(required=True)
43@instrument_argument(required=True, help="INSTRUMENT is the name of the instrument to use.")
44@locations_argument(help="LOCATIONS specifies files to ingest and/or locations to search for files.",
45 required=True)
46@regex_option(default=DEFAULT_PHOTODIODE_REGEX,
47 help="Regex string used to find photodiode data in directories listed in LOCATIONS. "
48 f"Defaults to {DEFAULT_PHOTODIODE_REGEX}")
49@config_option(metavar="TEXT=TEXT", multiple=True)
50@config_file_option(type=click.Path(exists=True, writable=False, file_okay=True, dir_okay=False))
51@run_option(required=False)
52@transfer_option(default="copy")
53@click.option(
54 "--track-file-attrs/--no-track-file-attrs",
55 default=True,
56 help="Indicate to the datastore whether file attributes such as file size"
57 " or checksum should be tracked or not. Whether this parameter is honored"
58 " depends on the specific datastore implementation.",
59)
60@options_file_option()
61def ingest_photodiode(*args, **kwargs):
62 """Ingest photodiode data from a directory into the butler registry."""
63 script.ingestPhotodiode(*args, **kwargs)
65@click.command(cls=ButlerCommand, short_help="Ingest shutter motion profile data.")
66@repo_argument(required=True)
67@instrument_argument(required=True, help="INSTRUMENT is the name of the instrument to use.")
68@locations_argument(help="LOCATIONS specifies files to ingest and/or locations to search for files.",
69 required=True)
70@regex_option(default=None,
71 help="Regex string used to find shutter motion data in directories listed in LOCATIONS. "
72 "Defaults to None, to use expected regexes.")
73@config_option(metavar="TEXT=TEXT", multiple=True)
74@config_file_option(type=click.Path(exists=True, writable=False, file_okay=True, dir_okay=False))
75@run_option(required=False)
76@transfer_option(default="copy")
77@click.option(
78 "--track-file-attrs/--no-track-file-attrs",
79 default=True,
80 help="Indicate to the datastore whether file attributes such as file size"
81 " or checksum should be tracked or not. Whether this parameter is honored"
82 " depends on the specific datastore implementation.",
83)
84@options_file_option()
85def ingest_shuttermotion(*args, **kwargs):
86 """Ingest shutter motion data from a directory into the butler registry."""
87 script.ingestShutterMotion(*args, **kwargs)
90@click.command(cls=ButlerCommand, short_help="Ingest LSSTCam guider data.")
91@repo_argument(required=True)
92@locations_argument(help="LOCATIONS specifies files to ingest and/or locations to search for files.",
93 required=True)
94@regex_option(default=DEFAULT_GUIDER_REGEX,
95 help="Regex string used to find photodiode data in directories listed in LOCATIONS. "
96 f"Defaults to {DEFAULT_GUIDER_REGEX}")
97@run_option(
98 required=False,
99 default=None,
100 help="Run collection place these guider files. Default is to create collection based on instrument.",
101)
102@transfer_option(default="direct")
103@click.option(
104 "--track-file-attrs/--no-track-file-attrs",
105 default=True,
106 help="Indicate to the datastore whether file attributes such as file size"
107 " or checksum should be tracked or not. Whether this parameter is honored"
108 " depends on the specific datastore implementation.",
109)
110@click.option(
111 "--fail-fast/--no-fail-fast",
112 default=False,
113 is_flag=True,
114 help=(
115 "Stop ingest as soon as any problem is encountered with any file. "
116 "Otherwise problem files will be skipped and logged and a report issued at completion."
117 )
118)
119@register_dataset_types_option()
120@options_file_option()
121def ingest_guider(*args, **kwargs):
122 """Ingest LSSTCam guider data into a butler repository."""
123 script.ingest_guider_simple(*args, **kwargs)