Coverage for python/lsst/obs/lsst/cli/cmd/commands.py: 100%

19 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-08 07:11 -0700

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 

22 

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) 

33from lsst.pipe.base.cli.opt import instrument_argument 

34from lsst.daf.butler.cli.utils import ButlerCommand 

35from ... import script 

36 

37 

38defaultRegex = r".*Photodiode_Readings.*txt\b" 

39 

40 

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=defaultRegex, 

47 help="Regex string used to find photodiode data in directories listed in LOCATIONS. " 

48 f"Defaults to {defaultRegex}") 

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 implentation.", 

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)