-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathrun_create_todolist.py
54 lines (46 loc) · 1.97 KB
/
run_create_todolist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Command-line interface for creating todo-file by scanning directory for light curve files..
.. codeauthor:: Rasmus Handberg <[email protected]>
"""
import argparse
import logging
import starclass
#--------------------------------------------------------------------------------------------------
def main():
# Parse command line arguments:
parser = argparse.ArgumentParser(description='')
parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
parser.add_argument('-o', '--overwrite', help='Overwrite existing todo-file.', action='store_true')
parser.add_argument('--pattern', type=str, default=None, help='File pattern to search for light curves with.')
parser.add_argument('--name', type=str, default='todo.sqlite', help='Name of todo-file to create.')
parser.add_argument('input_folder', type=str, help='Directory containing light curves to build todo-file from.')
args = parser.parse_args()
# Set logging level:
logging_level = logging.INFO
if args.quiet:
logging_level = logging.WARNING
elif args.debug:
logging_level = logging.DEBUG
# Setup logging:
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
console = logging.StreamHandler()
console.setFormatter(formatter)
logger = logging.getLogger(__name__)
logger.addHandler(console)
logger.setLevel(logging_level)
logger_parent = logging.getLogger('starclass')
logger_parent.addHandler(console)
logger_parent.setLevel(logging_level)
# Make sure we have turned plotting to non-interactive:
starclass.plots.plots_noninteractive()
# Download all data:
starclass.todolist.create_fake_todolist(args.input_folder,
name=args.name,
pattern=args.pattern,
overwrite=args.overwrite)
#--------------------------------------------------------------------------------------------------
if __name__ == '__main__':
main()