def plot_tauH_heatmap(fig, axs, cbaxes): # setup grid n0 = (-9, -1) mig = (-9, -1) n0Fine = np.logspace(*n0, 1000) migFine = np.logspace(*mig, 1000) n0Gr, migGr = np.meshgrid(n0Fine, migFine) # calc tau_Her tauHMat = mlsg.calc_tauHer_numeric(n0Gr, migGr) # plot Heatmap viridisBig = mpl.cm.get_cmap('coolwarm', 512) indexVec = np.hstack((np.linspace(0, 0.5, 100), np.linspace(0.5, 1 - 1E-12, 150))) cmap = mpl.colors.ListedColormap(viridisBig(indexVec)) colors = sns.color_palette("RdBu_r", 1024) idx = np.floor(indexVec * 1024).astype(int) cmap = [colors[i] for i in idx] cmap = colr.ListedColormap(cmap) currData = np.log10(tauHMat) axl = axs.imshow(currData, cmap=cmap, interpolation='nearest', extent=[*n0, *mig], origin='lower', vmin=-6, vmax=9) axs.set_xticks([-9, -6, -3, -1]) axs.set_yticks([-9, -6, -3, -1]) axs.set_xlabel('$\\log_{10} \\frac{n_0}{k}$') axs.set_ylabel('$\\log_{10} \\frac{\\theta}{\\beta}$') axs.set_aspect('equal') cbaxes.set_axis_off() cb = fig.colorbar(axl, ax=cbaxes, orientation='horizontal', label="$\\log_{10}\\tau_{her}$", ticks=[-6, -3, 0, 3, 6, 9], anchor=(0.5, 0), aspect=30, shrink=0.5) cb.ax.xaxis.set_ticks_position('top') cb.ax.xaxis.set_label_position('top')
def process_data(statData): # calculate heritability time tauHer = mlsg.calc_tauHer_numeric( statData['n0'], statData['mig']) tauVar = mlsg.calc_tauV(statData['cost']) tauHer_Rel = tauHer/statData['TAU_H'] tauVar_rel = tauVar/statData['TAU_H'] dataToStore = (tauHer, tauVar, tauHer_Rel, tauVar_rel) nameToStore = ('tauHer', 'tauVar', 'tauHer_rel', 'tauVar_rel') statData = rf.append_fields( statData, nameToStore, dataToStore, usemask=False) return statData
def process_data(statData): # calculate heritability time tauHer = mlsg.calc_tauHer_numeric( statData['n0'], statData['mig']) tauVar = mlsg.calc_tauV(statData['cost']) tauHerRel = tauHer/statData['TAU_H'] tauVar_rel = tauVar/statData['TAU_H'] sigma_cat = mlsg.make_categorial(statData['sigmaBirth']) BH_cat = mlsg.make_categorial(statData['B_H']) dataToStore = (tauHer, tauVar, tauHerRel, tauVar_rel, sigma_cat, BH_cat) nameToStore = ('tauHer', 'tauVar', 'tauHer_rel', 'tauVar_rel', 'sigma_cat', 'BH_cat') statData = rf.append_fields( statData, nameToStore, dataToStore, usemask=False) return statData