Commit 32055240 authored by Lab Saha's avatar Lab Saha
Browse files

Merge branch 'master' into 'master'

updating some of the scripts

See merge request contrera/lstosa!13
parents 07844fed d25ae0b1
......@@ -15,13 +15,14 @@ PYTHONBIN = /usr/bin
#HOMEDIR = /fefs/aswg
HOMEDIR = /home/lab.saha
LSTCHAINDIR = /home/lab.saha
CONFIGFILE = %(HOMEDIR)s/
PYTHONDIR = %(HOMEDIR)s/lst-osa
CONFIGFILE = /fefs/aswg/software/virtual_env/ctasoft/cta-lstchain/lstchain/data/lstchain_standard_config.json
PYTHONDIR = %(HOMEDIR)s/lstosa
#CALIBDIR = %(HOMEDIR)s/data/real/calibration/v000
#PEDESTALDIR =%(CALIBDIR)s
#DRIVEDIR = /fefs/home/lapp/DrivePositioning
#R0-DL1 = lstchain_data_r0_to_dl
R0-DL1 = hello.py
R0-DL1 = lstchain_data_r0_to_dl1
DL1-DL2 = hello.py
#R0-DL1 = hello.py
#BINDIR = %(HOMEDIR)s/bin
# Temporal storage in working node local disk
#SCRATCHDIR = /scratch
......@@ -93,11 +94,12 @@ REPORTDIR = %(DIR)s/OSA/CC
DRIVEDIR = %(DIR)s/DrivePositioning
CALIBDIR = %(DIR)s/calibration
PEDESTALDIR = %(DIR)s/calibration
ANALYSISDIR = %(DIR)s/data/real/dl1
ANALYSISDIR = %(DIR)s/data/real/DL1
CLOSERDIR = %(DIR)s/lst-osa/Closer
ENDOFRAWTRANSFERDIR = %(DIR)s/Reports/Compress
CALIBRATIONCONFIGCARD = onsite_camera_calibration_param.json
CONFIGCARD =
VERSION = v01
[LST2]
DIR = /fefs/aswg/lst-osa
......
from standardhandle import output, warning, verbose, error, gettag
import options, cliopts
from osa.utils.standardhandle import output, warning, verbose, error, gettag
from osa.utils import options, cliopts
##############################################################################
#
# writeworkflow
......
from standardhandle import output, verbose, error, errornonfatal, gettag
import options
from osa.utils.standardhandle import output, verbose, error, errornonfatal, gettag
from osa.utils import options
##############################################################################
#
# readfromfile
......
......@@ -211,7 +211,8 @@ def setsequencecalibfilenames(sequence_list):
pedfile = '666ped.root'
drivefile = '666drive.txt'
else:
run_string = str(s.parent_list[0].run).zfill(8)
run_string = str(s.parent_list[0].run).zfill(5)
ped_run_string = str(s.parent_list[0].previousrun).zfill(5)
# print("DEBUG",s.subrun_list[0].time)
# print("DEBUG2",s.subrun_list[0].date)
date_string = str(s.subrun_list[0].date).zfill(8)
......@@ -222,7 +223,7 @@ def setsequencecalibfilenames(sequence_list):
calfile = "calibration.Run{0}.0000{1}".\
format(run_string, scalib_suffix)
pedfile = "drs4_pedestal.Run{0}.0000{1}".\
format(run_string, pedestal_suffix)
format(ped_run_string, pedestal_suffix)
drivefile = "drive_log_{0}_{1}_{2}{3}".\
format(yy, mm, dd, drive_suffix)
elif ( options.mode == 'S' or options.mode == 'T' ):
......@@ -289,10 +290,14 @@ def createjobtemplate(s):
import os
import iofile
from osa.configs import config
from osa.utils.utils import lstdate_to_dir
bindir = config.cfg.get('LSTOSA', 'PYTHONDIR')
calibdir = config.cfg.get('LST1', 'CALIBDIR')
pedestaldir = config.cfg.get('LST1', 'PEDESTALDIR')
drivedir = config.cfg.get('LST1', 'DRIVEDIR')
nightdir = lstdate_to_dir(options.date)
version = config.cfg.get('LST1', 'VERSION')
command = None
if s.type == 'CALIBRATION':
command = os.path.join(bindir, 'calibrationsequence.py')
......@@ -326,10 +331,11 @@ def createjobtemplate(s):
commandargs.append('-d')
commandargs.append(options.date)
if s.type == 'DATA':
commandargs.append(os.path.join(calibdir, s.calibration))
commandargs.append(os.path.join(pedestaldir, s.pedestal))
commandargs.append(os.path.join(calibdir, nightdir, version, s.calibration))
commandargs.append(os.path.join(pedestaldir, nightdir, version, s.pedestal))
commandargs.append(os.path.join(calibdir, nightdir, version, 'time_'+ s.calibration))
commandargs.append(os.path.join(drivedir, s.drive))
commandargs.append(str(s.run).zfill(8))
commandargs.append(str(s.run).zfill(5))
if s.type != 'STEREO':
commandargs.append(options.tel_id)
......
......@@ -259,7 +259,7 @@ def extractsequencesstereo(s1_list, s2_list):
if s2.run == s1.run:
ss = SequenceStereo(s1, s2)
ss.seq = len(ss_list)
ss.jobname = "{0}_{1}".format(ss.telescope, str(ss.run).zfill(8))
ss.jobname = "{0}_{1}".format(ss.telescope, str(ss.run).zfill(5))
setsequencefilenames(ss)
ss_list.append(ss)
break
......@@ -308,7 +308,7 @@ def generateworkflow(run_list, store, require):
break
s.previousrun = previousrun
s.jobname = "{0}_{1}".format(r.telescope, str(r.run).zfill(8))
s.jobname = "{0}_{1}".format(r.telescope, str(r.run).zfill(5))
job.setsequencefilenames(s)
if s not in sequence_list: sequence_list.append(s)
elif r.type == 'CALIBRATION':
......@@ -322,7 +322,7 @@ def generateworkflow(run_list, store, require):
s.seq = seq
s.parent = None
s.previousrun = previousrun
s.jobname = "{0}_{1}".format(r.telescope, str(r.run).zfill(8))
s.jobname = "{0}_{1}".format(r.telescope, str(r.run).zfill(5))
job.setsequencefilenames(s)
verbose(tag, "Sequence {0} assigned to run {1} whose parent is {2} with run {3}".format(\
s.seq, r.run, s.parent, s.previousrun))
......
......@@ -134,7 +134,7 @@ def calibrationsequencecliparsing(command):
##############################################################################
def datasequencecliparsing(command):
tag = standardhandle.gettag()
message = "usage: %prog [-vw] [--stderr=FILE] [--stdout=FILE] [-c CONFIGFILE] [-d DATE] [-o OUTPUTDIR] [-z] <calibrationfile> <pedestalfile> <drivefile> <RUN> <TEL_ID>"
message = "usage: %prog [-vw] [--stderr=FILE] [--stdout=FILE] [-c CONFIGFILE] [-d DATE] [-o OUTPUTDIR] [-z] <calibrationfile> <pedestalfile> <drivefile> <timecalibration> <RUN> <TEL_ID>"
parser = OptionParser(usage = message)
parser.add_option("-c", "--config", action = "store", dest = "configfile", default = None,
help = "use specific config file [default cfg/osa.cfg]")
......@@ -171,14 +171,14 @@ def datasequencecliparsing(command):
standardhandle.verbose(tag, "the argument is {0}".format(args))
# Checking arguments
if len(args) != 5:
if len(args) != 6:
standardhandle.error(tag, "incorrect number of arguments, type -h for help", 2)
# Mapping the telescope argument to an option parameter (it might become an option in the future)
elif args[4] == 'ST':
elif args[5] == 'ST':
standardhandle.error(tag, "not yet ready for telescope {0}".format(options.options.tel_id), 2)
elif args[4] != 'LST1' and args[4] != 'LST2':
elif args[5] != 'LST1' and args[5] != 'LST2':
standardhandle.error(tag, "wrong telescope id, use 'LST1', 'LST2' or 'ST'", 2)
options.tel_id = args[4]
options.tel_id = args[5]
# Setting the default date and directory if needed
options.configfile = set_default_configfile_if_needed(command)
......
......@@ -266,7 +266,8 @@ def lstdate_to_dir(night):
nightdir = night.split(cfg.get('LST', 'DATESEPARATOR'))
if len(nightdir) != 3:
error(tag, "Error: night directory structure could not be created from {0}\n".format(nightdir), 1)
dir = join(nightdir[0], nightdir[1], nightdir[2])
# dir = join(nightdir[0], nightdir[1], nightdir[2])
dir = "".join(nightdir)
return dir
##############################################################################
#
......
......@@ -99,6 +99,7 @@ def single_process(telescope, process_mode):
""" Building the sequences """
night = readnightsummary() # night corresponds to f.read()
print(night)
subrun_list = extract.extractsubruns(night)
run_list = extract.extractruns(subrun_list)
# Modifies run_list by adding the seq and parent info into runs
......
Supports Markdown
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