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(repo, locations, regex, output_run, config=None, config_file=None, transfer="auto", 

28 processes=1, ingest_task="lsst.obs.base.RawIngestTask"): 

29 """Ingests raw frames into the butler registry 

30 

31 Parameters 

32 ---------- 

33 repo : `str` 

34 URI to the repository. 

35 locations : `list` [`str`] 

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

37 ``regex`` to ingest. 

38 regex : `str` 

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

40 output_run : `str` 

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

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

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

44 config_file : `str` or `None` 

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

46 transfer : `str` or None 

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

48 processess : `int` 

49 Number of processes to use for ingest. 

50 ingest_task : `str` 

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

52 lsst.obs.base.RawIngestTask. 

53 

54 Raises 

55 ------ 

56 Exception 

57 Raised if operations on configuration object fail. 

58 """ 

59 butler = Butler(repo, writeable=True) 

60 TaskClass = doImport(ingest_task) 

61 ingestConfig = TaskClass.ConfigClass() 

62 ingestConfig.transfer = transfer 

63 configOverrides = ConfigOverrides() 

64 if config_file is not None: 

65 configOverrides.addFileOverride(config_file) 

66 if config is not None: 

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

68 configOverrides.addValueOverride(name, value) 

69 configOverrides.applyTo(ingestConfig) 

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

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