Commit 70613163 authored by Monica's avatar Monica
Browse files

Change to use date and configuration file at the same time

parent 487611fb
......@@ -19,6 +19,8 @@ webuidatabases
*~
.~*
gofio/calibrations
gofio/raw
gofio/reduced
gofio/resources/straight_giano_2D
gofio/resources/straight_giano_2D_v1_1_old.f
gofio/resources/*MASKC*.fits
......
import os, sys, time
from drslib.config import CONFIG, read_usr_config
from drslib.config import CONFIG, USRCONFIG, read_usr_config
from drslib.logger import DrsLogger
from drslib import db, rawfiles, darkframes, flatframes, wlframes, nodding, stare
......@@ -8,39 +8,46 @@ from drslib import db, rawfiles, darkframes, flatframes, wlframes, nodding, star
def gofio_init(docopt_args):
if docopt_args['--cfg']:
try:
USRCONFIG = read_usr_config(docopt_args['-g'])
USRCFG = read_usr_config(docopt_args['-g'])
except:
try:
USRCONFIG = read_usr_config(docopt_args['--cfg'])
USRCFG = read_usr_config(docopt_args['--cfg'])
except:
USRCONFIG = {}
USRCONFIG['OFFLINE'] = False
USRCFG = {}
USRCFG['OFFLINE'] = False
for key in USRCFG.keys():
USRCONFIG[key] = USRCFG[key]
if USRCONFIG['OFFLINE']:
for key in USRCONFIG.keys():
CONFIG[key] = USRCONFIG[key]
if USRCONFIG['OFFLINE']:
for key in USRCONFIG.keys():
CONFIG[key] = USRCONFIG[key]
if docopt_args['<date>']:
CONFIG['DATE'] = docopt_args['<date>']
CONFIG['RAW_DIR'] = os.path.join(CONFIG['BASE_RAW'],CONFIG['DATE'])
CONFIG['OFFLINE_DIR'] = os.path.join(CONFIG['BASE_RED_DIR'],CONFIG['DATE'])
CONFIG['RED_DIR'] = os.path.join(CONFIG['OFFLINE_DIR'],'offline')
CONFIG['RED_CALIB'] = os.path.join(CONFIG['RED_DIR'],'CALIB')
CONFIG['RED_STR'] = os.path.join(CONFIG['RED_DIR'],'STR')
CONFIG['LOG_FILE'] = os.path.join(CONFIG['RED_DIR'], 'drs.log')
CONFIG['RAMP_NAME'] = 'ramps' + CONFIG['DATE'] + '.db'
CONFIG['DB_RAMP'] = os.path.join(CONFIG['BASE_RAMP'],CONFIG['RAMP_NAME'])
CONFIG['RAW_DIR'] = os.path.join(CONFIG['BASE_RAW'],CONFIG['DATE'])
CONFIG['OFFLINE_DIR'] = os.path.join(CONFIG['BASE_RED_DIR'],CONFIG['DATE'])
CONFIG['RED_DIR'] = os.path.join(CONFIG['OFFLINE_DIR'],'offline')
CONFIG['RED_CALIB'] = os.path.join(CONFIG['RED_DIR'],'CALIB')
CONFIG['RED_STR'] = os.path.join(CONFIG['RED_DIR'],'STR')
CONFIG['LOG_FILE'] = os.path.join(CONFIG['RED_DIR'], 'drs.log')
CONFIG['RAMP_NAME'] = 'ramps' + CONFIG['DATE'] + '.db'
CONFIG['DB_RAMP'] = os.path.join(CONFIG['BASE_RAMP'],CONFIG['RAMP_NAME'])
CONFIG['DB_OFFLINE'] = ''.join(('db_',CONFIG['DATE'],'_offline.db'))
CONFIG['DB_OFFLINE_PATH'] = os.path.join(CONFIG['WEBUI_DB_DIR'], CONFIG['DB_OFFLINE'])
CONFIG['DB_NIGHT'] = CONFIG['DB_OFFLINE']
CONFIG['DB_NIGHT_PATH'] = CONFIG['DB_OFFLINE_PATH']
CONFIG['DB_OFFLINE'] = ''.join(('db_',CONFIG['DATE'],'_offline.db'))
CONFIG['DB_OFFLINE_PATH'] = os.path.join(CONFIG['WEBUI_DB_DIR'], CONFIG['DB_OFFLINE'])
CONFIG['DB_NIGHT'] = CONFIG['DB_OFFLINE']
CONFIG['DB_NIGHT_PATH'] = CONFIG['DB_OFFLINE_PATH']
maskc = ''.join(('GIANOB_MASKC_',CONFIG['DATE'],'.fits'))
CONFIG['MASK_C'] = os.path.join(CONFIG['RES_DIR'], maskc)
maskc = ''.join(('GIANOB_MASKC_',CONFIG['DATE'],'.fits'))
CONFIG['MASK_C'] = os.path.join(CONFIG['RES_DIR'], maskc)
if docopt_args['<date>']:
elif docopt_args['<date>']:
if docopt_args['--all_calib']:
docopt_args['--dark'] = True
docopt_args['--flat'] = True
......
......@@ -4,15 +4,16 @@ Written by Monica Rainer
Usage:
gofioDRS.py -h
gofioDRS.py [-g=<gofio_config>]
gofioDRS.py [-g=<config>]
gofioDRS.py <date> [-g=<config>]
gofioDRS.py <date> <calib_date> [-g=<config>]
gofioDRS.py <date> [--dark --flat --une --fp --all_calib --only_calib --use_flat=<flag> --s1d=<s1d>]
gofioDRS.py <date> <calib_date> [--dark --flat --une --fp --all_calib --only_calib --use_flat=<flag> --s1d=<s1d>]
Options:
-h,--help : show this screen
-g,--cfg : path of the configuration file (optional)
date : date to be reduced, no configuration file possible
(always first input)
-g,--cfg=<config> : path of the configuration file (optional)
date : date to be reduced (always first input)
calib_date : calibration date to be used (always second input)
--dark : darks are reduced
--flat : flats are reduced
......@@ -47,6 +48,7 @@ from watchdog.events import PatternMatchingEventHandler
# read docopt args
# --------------------------------
docopt_args = docopt(__doc__)
#print docopt_args
def run_gofio(CONFIG, rawlists, dbcalib, working, group, stop, drslogger, dbnight, dbramps):
do_calib = CONFIG['DO_CALIB']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment