if (AOI == 'HLT') or (AOI == 'CST'):
    MF = (False, True)
else:
    MF = (True, True)
###############################################################################
# Setting up paths and style
###############################################################################
exp = '100'
for exp in EXP:
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT,
     PT_MTR) = aux.selectPath(USR, DRV, exp)
    drive = drv.driveSelector(DRV, AOI)
    DVP = drive.get('gDict')
    # Time and head -----------------------------------------------------------
    tS = datetime.now()
    aux.printExperimentHead(PT_DTA, PT_IMG, PT_PRE, tS, 'PreTraces ' + AOI)
    ###########################################################################
    # Load folders
    ###########################################################################
    (expDirsMean, expDirsTrac) = fun.getExpPaths(PT_DTA)
    (expNum, nodeDigits) = (len(expDirsMean), len(str(len(NOI))) + 1)
    outNames = fun.splitExpNames(PT_OUT)
    outExpNames = set(outNames)
    ###########################################################################
    # Analyze data
    ###########################################################################
    Parallel(n_jobs=JOB)(delayed(monet.preProcess)(exIx,
                                                   expNum,
                                                   expDirsMean,
                                                   expDirsTrac,
                                                   DVP,
Exemple #2
0
(USR, DRV, AOI) = ('srv', 'tGD', 'HLT')
# (USR, DRV, AOI) = (sys.argv[1], sys.argv[2], sys.argv[3])
(OVW, gIx, hIx) = (True, 1, 0)
if (USR == 'srv2') or (USR == 'dsk2'):
    EXPS = ('000', )
else:
    EXPS = ('100', )

for EXP in EXPS:
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT,
     PT_MTR) = aux.selectPath(USR, DRV, EXP)
    uids = fun.getExperimentsIDSets(PT_PRE, skip=-1)
    (hnf, cac, frc, hrt, ren, res, typ, grp) = uids[1:]
    tS = datetime.now()
    aux.printExperimentHead(PT_ROT, PT_IMG, PT_OUT, tS, 'PstFraction')
    # #########################################################################
    # Base experiments
    #   These are the experiments without any releases (for fractions)
    # #########################################################################
    basePat = aux.XP_NPAT.format('*', '*', '*', '*', '00', '*', AOI, '*',
                                 'sum', 'bz')
    baseFiles = sorted(glob(PT_PRE + basePat))
    # #########################################################################
    # Probe experiments
    #   sum: Analyzed data aggregated into one node
    #   srp: Garbage data aggregated into one node
    # #########################################################################
    msg = '* Analyzing ({}/{})'
    (xpNum, digs) = monet.lenAndDigits(ren)
    for (i, rnIt) in enumerate(ren):
Exemple #3
0
 # -------------------------------------------------------------------------
 (scalers, HD_DEP, _, cmapR) = aux.selectDepVars(moi, THR, AOI)
 cmap = cmapR    # cmapR.reversed()
 # if AOI == 'WLD':
     # cmap = cmapR.reversed()
 ###########################################################################
 # Loop through the experiments
 ###########################################################################
 for exp in EXPS:
     (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT, PT_MTR) = aux.selectPath(USR, DRV, exp)
     PT_IMG = PT_IMG + 'heat/'
     monet.makeFolder(PT_IMG)
     PT_IMG = PT_IMG+'-'.join(HD_IND)+'/'
     monet.makeFolder(PT_IMG)
     tS = datetime.now()
     aux.printExperimentHead(PT_ROT, PT_IMG, PT_MTR, tS, 'Heatmap '+AOI)
     #######################################################################
     # Analyzes
     #######################################################################
     # Load files into dataframe
     fPtrn = '{}{}_{}_{}_qnt.csv'.format(PT_MTR, AOI, moi, QNT)
     (df, header, headerInd) = aux.loadDFFromSummary(fPtrn)
     # Filter the dataframe ------------------------------------------------
     # Get the unique values for each indep-var column of the dataframe
     uniqueValues = {i: list(df[i].unique()) for i in headerInd}
     idTuplesAll = list(product(*uniqueValues.values()))
     # Filtering all the experiments of the non-free columns
     hdFree = [col for col in headerInd if col not in HD_IND]
     # print(hdFree)
     # Get the unique IDs of the experiments
     uniqueIds = [uniqueValues.get(head) for head in hdFree]
Exemple #4
0
if (USR == 'srv2') or (USR == 'dsk'):
    EXPS = ('000', )
    NOI = [[0]]
else:
    EXPS = ('050', '100', '400', '800')
    NOI = [[0], [1]]
for EXP in EXPS:
    # #############################################################################
    # Setup paths and drive
    # #############################################################################
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT,
     PT_MTR) = aux.selectPath(USR, DRV, EXP)
    (PT_IMG_I, PT_IMG_O) = (PT_IMG + 'pstTraces/', PT_IMG + 'stacksAOI/')
    monet.makeFolder(PT_IMG_O)
    tS = datetime.now()
    aux.printExperimentHead(PT_ROT, PT_IMG_I, PT_IMG_O, tS,
                            'AOI VConcat ' + QNT)
    # Get files -------------------------------------------------------------------
    imgLists = [glob('{}*{}*{}*'.format(PT_IMG_I, i, QNT)) for i in AOI]
    imgTuples = list(zip(*[sorted(i) for i in imgLists]))
    # #############################################################################
    # Iterate through images
    # #############################################################################
    fmt = 'Processing {}/' + str(len(imgTuples))
    for (i, tp) in enumerate(imgTuples):
        print(fmt.format(str(i + 1).zfill(3)), end='\r')
        fName = tp[0].split('/')[-1][:-4].replace('-HLT_', '-')
        imgArray = [cv2.imread(i) for i in tp]
        vertical = cv2.hconcat(imgArray)
        # show the output image
        cv2.imwrite(PT_IMG_O + fName + '.png', vertical)
Exemple #5
0
 monet.makeFolder(PT_IMG)
 drive = drv.driveSelector(DRV, AOI)
 (CLR, YRAN) = (drive.get('colors'), (0, drive.get('yRange')))
 STYLE = {
     "width": .25,
     "alpha": .15,
     "dpi": 500,
     "legend": True,
     "aspect": .25,
     "colors": CLR,
     "xRange": [0, (365 * 5) / 3],
     "yRange": YRAN
 }
 STYLE['aspect'] = monet.scaleAspect(1, STYLE)
 tS = datetime.now()
 aux.printExperimentHead(PT_ROT, PT_IMG, PT_PRE, tS, 'PstTraces')
 ###########################################################################
 # Load postprocessed files
 ###########################################################################
 pstPat = PT_MTR + AOI + '_{}_' + QNT + '_qnt.csv'
 pstFiles = [pstPat.format(i) for i in ('TTI', 'TTO', 'WOP', 'MNX', 'RAP')]
 (dfTTI, dfTTO, dfWOP, dfMNX, _) = [pd.read_csv(i) for i in pstFiles]
 ###########################################################################
 # Load preprocessed files lists
 ###########################################################################
 repFiles = glob(PT_PRE + '*' + AOI + '*' + 'srp' + '*')
 if FZ:
     fLists = fun.getFilteredFiles(PT_PRE + '*_00_*' + AOI + '*srp.bz',
                                   PT_PRE + '*' + AOI + '*' + '*srp.bz')
 else:
     fLists = glob(PT_PRE + '*' + AOI + '*' + '*srp.bz')
Exemple #6
0
from datetime import datetime
import MoNeT_MGDrivE as monet

# (USR, DRV, AOI) = ('dsk', 'tGD', 'HLT')
(USR, DRV, AOI) = (sys.argv[1], sys.argv[2], sys.argv[3])
QNT = ['50', '75', '90']
EXP = '000'
# #############################################################################
# Setup paths and drive
# #############################################################################
(PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT,
 PT_MTR) = aux.selectPath(USR, DRV, EXP)
(PT_IMG_I, PT_IMG_O) = (PT_IMG + 'pstTraces/', PT_IMG + 'stacksQNT/')
monet.makeFolder(PT_IMG_O)
tS = datetime.now()
aux.printExperimentHead(PT_ROT, PT_IMG_I, PT_IMG_O, tS, 'QNT VConcat ' + AOI)
# Get files -------------------------------------------------------------------
imgLists = [glob('{}*{}*{}*'.format(PT_IMG_I, AOI, i)) for i in QNT]
imgTuples = list(zip(*[sorted(i) for i in imgLists]))
# #############################################################################
# Iterate through images
# #############################################################################
fmt = 'Processing {}/' + str(len(imgTuples))
for (i, tp) in enumerate(imgTuples):
    print(fmt.format(str(i + 1).zfill(3)), end='\r')
    fName = tp[0].split('/')[-1][:-7]
    imgArray = [cv2.imread(i) for i in tp]
    vertical = cv2.vconcat(imgArray)
    # show the output image
    cv2.imwrite(PT_IMG_O + fName + '.png', vertical)
        [-.05, 0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1.05],
        'linear', 'linear', 'linear'
    )
(exp, moi, mtr) = ('000', 'WOP', '0.1')
(scalers, HD_DEP, _, cmapR) = aux.selectDepVars(moi, float(mtr), AOI)
cmap = cmapR.reversed()
###########################################################################
# Loop through the experiments
###########################################################################
(PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT, PT_MTR) = aux.selectPath(USR, DRV, exp)
PT_IMG = PT_IMG + 'violin/'
monet.makeFolder(PT_IMG)
PT_IMG = PT_IMG+'-'.join(HD_IND)+'/'
monet.makeFolder(PT_IMG)
tS = datetime.now()
aux.printExperimentHead(PT_ROT, PT_IMG, PT_MTR, tS, 'Violin '+AOI)
#######################################################################
# Analyzes
#######################################################################
# Load files into dataframe
fPtrn = '{}{}_{}_{}_qnt.csv'.format(PT_MTR, AOI, moi, QNT)
(df, header, headerInd) = aux.loadDFFromSummary(fPtrn)
# (fig, ax) = plt.subplots()
# ax = sns.violinplot(
#     x=mtr, y='i_ren', data=df, palette="muted", cut=0, split=False, orient='h',
#     ax=ax
# )
(fig, ax) = plt.subplots()
HNF = list(set(df['i_hnf']))
colors = plt.cm.RdPu(np.linspace(0, 1, 100))
for (i, hnf) in enumerate(HNF):
Exemple #8
0
exp = EXP[0]
for exp in EXP:
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT, PT_MTR) = aux.selectPath(USR, DRV, exp)
    PT_IMG_I = PT_IMG + 'preTraces/'
    PT_IMG_O = PT_IMG + 'preOverlay/'
    monet.makeFolder(PT_IMG_O)
    drive = drv.driveSelector(DRV, AOI)
    (CLR, YRAN) = (drive.get('colors'), (0, drive.get('yRange')))
    STYLE = {
            "width": .25, "alpha": .75, "dpi": 200, "legend": True,
            "aspect": .25, "colors": CLR, "xRange": [0, (365*5)/3],
            "yRange": (0, YRAN[1]*1.5)
        }
    STYLE['aspect'] = monet.scaleAspect(1, STYLE)
    tS = datetime.now()
    aux.printExperimentHead(PT_ROT, PT_IMG, PT_PRE, tS, 'PreOverlays '+AOI)
    ###########################################################################
    # Load preprocessed files lists
    ###########################################################################
    fLists = list(zip(
        *[sorted(glob(PT_IMG_I+'*'+'*'+tp+'*')) for tp in typs]
    ))
    ###########################################################################
    # Iterate file lists
    ###########################################################################
    for fs in fLists:
        imgs = [Image.open(i).convert('RGBA') for i in fs]
        (w, h) = imgs[0].size
        bkg = Image.new('RGBA', (w, h), (255, 255, 255, 255))
        for i in imgs:
            bkg.paste(i, (0, 0), i)
Exemple #9
0
    ax.imshow(repsRatios, cmap=cmap)
    # add TTI-------------------------------------------------------------
    [plt.axvline(i, color='black', alpha=.65, lw=0.175, ls='-.') for i in tti]
    # add TTO-------------------------------------------------------------
    [plt.axvline(j, color='black', alpha=.75, lw=0.2, ls='dotted') for j in tto]
    # Save the figure------------------------------------------------------
    outName = fName.split('/')[-1].split('.')[0][:-4]
    plt.xlim(X_RAN)
    ax.axes.xaxis.set_ticklabels([])
    ax.axes.yaxis.set_ticklabels([])
    ax.axes.xaxis.set_visible(False)
    ax.axes.yaxis.set_visible(False)
    ax.xaxis.set_tick_params(size=0)
    ax.yaxis.set_tick_params(size=0)
    plt.savefig(PT_IMG+outName + '.png', bbox_inches='tight', pad_inches=0.01, dpi=500)
    plt.close("all")

for exp in EXPS:
    # Select path ------------------------------------------------------------
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT, PT_MTR) = aux.selectPath(USR, DRV, exp)
    PT_IMG = PT_IMG+'xRay/'
    monet.makeFolder(PT_IMG)
    tS = datetime.now()
    aux.printExperimentHead(PT_ROT, PT_IMG, PT_MTR, tS, 'X-Ray '+AOI)
    # Load file --------------------------------------------------------------
    fNames = glob(PT_OUT+'*{}*.npy'.format(AOI))
    xpNumS = str(len(fNames)).zfill(4)
    (xpNum, digs) = monet.lenAndDigits(fNames)

    Parallel(n_jobs=1)(delayed(parallelPlotter)(i, xpNum, digs, fName, PT_IMG) for (i, fName) in enumerate(fNames))
Exemple #10
0
else:
    EXPS = ('050', '100', '400', '800')
    NOI = [[0], [1]]
header = ['i_hnf', 'i_cac', 'i_frc', 'i_hrt', 'i_ren', 'i_res', 'i_grp']
outLabels = ('TTI', 'TTO', 'WOP', 'RAP', 'MNX')
###############################################################################
# Iterate through experiments
###############################################################################
xpDict = {}
smryDicts = ({}, {}, {}, {}, {})
expNum = len(EXPS)
for (j, EXP) in enumerate(EXPS):
    tS = datetime.now()
    (PT_ROT, PT_IMG, PT_DTA, PT_PRE, PT_OUT,
     PT_MTR) = aux.selectPath(USR, DRV, EXP)
    aux.printExperimentHead(PT_ROT, PT_IMG, PT_OUT, tS, 'PostProcess ' + AOI)
    print('{}* [{}/{}] {}{}'.format(monet.CWHT,
                                    str(j + 1).zfill(3),
                                    str(expNum).zfill(3), EXP, monet.CEND))
    # Output dataframes paths -------------------------------------------------
    pth = PT_MTR + AOI + '_{}_' + QNT + '_qnt.csv'
    DFOPths = [pth.format(z) for z in outLabels]
    # Get experiment IDs ------------------------------------------------------
    # print(PT_OUT)
    uids = fun.getExperimentsIDSets(PT_OUT, skip=-1)
    (hnf, cac, frc, hrt, ren, res, typ, grp) = uids[1:]
    # Parse filepaths ---------------------------------------------------------
    ptrn = aux.XP_NPAT.format('*', '*', '*', '*', '*', '*', AOI, '*', 'rto',
                              'npy')
    fPaths = sorted(glob(PT_OUT + ptrn))
    # Create empty dataframes to store the data -------------------------------