Skip to content

Commit 5316587

Browse files
committed
Merge branch 'devel'
2 parents cb84784 + ec2d6cd commit 5316587

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

run_tesscorr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def main():
3131
parser.add_argument('--camera', type=int, choices=(1,2,3,4), default=None, help='TESS Camera. Default is to run all cameras.')
3232
parser.add_argument('--ccd', type=int, choices=(1,2,3,4), default=None, help='TESS CCD. Default is to run all CCDs.')
3333
parser.add_argument('--starid', type=int, help='TIC identifier of target.', nargs='?', default=None)
34-
parser.add_argument('--datasource', type=str, choices=('ffi','tpf'), default='ffi', help='Data source or cadence.')
34+
parser.add_argument('--datasource', type=str, choices=('ffi','tpf'), default=None, help='Data source or cadence. Default is to run all.')
3535
parser.add_argument('input_folder', type=str, help='Input directory. This directory should contain a TODO-file and corresponding lightcurves.', nargs='?', default=None)
3636
parser.add_argument('output_folder', type=str, help='Directory to save output in.', nargs='?', default=None)
3737
args = parser.parse_args()

run_tesscorr_mpi.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,31 @@
2828
import traceback
2929
import os
3030
import enum
31-
import corrections
3231
from timeit import default_timer
32+
import corrections
3333

3434
#--------------------------------------------------------------------------------------------------
3535
def main():
3636
# Parse command line arguments:
3737
parser = argparse.ArgumentParser(description='Run TESS Corrections in parallel using MPI.')
38-
#parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
39-
#parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
38+
parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
39+
parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
4040
parser.add_argument('-m', '--method', help='Corrector method to use.', default=None, choices=('ensemble', 'cbv', 'kasoc_filter'))
4141
parser.add_argument('-o', '--overwrite', help='Overwrite existing results.', action='store_true')
4242
parser.add_argument('-p', '--plot', help='Save plots when running.', action='store_true')
4343
parser.add_argument('--camera', type=int, choices=(1,2,3,4), default=None, help='TESS Camera. Default is to run all cameras.')
4444
parser.add_argument('--ccd', type=int, choices=(1,2,3,4), default=None, help='TESS CCD. Default is to run all CCDs.')
45-
parser.add_argument('--datasource', type=str, choices=('ffi','tpf'), default='ffi', help='Data source or cadence.')
45+
parser.add_argument('--datasource', type=str, choices=('ffi','tpf'), default=None, help='Data source or cadence. Default is to run all.')
4646
parser.add_argument('input_folder', type=str, help='Input directory. This directory should contain a TODO-file and corresponding lightcurves.', nargs='?', default=None)
4747
args = parser.parse_args()
4848

49+
# Set logging level:
50+
logging_level = logging.INFO
51+
if args.quiet:
52+
logging_level = logging.WARNING
53+
elif args.debug:
54+
logging_level = logging.DEBUG
55+
4956
# Get input and output folder from environment variables:
5057
input_folder = args.input_folder
5158
if input_folder is None:
@@ -66,6 +73,9 @@ def main():
6673
if rank == 0:
6774
try:
6875
with corrections.TaskManager(input_folder, cleanup=True, overwrite=args.overwrite, summary=os.path.join(output_folder, 'summary_corr.json')) as tm:
76+
# Set level of TaskManager logger:
77+
tm.logger.setLevel(logging_level)
78+
6979
# Get list of tasks:
7080
numtasks = tm.get_number_tasks(camera=args.camera, ccd=args.ccd, datasource=args.datasource)
7181
tm.logger.info("%d tasks to be run", numtasks)
@@ -83,7 +93,7 @@ def main():
8393

8494
if tag == tags.DONE:
8595
# The worker is done with a task
86-
tm.logger.info("Got data from worker %d: %s", source, data)
96+
tm.logger.debug("Got data from worker %d: %s", source, data)
8797
tm.save_results(data)
8898

8999
if tag in (tags.DONE, tags.READY):
@@ -93,7 +103,7 @@ def main():
93103
task_index = task['priority']
94104
tm.start_task(task_index)
95105
comm.send(task, dest=source, tag=tags.START)
96-
tm.logger.info("Sending task %d to worker %d", task_index, source)
106+
tm.logger.debug("Sending task %d to worker %d", task_index, source)
97107
else:
98108
comm.send(None, dest=source, tag=tags.EXIT)
99109

0 commit comments

Comments
 (0)