Exemplo n.º 1
0
###############################################################################
print(aux.CBBL, end='\r')
print('* Populating aggregations list', end='\r')
clusters = monet.populateClustersFromList(clstList, expPath, patchFilePattern)
aggList = monet.aggregateClusters(clusters, aggDict)
# Fixes the sorting of coordinates (add this to the package) ##################
coordinates = ([x for _, x in sorted(zip(clstList, coordinates[0]))],
               [x for _, x in sorted(zip(clstList, coordinates[1]))])
# #############################################################################
ticks = aggList[0].shape[0]
fun.generateClusterGraphs(originalCoordFile,
                          aggList,
                          coordinates,
                          imgLocation,
                          colors,
                          original_corners,
                          PAD,
                          DPI,
                          skip=False,
                          countries=False,
                          refPopSize=2)
print('* Finished exporting frames ({}/{})'.format(ticks, ticks))
print(aux.CEND, end='\r')
###############################################################################
# Generate video
###############################################################################
console = [
    'ffmpeg', '-y', '-r', '30', '-f', 'image2', '-s', '4096x2160', '-i',
    '{}c_%06d.png'.format(imgLocation), '-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2',
    '-vcodec', 'libx264', '-crf', '25', '-pix_fmt', 'yuv420p', videoLocation
]
Exemplo n.º 2
0
pthImg = pthOut + 'img/'
###############################################################################
# Setting up colors and style
###############################################################################
COLORS = [
        "#090446A0", "#f20060A0", "#c6d8ffA0",
        "#7692ffA0", "#29339bA0", "#7fff3aA0"
    ]
STYLE = {
        "width": 1, "alpha": .15, "dpi": 2 * 300,
        "legend": False, "aspect": .5, "colors": COLORS,
        "xRange": [0, 1825], "yRange": [-1, +1]
    }
STYLE['aspect'] = monet.scaleAspect(.2, STYLE)
tS = datetime.datetime.now()
fun.printExpTerminal(tS, PATH, pthImg, pthOut)
###############################################################################
# Main Routine
###############################################################################
# Loading the signal files ----------------------------------------------------
pth = PATH + 'pre/' + SIG + '/'
sigFiles = fun.getPreProcessedExperiments(pth, 'sum')
# Loading the paths for the probes --------------------------------------------
for j in range(0, len(PRB)):
    strInt = str(j+1).zfill(len(str(len(PRB))))
    print('* Analyzing ({}/{})       '.format(strInt, str(len(PRB))), end='\r')
    prbExpPths = PATH + 'pre/' + PRB[j] + '/'
    prbFiles = fun.getPreProcessedExperiments(prbExpPths, 'sum')
    oPth = pthOut + PRB[j] + '/'
    iPth = oPth + '/img/'
    monet.makeFolder(oPth)
Exemplo n.º 3
0
mH = Basemap(
    projection='merc',
    llcrnrlat=minLat, urcrnrlat=maxLat,
    llcrnrlon=minLong, urcrnrlon=maxLong,
    lat_ts=20, resolution='h', ax=ax
)
mH.drawcoastlines(color=colors[0], linewidth=2, zorder=1)
mH.drawcoastlines(color=colors[1], linewidth=.25, zorder=2)
mL = Basemap(
    projection='merc',
    llcrnrlat=minLat, urcrnrlat=maxLat,
    llcrnrlon=minLong, urcrnrlon=maxLong,
    lat_ts=20, resolution='i', ax=ax
)
mL.drawcoastlines(color=colors[2], linewidth=10, zorder=0)
ax.tick_params(
    axis='both', which='both',
    bottom=True, top=False, left=True, right=False,
    labelbottom=True, labelleft=True
)
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.spines["left"].set_visible(False)
mH.scatter(
    list(pts['Longitude']), list(pts['Latitude']), latlon=True,
    alpha=.2, marker='.', s=[10 * math.log(20) for i in list(pts['Longitude'])],
    color='#E048B8', zorder=3
)
fun.quickSaveFig(PT_DTA + 'test.png', fig, dpi=750)
Exemplo n.º 4
0
# Select form server/desktop
if USR == 'srv':
    PTH_ROOT = '/RAID5/marshallShare/SplitDrive_Yorkeys/batchProof/'
else:
    PTH_ROOT = '/media/chipdelmal/cache/Sims/SplitDrive_Yorkeys/geoProof/'
# Setup paths and create folders
(PTH_IMG, PTH_DTA, PTH_PRE) = (
        '{}img/{}/'.format(PTH_ROOT, SET),
        '{}{}/'.format(PTH_ROOT, SET),
        '{}pre/{}/'.format(PTH_ROOT, SET),

    )
monet.makeFolders([PTH_IMG, PTH_PRE])
# Print terminal info and create folder
tS = datetime.datetime.now()
fun.printExpTerminal(tS, PTH_DTA, PTH_IMG, PTH_PRE)
###############################################################################
# Setting up paths and directories
###############################################################################
(expDirsMean, expDirsTrac) = fun.getExpPaths(PTH_DTA)
(expNum, nodeDigits) = (len(expDirsMean), 6)
outNames = fun.splitExpNames(PTH_PRE)
expsDone = set(outNames)
###############################################################################
# Analyze data
###############################################################################
Parallel(n_jobs=JOB)(
        delayed(monet.preProcess)(
                exIx, expNum, expDirsMean, expDirsTrac, DRV,
                analysisOI='GEN', prePath=PTH_PRE, nodesAggLst=NOI,
                outExpNames=expsDone, fNameFmt='{}/{}-{}_', OVW=True,
Exemplo n.º 5
0
    "xRange": [0, 1825],
    "yRange": [0, 150000]
}
STYLE['aspect'] = monet.scaleAspect(.2, STYLE)
tSrt = datetime.now()
aux.printExperimentHead(PATH, pathImg, pathPre, str(tSrt), 'Plotting ')
###############################################################################
# List preprocessed files lists
###############################################################################
typTag = ('sum', 'spa', 'rep')  # 'srp')
# typTag = ('sum', 'rep')
fLists = list(zip(*[sorted(glob(pathPre + '*' + tp + EXT)) for tp in typTag]))
###############################################################################
# Load preprocessed files lists
###############################################################################
(xpNum, digs) = fun.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, spaDta, repDta, srpDta) = [pkl.load(file) for file in (fLists[i])]
    # (sumDta, repDta) = [pkl.load(file) for file in (fLists[i])]
    name = fLists[i][0].split('/')[-1].split('.')[-2][:-4]
    # Process data ------------------------------------------------------------
    spaDtaNorm = monet.rescaleGeneSpatiotemporals(spaDta)
    overlay = monet.plotGenotypeOverlayFromLandscape(
        spaDtaNorm,
        vmax=1,
        style={
            "aspect": 50 * STYLE['aspect'],
            "cmap": CMAPS
        },
Exemplo n.º 6
0
STYLE = {
    "width": .1,
    "alpha": .15,
    "dpi": 2 * 300,
    "legend": True,
    "aspect": .5,
    "colors": COLORS,
    "xRange": [0, 1825],
    "yRange": [0, 150000]
}
STYLE['aspect'] = monet.scaleAspect(.2, STYLE)
GDICT = monet.autoGenerateGenotypesDictionary(aux.GENES, aux.GENOTYPES)
###############################################################################
# Get paths and create output folders
###############################################################################
sig = fun.getValidationExperiments(PATH, SET)
(PATH_ERR, PATH_IMG, PATH_PRE) = (PATH + 'err/', PATH + 'img/', PATH + 'pre/')
monet.makeFolders([PATH_ERR, PATH_IMG, PATH_PRE])
###############################################################################
# Print terminal message
###############################################################################
tSrt = datetime.datetime.now()
aux.printExperimentHead(PATH, PATH_IMG, PATH_ERR, str(tSrt), 'Gene Dynamics ')
###############################################################################
# Main analyses
###############################################################################
xpNumb = len(sig)
for i in range(0, xpNumb):
    # Load data ---------------------------------------------------------------
    aux.printProggress(i, xpNumb, sig)
    expSet = sig[i]
Exemplo n.º 7
0
    "legend": False,
    "aspect": .5,
    "colors": COLORS,
    "xRange": [0, 1825],
    "yRange": [-1, +1]
}
STYLE['aspect'] = monet.scaleAspect(.2, STYLE)
PATH = '/{}/marshallShare/SplitDrive_Yorkeys/geoProof/err/'.format(VOL)
# PATH = '/home/chipdelmal/shared/SDY/err/'
GDICT = monet.autoGenerateGenotypesDictionary(aux.GENES, aux.GENOTYPES)
###############################################################################
# Get paths and create output folders
###############################################################################
# I/O paths
(filePaths, PATH_IMG) = (glob.glob(PATH + '*.csv'), PATH + 'img/')
fun.createFolders([PATH_IMG])
# ###############################################################################
# # Print terminal message
# ###############################################################################
tSrt = datetime.datetime.now()
aux.printExperimentHead(PATH, PATH_IMG, PATH, str(tSrt), 'GeoValidation ')
# ###############################################################################
# # Main analyses
# ###############################################################################
for (i, file) in enumerate(filePaths):
    # Print Progress
    print(aux.CBBL, end='\r')
    (curr, total) = (str(i + 1).zfill(3), str(len(filePaths)).zfill(3))
    print('Working on: {}/{}'.format(curr, total), end='\r')
    # Plot
    name = file.split('/')[-1].split('.')[0]
Exemplo n.º 8
0
                                  BLAT,
                                  BLNG,
                                  ptColor='#6347ff')
    # Pops --------------------------------------------------------------------
    (fig, ax, mapR) = plo.plotGenePopsOnMap(fig,
                                            ax,
                                            mapR,
                                            lngs,
                                            lats,
                                            DRV_COL,
                                            GC_FRA,
                                            time,
                                            alphaScaler=.5,
                                            marker=(6, 0),
                                            offset=150,
                                            amplitude=200,
                                            lw=4,
                                            ec=(1, 1, 1, .75))
    ax.text(0.5,
            0.5,
            str(time).zfill(4),
            horizontalalignment='center',
            verticalalignment='center',
            transform=ax.transAxes,
            fontsize=30)
    fun.quickSaveFig('{}/{}.png'.format(EXP_VID,
                                        str(time).zfill(4)),
                     fig,
                     dpi=500)
    plt.close('all')
Exemplo n.º 9
0
    "dpi": 2 * 300,
    "legend": True,
    "aspect": .5,
    "colors": COLORS,
    "xRange": [0, 1825],
    "yRange": [0, 150000]
}
STYLE['aspect'] = monet.scaleAspect(.2, STYLE)
PATH = '/{}/marshallShare/SplitDrive_Yorkeys/geoProof/'.format(VOL)
# PATH = '/home/chipdelmal/Desktop/SD/'
GDICT = monet.autoGenerateGenotypesDictionary(aux.GENES, aux.GENOTYPES)
###############################################################################
# Get paths and create output folders
###############################################################################
# Input paths
(sig, prb) = (fun.getValidationExperiments(PATH, SETS[0]),
              fun.getValidationExperiments(PATH, SETS[1]))
# Shallow validation
(xpTest, xpNumb) = (len(sig) == len(prb), len(sig))
(PATH_ERR, PATH_IMG) = (PATH + 'err/', PATH + 'img/')
fun.createFolders([PATH_ERR, PATH_IMG])
###############################################################################
# Print terminal message
###############################################################################
tSrt = datetime.datetime.now()
aux.printExperimentHead(PATH, PATH_IMG, PATH_ERR, str(tSrt), 'GeoValidation ')
if xpTest is False:
    print(aux.CRED + 'ERROR: Missmatch in number of experiments!' + aux.CEND)
    sys.exit()
###############################################################################
# Main analyses