fLists = aux.getFilteredFiles( PT_PRE+'*_00_*'+AOI+'*srp.bz', PT_PRE+'*'+AOI+'*'+'*srp.bz' ) else: fLists = glob(PT_PRE+'*'+AOI+'*'+'*srp.bz') ########################################################################### # Iterate through experiments ########################################################################### msg = '* Plotting ({}/{})' filesNum = len(repFiles) for (i, repFile) in enumerate(repFiles): print(msg.format(i+1, filesNum), end='\r') (repDta, xpid) = ( pkl.load(repFile), exp.getXpId(repFile, [1, 2, 3, 4, 5, 7]) ) xpRow = [monet.filterDFWithID(i, xpid) for i in (dfTTI, dfTTO, dfWOP, dfMNX)] (tti, tto, wop) = [float(row[str(THS)]) for row in xpRow[:3]] (mnf, mnd) = (float(xpRow[3]['min']), float(xpRow[3]['minx'])) pop = repDta['landscapes'][0][0][-1] plt.exportTracesPlot( repDta, repFile.split('/')[-1][:-6]+str(QNT), STYLE, PT_IMG, vLines=[tti, tto, mnd], hLines=[mnf*pop], wop=wop ) monet.exportGeneLegend( repDta['genotypes'], [i[:-2]+'cc' for i in CLR], PT_IMG+'/plt_{}.png'.format(AOI), 500 ) print(msg.format(i+1, filesNum), end='\r')
# Load postprocessed files -------------------------------------------- pstPat = PT_MTR + AOI + '_{}_' + QNT + '_qnt.csv' pstFiles = [pstPat.format(i) for i in aux.DATA_NAMES] if (not cacheExists) or True: # (aux.OVW): (dfTTI, dfTTO, dfWOP, _, dfMNX, dfPOE, dfCPT) = [pd.read_csv(i) for i in pstFiles[:-1]] allDF = (dfTTI, dfTTO, dfWOP, dfMNX, dfPOE, dfCPT) # Filtered tuples ----------------------------------------------------- fmtStr = '{}* Generating file tuples for processing ({})...{}' print(fmtStr.format(monet.CBBL, expsNum, monet.CEND), end='\r') expsIter = [None] * expsNum for i in range(expsNum): repFile = repSamples[i] xpid = monet.getXpId(repFile, xpidIx) xpRow = [ monet.filterDFWithID(j, xpid, max=len(xpidIx)) for j in allDF ] (tti, tto, wop) = [float(row[THS]) for row in xpRow[:3]] (mnf, mnd, poe, cpt) = (float(xpRow[3]['min']), float(xpRow[3]['minx']), float(xpRow[4]['POE']), float(xpRow[5]['CPT'])) expsIter[i] = (expsNum - i, repFile, tti, tto, wop, mnf, mnd, poe, cpt) pkl.dump(expsIter, path.join(PT_MTR, tpsName)) sys.stdout.write("\033[K") else: expsIter = pkl.load(path.join(PT_MTR, tpsName)) expsIter.reverse() # expsIter = [i for i in expsIter if i[1]=='/Volumes/marshallShare/STP_Grid/SDR/SPA/265_DR/PREPROCESS/E_01_12_00500_000790000000_000100000000_0017500_0011700_0000000_0100000_0095600-HLT_01_srp.bz'] ########################################################################### # Iterate through experiments
def exportPstTracesPlotWrapper(exIx, repFiles, xpidIx, dfTTI, dfTTO, dfWOP, dfMNX, dfPOE, dfCPT, STABLE_T, THS, QNT, STYLE, PT_IMG, border=True, borderColor='#322E2D', borderWidth=1, labelPos=(.75, .95), xpsNum=0, digs=3, autoAspect=False, popScaler=1, wopPrint=True, cptPrint=True, poePrint=True, mnfPrint=True, transparent=False, ticksHide=True, sampRate=1, fontsize=5, labelspacing=.1, vlines=[], hlines=[]): padi = str(exIx + 1).zfill(digs) fmtStr = '{}+ File: {}/{}' print(fmtStr.format(monet.CBBL, padi, len(repFiles), monet.CEND), end='\r') repFile = repFiles[exIx] (repDta, xpid) = (pkl.load(repFile), monet.getXpId(repFile, xpidIx)) xpRow = [ monet.filterDFWithID(j, xpid, max=len(xpidIx)) for j in (dfTTI, dfTTO, dfWOP, dfMNX, dfPOE, dfCPT) ] (tti, tto, wop) = [float(row[THS]) for row in xpRow[:3]] (mnf, mnd, poe, cpt) = (float(xpRow[3]['min']), float(xpRow[3]['minx']), float(xpRow[4]['POE']), float(xpRow[5]['CPT'])) # Traces ------------------------------------------------------------------ pop = repDta['landscapes'][0][STABLE_T][-1] # STYLE['yRange'] = (0, pop*popScaler) exportTracesPlot(repDta, repFile.split('/')[-1][:-6] + str(QNT), STYLE, PT_IMG, vLines=[tti, tto, 0] + vlines, hLines=[0] + hlines, labelPos=labelPos, border=border, borderColor=borderColor, borderWidth=borderWidth, autoAspect=autoAspect, popScaler=popScaler, wop=wop, wopPrint=wopPrint, cpt=cpt, cptPrint=cptPrint, poe=poe, poePrint=poePrint, mnf=mnf, mnfPrint=mnfPrint, transparent=transparent, ticksHide=ticksHide, sampRate=sampRate, fontsize=fontsize, labelspacing=labelspacing) return None