def exportPreTracesParallel(exIx, STYLE, PT_IMG, border=True, borderColor='#322E2D', borderWidth=1, autoAspect=False, xpNum=0, digs=3, vLines=[0, 0], hLines=[0], popScaler=1, sampRate=1): monet.printProgress(exIx[0], xpNum, digs) repFilePath = exIx[1][1] repDta = pkl.load(repFilePath) name = path.splitext(repFilePath.split('/')[-1])[0][:-4] monet.exportTracesPlot(repDta, name, STYLE, PT_IMG, wopPrint=False, autoAspect=autoAspect, border=border, borderColor=borderColor, borderWidth=borderWidth, sampRate=sampRate) return None
def exportPstTracesParallel( exIx, expsNum, STABLE_T, THS, QNT, STYLE, PT_IMG, border=True, borderColor='#322E2D', borderWidth=1, labelPos=(.7, .9), xpsNum=0, digs=3, autoAspect=False, popScaler=1, wopPrint=True, cptPrint=True, poePrint=True, mnfPrint=True, ticksHide=True, transparent=True, sampRate=1, labelspacing=.1 ): (ix, repFile, tti, tto, wop, mnf, _, poe, cpt) = exIx repDta = pkl.load(repFile) # Print to terminal ------------------------------------------------------- padi = str(ix+1).zfill(digs) fmtStr = '{}+ File: {}/{}' print(fmtStr.format(monet.CBBL, padi, expsNum, monet.CEND), end='\r') # Traces ------------------------------------------------------------------ pop = repDta['landscapes'][0][STABLE_T][-1] # STYLE['yRange'] = (0, pop*popScaler) monet.exportTracesPlot( repDta, repFile.split('/')[-1][:-6]+str(QNT), STYLE, PT_IMG, vLines=[tti, tto, 0], hLines=[mnf*pop], 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, ticksHide=ticksHide, transparent=True, sampRate=sampRate, labelspacing=labelspacing ) return None
PT_MTR) = aux.selectPath(USR, LND, REL) PT_IMG = PT_IMG + 'preTraces/' monet.makeFolder(PT_IMG) # Setup the run --------------------------------------------------------------- tS = datetime.now() monet.printExperimentHead(PT_ROT, PT_IMG, tS, 'UCIMI PreTraces ' + AOI) ############################################################################### # Load preprocessed files lists ############################################################################### tyTag = ('sum', 'srp') (fltrPattern, globPattern) = ('dummy', PT_PRE + '*' + AOI + '*' + '{}' + '*') if FZ: fltrPattern = PT_PRE + '*_00_*' + AOI + '*' + '{}' + '*' fLists = monet.getFilteredTupledFiles(fltrPattern, globPattern, tyTag) ############################################################################### # Process files ############################################################################### (xpNum, digs) = monet.lenAndDigits(fLists) for i in range(0, xpNum): monet.printProgress(i + 1, xpNum, digs) (sumDta, repDta) = [pkl.load(file) for file in (fLists[i])] name = fLists[i][0].split('/')[-1].split('.')[0][:-4] monet.exportTracesPlot(repDta, name, STYLE, PT_IMG, vLines=[0, 0]) ############################################################################### # Export plot legend ############################################################################### if len(fLists) > 0: cl = [i[:-2] + 'cc' for i in CLR] monet.exportGeneLegend(sumDta['genotypes'], cl, PT_IMG + '/plt_{}.png'.format(AOI), 500)
fltrPattern = PT_PRE + '*_00_*' + AOI + '*' + '{}' + '*' fLists = monet.getFilteredTupledFiles(fltrPattern, globPattern, tyTag) ############################################################################### # Process files ############################################################################### (xpNum, digs) = monet.lenAndDigits(fLists) for i in range(0, xpNum): monet.printProgress(i + 1, xpNum, digs) (sumDta, repDta) = [pkl.load(file) for file in (fLists[i])] name = fLists[i][0].split('/')[-1].split('.')[0][:-4] # Traces ------------------------------------------------------------------ balPop = sum(sumDta['population'][tStable]) STYLE['yRange'] = (0, balPop / 2 + balPop * .2) if AOI == 'ECO': STYLE['yRange'] = (STYLE['yRange'][0], STYLE['yRange'][1] * 2) STYLE['aspect'] = monet.scaleAspect(1, STYLE) monet.exportTracesPlot(repDta, name, STYLE, PT_IMG, vLines=[0, 0], wopPrint=False, wop=i) ############################################################################### # Export plot legend ############################################################################### if len(fLists) > 0: cl = [i[:-2] + 'cc' for i in CLR] monet.exportGeneLegend(sumDta['genotypes'], cl, PT_IMG + '/plt_{}.png'.format(AOI), 500)
fLists = list( zip(*[ sorted(glob(PT_PRE + '*' + AOI + '*' + tp + '*')) for tp in tyTag ])) ########################################################################### # Process files ########################################################################### (xpNum, digs) = monet.lenAndDigits(fLists) msg = '* Analyzing ({}/{})' for i in range(0, xpNum): print(msg.format(str(i + 1).zfill(digs), str(xpNum).zfill(digs)), end='\r') (sumDta, repDta) = [pkl.load(file) for file in (fLists[i])] name = fLists[i][0].split('/')[-1].split('.')[0][:-4] # Export plots -------------------------------------------------------- monet.exportTracesPlot(repDta, name, STYLE, PT_IMG, append='TRA', wopPrint=False) cl = [i[:-2] + 'cc' for i in CLR] monet.exportGeneLegend(sumDta['genotypes'], cl, PT_IMG + '/plt_{}.png'.format(AOI), 500) tE = datetime.now() print('* Analyzed ({}/{}) '.format(xpNum, xpNum), end='\n') print(monet.PAD)
repFiles = monet.getFilteredFiles(fltrPattern, globPattern) # print(repFiles) ########################################################################### # Iterate through experiments ########################################################################### (fNum, digs) = monet.lenAndDigits(repFiles) fmtStr = '{}+ File: {}/{}' (i, repFile) = (0, repFiles[0]) for (i, repFile) in enumerate(repFiles): padi = str(i + 1).zfill(digs) print(fmtStr.format(monet.CBBL, padi, fNum, monet.CEND), end='\r') (repDta, xpid) = (pkl.load(repFile), aux.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[THS]) for row in xpRow[:3]] (mnf, mnd) = (float(xpRow[3]['min']), float(xpRow[3]['minx'])) # Traces ------------------------------------------------------------------ pop = repDta['landscapes'][0][tStable][-1] STYLE['yRange'] = (0, pop + pop * .2) STYLE['aspect'] = monet.scaleAspect(.15, STYLE) monet.exportTracesPlot( repDta, repFile.split('/')[-1][:-6] + str(QNT), STYLE, PT_IMG, vLines=[0, 0], # [tti, tto], wop=wop, wopPrint=False)