Utilities.ReportError(True,msg,"Main.py") for tNum,t in enumerate(trials): # get the matching files for this trial trialFiles = [ fileN for fileN in filesFound if t in fileN] trialTimes = [] trialDiff = [] Utilities.globalIO.setTrial(t) stage3Folder = (Utilities.globalIO.getOutputDir([],"") + "Post_Stage3_Analysis/").\ replace("//","/") # stage 3 recquires knowing which model we will use... # XXX fix this to allow for different models? Pass as a param to model. cacheFileS3 = stage3Folder + "ModelParams4.npy" # if we have stage3, then just skip to the final .... if (not Utilities.dirExists(cacheFileS3) or forceStage3): fileData = [] for f in trialFiles: fileNameExt = os.path.basename(f) fileName = os.path.splitext(fileNameExt)[0] Utilities.globalIO.setFile(fileName) Utilities.globalIO.setStep("Step1::GetTraces") # get the output dir with no prior / after path outputDir = Utilities.globalIO.getOutputDir([],"") checkPointDir = outputDir + Utilities.CheckpointDir checkPointFilePath = checkPointDir + 'Stage_' # ensure the saving directory exists Utilities.ensureDirExists(checkPointDir) stageCount = 1
for t in trials: filesFound=[ testDir+f for f in filesFound if str(f).endswith(testDataType)] if (len(filesFound) < 1): msg = "Couldn't find any file like [{}] in [{}]".format(testDataType, testDir) Utilities.ReportError(True,msg,"Main.py") # just use a single file for this testing bit. filesFound = [filesFound[0]] fileNameExt = os.path.basename(filesFound[0]) fileName = os.path.splitext(fileNameExt)[0] Utilities.globalIO.setTrial(t) Utilities.globalIO.setFile(fileName) Utilities.globalIO.setStep("Step1::GetTraces") outputDir = Utilities.globalIO.getOutputDir([],"") stage1Folder = outputDir + "Post_Stage1_Analysis/" if (not Utilities.dirExists(stage1Folder)): # get the X,Y velocity, times, and ratio on a per protein basis # each of these is a list. Each element in a list corresponds to data # for a single protein trackedTimes,trackedFRET,trackedDiffusion = \ GetTraces.GetTracesMain(filesFound) # get the output dir for the previous path. else: # the output directory exists; no sense in re-running the analysis. # just use the text output. Utilities.ReportMessage("Skipping Stage1 since [" + stage1Folder + "] already exists") trackedTimes, trackedDiffusion,trackedFRET = \ Utilities.loadAll(stage1Folder,fileNames) # POST: now have valid, trackable diffusion, times, and FRET # Move to stage 2. where we get the unfolding times