def getRunInfo(filename, runIdent): """ Loads some run info from the JSON file created by Tom Marsh. Places it into an object of class runInfoObject and returns the object """ JSONfile = open(filename, "r") allObjectsJSON = json.load(JSONfile) (runDate, runNumber) = separateRunNameAndDate(runIdent) run = classes.runObject(runDate, runNumber) runNumberStr = runNumber[3:] runNumber = int(runNumberStr) for object in allObjectsJSON: date = object['night'] num = object['num'] if ((date == runDate) & (runNumber == num)): run.updateRunInfo(object) return run
runs_re = re.compile("run[0-9][0-9][0-9].xml") for i, f in enumerate(fileList): m = runs_re.match(f) if (m): runName = m.group()[:6] runList.append(runName) debug.write("This is the list of runs found in the folder for the date %s: %s"%(arg.date, str(runList))) runData = [] """ Now gather all of the run info meta-data we can for each one of these runs... """ for runID in runList: debug.write("Building meta-data for run:" + runID) newRun = classes.runObject(arg.date, runID) newRun.loadSelf(config) if newRun.comment=="": newRun.checkForComments(config.ULTRACAMRAW) debug.write(newRun, level = 2) newRun.writeSelf(config) runData.append(newRun) for run in runData: runID = run.runID runDate = run.runDate runname = ultracamutils.addPaths(runDate, runID) run.runDuration = ultracamutils.writeFriendlyTimeMinutes(run.expose) if (arg.buildruns):
colourMaps = {'r': 'Reds', 'g':'Greens', 'b':'Blues'} allObjects = { 'r': [], 'g': [], 'b':[]} config = ultracamutils.readConfigFile(arg.configfile) debug = classes.debugObject(config.DEBUG) debug.toggleTimeLog() if (arg.debuglevel!=None): debug.setLevel(arg.debuglevel); runFilename = utils.addPaths(config.ULTRACAMRAW, arg.runname) debug.write("Opening the Ultracam raw file at: " + runFilename, level = 3) runDate, runID = ultracamutils.separateRunNameAndDate(arg.runname) runInfo = classes.runObject(runDate, runID) runInfo.version = arg.version runInfo.loadSelf(config) debug.write("Run Info:\n----------------------", level = 2) debug.write(runInfo, level = 2) debug.write("----------------------", level = 2) if arg.preview: matplotlib.pyplot.ion() fig = matplotlib.pyplot.gcf() """ Check that the working folders and the output folders are there """ (runDate, runNumber) = ultracamutils.separateRunNameAndDate(arg.runname) workingFolder = ultracamutils.addPaths(config.WORKINGDIR, runDate)
def addRun(self, runName, comment=""): run = classes.runObject(self.date, runName) run.setComment(comment) self.runs.append(run)