Coverage for python/lsst/obs/base/script/ingestRaws.py: 17%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

17 statements  

1# This file is part of obs_base. 

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/>. 

21 

22from lsst.daf.butler import Butler 

23from lsst.pipe.base.configOverrides import ConfigOverrides 

24from lsst.utils import doImport 

25 

26 

27def ingestRaws( 

28 repo, 

29 locations, 

30 regex, 

31 output_run, 

32 config=None, 

33 config_file=None, 

34 transfer="auto", 

35 processes=1, 

36 ingest_task="lsst.obs.base.RawIngestTask", 

37): 

38 """Ingests raw frames into the butler registry 

39 

40 Parameters 

41 ---------- 

42 repo : `str` 

43 URI to the repository. 

44 locations : `list` [`str`] 

45 Files to ingest and directories to search for files that match 

46 ``regex`` to ingest. 

47 regex : `str` 

48 Regex string used to find files in directories listed in locations. 

49 output_run : `str` 

50 The path to the location, the run, where datasets should be put. 

51 config : `dict` [`str`, `str`] or `None` 

52 Key-value pairs to apply as overrides to the ingest config. 

53 config_file : `str` or `None` 

54 Path to a config file that contains overrides to the ingest config. 

55 transfer : `str` or None 

56 The external data transfer type, by default "auto". 

57 processess : `int` 

58 Number of processes to use for ingest. 

59 ingest_task : `str` 

60 The fully qualified class name of the ingest task to use by default 

61 lsst.obs.base.RawIngestTask. 

62 

63 Raises 

64 ------ 

65 Exception 

66 Raised if operations on configuration object fail. 

67 """ 

68 butler = Butler(repo, writeable=True) 

69 TaskClass = doImport(ingest_task) 

70 ingestConfig = TaskClass.ConfigClass() 

71 ingestConfig.transfer = transfer 

72 configOverrides = ConfigOverrides() 

73 if config_file is not None: 

74 configOverrides.addFileOverride(config_file) 

75 if config is not None: 

76 for name, value in config.items(): 

77 configOverrides.addValueOverride(name, value) 

78 configOverrides.applyTo(ingestConfig) 

79 ingester = TaskClass(config=ingestConfig, butler=butler) 

80 ingester.run(locations, run=output_run, processes=processes, file_filter=regex)