コード例 #1
0
def samplepH_onlyone(size, one, Temp=298, pHrange=[7,12], salttype='nom',
  uniquefix=None, fn_preamble=''):
    """
    Get power supplies from a sample with fixed T at Temp and a flat
    distribution across pHrange, for salt level salttype.
    This specifically only samples across one other variable, named by
    the attribute one.
    """
    if one=='all':
        return samplepH(size, Temp=Temp, pHrange=pHrange, salttype=salttype)

    cd_preamble = 'E21data/pH_samples/ind_variance/'
    thissamplename = cd_preamble+fn_preamble+one+'_pH_'+str(size)+'_'+str(Temp)+'_'+salttype+'.npy'

    try:
        xvals, PS = np.load(thissamplename, allow_pickle=True)
        return xvals, PS
    except:
        fixed = {}
        if uniquefix == None:
            fixed = deepcopy(EG.default_nomdict)
        else:
            fixed=uniquefix
        fixed['T'] = Temp
        fixed['pH'] = None
        fixed[one] = None
        sigmas = EG.getsigmas(size, fixed=fixed, pHlims=pHrange, dummyvals=True)
        PS, xvals = np.empty(size), np.empty(size)

        for i, s in enumerate(sigmas):
            PS[i] = EG.getPSfromSigmas(s, dummyvals=True, salttype=salttype)
            xvals[i] = s[-1]

        np.save(thissamplename, np.array([xvals, PS]))
        return xvals, PS
コード例 #2
0
def samplepH(size, Temp=298, pHrange=[7,12], salttype='nom',
  fixupdate={}, fn_preamble=''):
    """
    Get power supplies from a sample with fixed T at Temp and a flat
    distribution across pHrange, for salt level salttype.
    If you want to update the fix dictionary (e.g. to only sample select
    parameters), send them via fixupdate.
    """

    f = {'T':Temp, 'pH':None}
    f.update(fixupdate)

    cd_preamble = 'E21data/pH_samples/'
    thissamplename = cd_preamble+fn_preamble+'pH_'+str(size)+'_'+str(Temp)+'_'+salttype+'.npy'

    try:
        xvals, PS = np.load(thissamplename, allow_pickle=True)
        return xvals, PS
    except:
        sigmas = EG.getsigmas(size, fixed=f, pHlims=pHrange, dummyvals=True)
        PS, xvals = np.empty(size), np.empty(size)

        for i, s in enumerate(sigmas):
            PS[i] = EG.getPSfromSigmas(s, dummyvals=True, salttype=salttype)
            xvals[i] = s[-1]

        np.save(thissamplename, np.array([xvals, PS]))
        return xvals, PS
コード例 #3
0
def ATPEnergyContourPlot(ax,
                         CO2origin='pH',
                         pHrange=np.linspace(7, 14, num=11),
                         Trange=np.linspace(273, 473, num=11)):

    plotkey = 'ATPGibbs'

    Meshes = EnceladusGrids.getMesh(Trange, pHrange, params=[plotkey])

    XX = Meshes['pH']
    YY = Meshes['T']
    ZZ = Meshes[plotkey]

    contf = ax.contourf(XX,
                        YY,
                        ZZ[0],
                        levels=np.arange(55000, 68000, 1000),
                        cmap='cool_r',
                        vmin=55000,
                        vmax=68000)

    cont = ax.contour(XX,
                      YY,
                      ZZ[0],
                      levels=5,
                      colors=['k'],
                      vmin=55000,
                      vmax=68000)
    ax.clabel(cont, inline=1, fontsize=12, fmt='%d')  # add label

    return ax, contf
コード例 #4
0
def plot_sigmas(sample):
    """
    Plot and show the distribution given by a sample size of `sample'.
    """
    sig = EG.getsigmas(sample, fixed={'T':330, 'pH':8.5}, dummyvals=True)

    a, b, c, d, e, f = [],[],[],[], [],[]

    for i in sig:
        a.append(i[0])
        b.append(i[1])
        c.append(i[2])
        d.append(i[3])
        e.append(i[4])
        f.append(i[5])


    fig, axs = plt.subplots(nrows=3, ncols=2)

    axs = axs.flatten()

    axs[0].scatter(a,b, alpha=0.2, marker='.')
    axs[1].scatter(a,c, alpha=0.2, marker='.')
    axs[2].scatter(a, d, alpha=0.2, marker='.')
    axs[3].scatter(a, e, alpha=0.2, marker='.')
    axs[4].scatter(a, f, alpha=0.2, marker='.')
    axs[5].scatter(e, f, alpha=0.2, marker='.')

    plt.show()
コード例 #5
0
def nominal_pH(Temp, pHlims=[7,12], num=100, salttype='nom', zeroed=False,
  fixupdate={}, fn_preamble=''):
    """
    Get power supplies from the nominal case with fixed T at Temp and a uniform distribution across pHrange of length num, for salt level salttype.
    You can change the nominal parameter space values by passing them in
    fixupdate. Pass zeroed as True if you want the Power supplies that NutMEG
    couldn't calculate removed, otherwise ther will be 1e-50 W/cell.
    """

    cd_preamble = 'E21data/nominalPS/'
    thisnominalname = cd_preamble+fn_preamble+'T_'+str(Temp)+'_pHs_'+str(pHlims[0])+'_'+str(pHlims[1])+'_'+salttype+'.npy'

    try:
        xvals, PS = np.load(thisnominalname, allow_pickle=True)
        if zeroed:
            zeroes = (np.log10(PS) != -50.)
            PS = np.log10(PS)[zeroes]
            xvals = xvals[zeroes]
        return xvals, PS
    except:
        pHnoms = np.linspace(pHlims[0],pHlims[1],num=num)
        fix=deepcopy(EG.default_nomdict)
        fix.update(fixupdate)
        PSnoms=[]
        for pHnom in pHnoms:
            PSnoms.append(EG.getPSfromSigmas(
              [fix['CO2'],fix['H2'],fix['CH4'],fix['nATP'],fix['k_corr'],
              Temp,pHnom],
              dummyvals=True, salttype=salttype))
        np.save(thisnominalname, np.array([pHnoms, PSnoms]))
        if zeroed:
            zeroes = (np.log10(PSnoms) != -50.)
            PSnoms = np.log10(PSnoms)[zeroes]
            pHnoms = pHnoms[zeroes]
        return pHnoms, PSnoms
コード例 #6
0
def uniform_samplepH(size, Temp=298, pHrange=[8,12], pHnum=50, k_corr=0.0):
    thissamplename = '2_uniform_data_samples/pH_'+str(size)+'_'+str(Temp)+'.npy'
    try:
        xvals, PS = np.load(thissamplename, allow_pickle=True)
        return xvals, PS
    except:
        PS, xvals = np.empty(size), np.empty(size)
        ix=0
        for pH in np.linspace(8,12, num=pHnum):
            sigmas = EG.getsigmas(int(size/pHnum), fixed={'T':Temp, 'pH':pH}, pHlims=pHrange, dummyvals=True)

            for s in sigmas:
                PS[ix] = EG.getPSfromSigmas(s, dummyvals=True)
                xvals[ix] = s[-1]
                ix += 1

        np.save(thissamplename, np.array([xvals, PS]))
        return xvals, PS
コード例 #7
0
def total_varianceplot(Ts = [300]):

    samplesize=2500
    pHnum=100
    fig, ax = plt.subplots(figsize=(10,5), ncols=2, nrows=1)

    # cmaps=[transparent_cmap(238/360), transparent_cmap(120/360), 'Reds']
    cmaps=[transparent_cmap2(blue_to_a), transparent_cmap2(green_to_a), transparent_cmap2(red_to_a)]
    colors = ['blue', 'green','red']

    Tresults = []
    pHresults = []
    minpH, maxpH = 7,12
    pHnoms = np.linspace(minpH,maxpH,num=int(pHnum))
    Tnoms = np.linspace(273, 400, num=int(pHnum))


    for i, T in enumerate(Ts):
        pHvals, PS = samplepH(samplesize, Temp=T, pHrange=[7,12])#, pHnum=pHnum) #random sample
        PSnoms=[]
        for pHnom in pHnoms:
            PSnoms.append(EG.getPSfromSigmas([0,0,0,1,0,T,pHnom], dummyvals=True))

        logPSnoms = np.log10(PSnoms)
        zeroes = (np.log10(PS) != -50.)
        logy = np.log10(PS)[zeroes]
        y = PS[zeroes]
        x = pHvals[zeroes]
        logvariance = np.empty(len(logy))
        variance = np.empty(len(y))
        ic = 0
        for xi, yi, logyi in zip(x, y, logy):
            close_nom = int((xi-minpH) / (maxpH-minpH) * pHnum)
            logvariance[ic] = logyi - logPSnoms[close_nom]
            variance[ic] = yi - PSnoms[close_nom]

            ic+=1

            # ax[0].hexbin(x, y, gridsize=(int(pHnum/2), int(pHnum/8)), cmap=cmaps[i])
    ax[0].hist2d(x,logvariance, bins=[45,45], range=[[8, 12], [-5, 5]], cmap=cmaps[i], edgecolor=None, label='T = 300 K')
    ax[0].set_ylabel('log10( variance in power supply [W/cell])')
    ax[1].hist2d(x,variance, bins=[45,45], range=[[8, 12], [-1e-15,1e-15]], cmap=cmaps[i], edgecolor=None, label='T = 300 K')
    ax[1].set_ylabel('Variance in power supply [Wcell]')

    ax[0].legend(bbox_to_anchor=(0., 1.05, 1.0, .102), loc='center',
           ncol=3, mode="expand", borderaxespad=0., fontsize=12)
    ax[1].legend(bbox_to_anchor=(0., 1.05, 1.0, .102), loc='center',
           ncol=3, mode="expand", borderaxespad=0., fontsize=12)
    plt.tight_layout()
    plt.savefig('totvariance_logvslin.pdf')
コード例 #8
0
def PSContourPlot(ax,
                  CO2origin='pH',
                  pHrange=np.linspace(7, 14, num=11),
                  Trange=np.linspace(273, 473, num=21),
                  cmap='PuBu',
                  maincont=0,
                  mesh=False,
                  k_corr=0.0,
                  nATP=1.0):

    plotkey = 'PowerSupply'

    Meshes = EnceladusGrids.getMesh(Trange,
                                    pHrange,
                                    params=[plotkey],
                                    CO2origin=CO2origin,
                                    k_corr=k_corr,
                                    nATP=nATP)

    XX = Meshes['pH']
    YY = Meshes['T']
    ZZ = Meshes[plotkey]

    contourlevels = [-25, -15, -10, -5]

    cmap = plt.cm.get_cmap(cmap, 15)

    if mesh:
        contf = ax.pcolormesh(XX,
                              YY,
                              np.log10(ZZ[maincont]),
                              vmin=-25,
                              vmax=-5,
                              shading='nearest',
                              cmap=cmap,
                              edgecolor='slategray',
                              linewidth=1)

    else:
        contf = ax.contourf(XX,
                            YY,
                            np.log10(ZZ[maincont]),
                            levels=np.arange(-25, -4, 1),
                            cmap=cmap,
                            vmin=-25,
                            vmax=-5,
                            extend='both')

    return ax, contf
コード例 #9
0
def PShabitabilityPlot(Trange=np.linspace(273, 403, num=14),
                       pHrange=np.linspace(7, 12, num=11),
                       nATP=1.0):

    mpl.rcParams['xtick.labelsize'] = 13
    mpl.rcParams['ytick.labelsize'] = 13
    mpl.rcParams['font.size'] = 13

    nomcols = plt.get_cmap('YlOrRd', 6)
    cmaplist = [nomcols(i) for i in range(nomcols.N)]
    # force the first color entry to be grey
    cmaplist[0] = (.95, .95, .95, 1.0)

    # create the new map
    nomcols = mpl.colors.LinearSegmentedColormap.from_list(
        'Custom cmap', cmaplist, nomcols.N)

    # get a mesh for the 5 cases.
    fn_preamble = ''
    if nATP == 1:
        fn_preamble = 'E21data/PSgrids/'
    else:
        fn_preamble = 'E21data/PSgrids/' + str(nATP) + '_'

    # for generating and saving

    # noms = EnceladusGrids.getMesh(Trange, pHrange, params=['PowerSupply'], nATP=nATP, quotienttype='salty_endmember')
    # np.save(fn_preamble+'noms.npy', noms['PowerSupply'][0])
    # np.save(fn_preamble+'pHgrid.npy', noms['pH'])
    # np.save(fn_preamble+'Tgrid.npy', noms['T'])
    #
    # nomhigh = EnceladusGrids.getMesh(Trange, pHrange, params=['PowerSupply'], nATP=nATP, k_corr=1., quotienttype='salty_high')['PowerSupply'][0]
    # highest = EnceladusGrids.getMesh(Trange, pHrange, params=['PowerSupply'], nATP=nATP, k_corr=1., quotienttype='salty_high')['PowerSupply'][2]
    #
    # nomlow = EnceladusGrids.getMesh(Trange, pHrange, params=['PowerSupply'], nATP=nATP, k_corr=-1., quotienttype='salty_low')['PowerSupply'][0]
    # lowest = EnceladusGrids.getMesh(Trange, pHrange, params=['PowerSupply'], nATP=nATP, k_corr=-1., quotienttype='salty_low')['PowerSupply'][1]
    #
    # np.save(fn_preamble+'nomhigh.npy', nomhigh)
    # np.save(fn_preamble+'highest.npy', highest)
    # np.save(fn_preamble+'nomlow.npy', nomlow)
    # np.save(fn_preamble+'lowest.npy', lowest)

    noms = np.load(fn_preamble + 'noms.npy')
    pHgrid = np.load(fn_preamble + 'pHgrid.npy')
    Tgrid = np.load(fn_preamble + 'Tgrid.npy')
    nomhigh = np.load(fn_preamble + 'nomhigh.npy')
    highest = np.load(fn_preamble + 'highest.npy')
    nomlow = np.load(fn_preamble + 'nomlow.npy')
    lowest = np.load(fn_preamble + 'lowest.npy')

    # get the maintenance dictionaries
    HC, Ti, L, B = EnceladusGrids.maintenancemesh(Trange, pHrange, nATP=nATP)

    Bpass = np.ndarray((len(Trange), len(pHrange)))
    Lpass = np.ndarray((len(Trange), len(pHrange)))
    Tipass = np.ndarray((len(Trange), len(pHrange)))
    HCpass = np.ndarray((len(Trange), len(pHrange)))
    # print(HCpass)

    yindex = 0
    for T in Trange:
        xindex = 0
        for pH in pHrange:
            for mp, mppass in zip([HC, Ti, L, B],
                                  [HCpass, Tipass, Lpass, Bpass]):
                mppass[yindex][xindex] = 0
                if lowest[yindex][xindex] > mp[yindex][xindex]:
                    mppass[yindex][xindex] = 1
                elif nomlow[yindex][xindex] > mp[yindex][xindex]:
                    mppass[yindex][xindex] = 2
                elif noms[yindex][xindex] > mp[yindex][xindex]:
                    mppass[yindex][xindex] = 3
                elif nomhigh[yindex][xindex] > mp[yindex][xindex]:
                    mppass[yindex][xindex] = 4
                elif highest[yindex][xindex] > mp[yindex][xindex]:
                    mppass[yindex][xindex] = 5

            xindex += 1
        yindex += 1

    fig, ax = plt.subplots(nrows=2, ncols=2, figsize=(10, 11))
    contf = ax[0][0].pcolormesh(pHgrid,
                                Tgrid,
                                HCpass,
                                vmin=0,
                                vmax=5,
                                shading='nearest',
                                cmap=nomcols,
                                edgecolor='slategray',
                                linewidth=1)
    contf = ax[0][1].pcolormesh(pHgrid,
                                Tgrid,
                                Tipass,
                                vmin=0,
                                vmax=5,
                                shading='nearest',
                                cmap=nomcols,
                                edgecolor='slategray',
                                linewidth=1)
    contf = ax[1][0].pcolormesh(pHgrid,
                                Tgrid,
                                Lpass,
                                vmin=0,
                                vmax=5,
                                shading='nearest',
                                cmap=nomcols,
                                edgecolor='slategray',
                                linewidth=1)
    contf = ax[1][1].pcolormesh(pHgrid,
                                Tgrid,
                                Bpass,
                                vmin=0,
                                vmax=5,
                                shading='nearest',
                                cmap=nomcols,
                                edgecolor='slategray',
                                linewidth=1)

    # fig.colorbar(contf)
    ax[0][0].plot([0], [0],
                  c=cmaplist[0],
                  label='Not enough power available in any configuration',
                  linewidth=10)
    ax[0][0].plot(
        [0], [0],
        c=cmaplist[1],
        label='Enough power available in the worst-case low-salt scenario',
        linewidth=10)
    ax[0][0].plot(
        [0], [0],
        c=cmaplist[2],
        label='Enough power available in the nominal low-salt scenario',
        linewidth=10)
    ax[0][0].plot([0], [0],
                  c=cmaplist[3],
                  label='Enough power available in the nominal scenario',
                  linewidth=10)
    ax[0][0].plot(
        [0], [0],
        c=cmaplist[4],
        label='Enough power available in the nominal high-salt scenario',
        linewidth=10)
    ax[0][0].plot(
        [0], [0],
        c=cmaplist[5],
        label='Enough power available in the best-case high-salt scenario',
        linewidth=10)

    ax[0][0].set_title(
        'To exceed maximum optimal maintenance \n (Higgins & Cockell 2020)',
        fontsize=13)
    ax[0][1].set_title(
        'To exceed empirical maintenance for anaerobes \n (Tijhuis+ 1993)',
        fontsize=13)
    ax[1][0].set_title('To exceed minimal maintenance power \n (Lever+ 2015)',
                       fontsize=13)
    ax[1][1].set_title(
        'To exceed minimal Earth subsurface power supplies \n (Bradley+ 2020)',
        fontsize=12)

    for aa in ax:
        for a in aa:
            a.set_xlim(6.75, 12.25)
            a.set_ylim(268, 408)
            a.set_xlabel('Bulk ocean pH (at 273 K)')
            a.set_ylabel('Seawater temperature [K]')

    plt.subplots_adjust(wspace=0.2,
                        hspace=0.33,
                        left=0.08,
                        right=0.98,
                        bottom=0.05,
                        top=0.78)

    ax[0][0].legend(bbox_to_anchor=(0., 1.18, 2.15, .102),
                    loc=3,
                    ncol=1,
                    mode="expand",
                    borderaxespad=0.)

    if nATP == 1.0:
        plt.savefig('figs/habgrid.pdf')
    else:
        plt.savefig('suppfigs/habgrid_' + str(nATP) + '.pdf')
コード例 #10
0
def MethanogenesisEnergyContourPlot(ax,
                                    CO2origin='pH',
                                    pHrange=np.linspace(7, 14, num=11),
                                    Trange=np.linspace(273, 473, num=11),
                                    maincont=0,
                                    quotienttype='salty_nominal'):

    plotkey = 'Gibbs_Methanogenesis'

    Meshes = EnceladusGrids.getMesh(Trange,
                                    pHrange,
                                    params=[plotkey],
                                    CO2origin=CO2origin,
                                    quotienttype=quotienttype)

    XX = Meshes['pH']
    YY = Meshes['T']
    ZZ = Meshes[plotkey]

    levels = [-150, -75, 0, 75]

    # contf = ax.contourf(XX, YY, ZZ[maincont], levels=np.arange(-150000, 150000, 3000), cmap=energycolormap(), vmin=-150000, vmax=150000, extend='both')
    contf = ax.contourf(XX,
                        YY,
                        ZZ[maincont] / 1000,
                        levels=np.arange(-160, 80, 2.5),
                        cmap=energycolormap(),
                        vmin=-160,
                        vmax=80,
                        extend='both')

    contourcolor = 'k'  #'dimgray'

    cont = ax.contour(XX,
                      YY,
                      ZZ[0] / 1000,
                      levels=levels,
                      colors=[contourcolor],
                      vmin=-150000,
                      vmax=80000,
                      linewidths=2.5)
    ax.clabel(cont, inline=1, fontsize=16, fmt='%d')  # add label

    ax.contour(XX,
               YY,
               ZZ[1] / 1000,
               levels=levels,
               linestyles='dotted',
               colors=[contourcolor],
               vmin=-150,
               vmax=80,
               linewidths=2.5)
    ax.contour(XX,
               YY,
               ZZ[2] / 1000,
               levels=levels,
               linestyles='dotted',
               colors=[contourcolor],
               vmin=-150,
               vmax=80,
               linewidths=2.5)

    ax.plot([0, 0], [0, 0],
            c=contourcolor,
            label='Uncertainty bounds on Gibbs free energy contour',
            linestyle='dotted',
            linewidth=2.5)

    return ax, contf
コード例 #11
0
def ones_varianceplot(T=300, pH=None, samplesize=100, nominals=True, save=True, show=True):

    xnum=100
    fig, ax = plt.subplots(figsize=(8,12), ncols=2, nrows=3)
    ax = ax.flatten()
    # cmaps=[transparent_cmap(238/360), transparent_cmap(120/360), 'Reds']
    cmaps=[transparent_cmap2(blue_to_a), transparent_cmap2(green_to_a), transparent_cmap2(red_to_a)]
    colors = ['blue', 'green','red']

    Tresults = []
    pHresults = []
    minpH, maxpH = 7,12
    minT, maxT = 273,400
    minx,maxx = 0, 0
    xnoms =[]

    if pH == None:
        minx, maxx = minpH, maxpH
        xnoms = np.linspace(minpH,maxpH,num=int(xnum))
    elif T== None:
        minx, maxx = minT, maxT
        xnoms = np.linspace(minT, maxT, num=int(xnum))
    if nominals:
        PSnoms=[]
        for xnom in xnoms:
            if pH == None:
                PSnoms.append(EG.getPSfromSigmas([0,0,0,1,0,T,xnom], dummyvals=True))
            elif T == None:
                PSnoms.append(EG.getPSfromSigmas([0,0,0,1,0,xnom,pH], dummyvals=True))

        logPSnoms = np.log10(PSnoms)

    ind = ['all', 'CH4', 'CO2','H2','nATP', 'k_corr']
    for i, v in enumerate(ind):
        xvals, PS = [],[]
        if pH == None:
            xvals, PS = samplepH_onlyone(samplesize, one=v, Temp=T, pHrange=[minx,maxx])#, pHnum=pHnum) #random sample
            ax[i].set_xlabel('pH')
        elif T == None:
            xvals, PS = sampleT_onlyone(samplesize, one=v, Trange=[minx,maxx], pH=pH)#, pHnum=pHnum) #random sample
            ax[i].set_xlabel('Temperature [K]')

        if save or show:
            _logy = np.log10(PS)
            zeroes = (_logy != -50.)
            logy = _logy[zeroes]
            # y = PS[zeroes]
            x = xvals[zeroes]
            logvariance = np.empty(len(logy))
            # variance = np.empty(len(y))
            ic = 0
            for xi, logyi in zip(x, logy):
                close_nom = int((xi-minx) / (maxx-minx) * xnum)
                logvariance[ic] = logyi - logPSnoms[close_nom]
                ic+=1
            ax[i].hist2d(x,logvariance, bins=[45,45], range=[[minx, maxx], [-4, 4]], cmap=cmaps[0], edgecolor=None)

            ax[i].set_title(v)
            ax[i].set_ylabel('Variance in log10 (power supply)')

    if pH == None:
        plt.suptitle('Variance with pH when T = '+str(T))
    elif T == None:
        plt.suptitle('Variance with T when pH = '+str(pH))
    plt.tight_layout()
    if save:
        plt.savefig('2_totvariance_independents_T_'+str(T)+'_pH_'+str(pH)+'.pdf')
    if show:
        plt.show()
    plt.close()
コード例 #12
0
def sampleplot3(Ts=[400, 350,300], pHs=[8,9,10]):
    """For testing different plot types, with nominal line """
    samplesize=1500
    pHnum=100
    fig, ax = plt.subplots(figsize=(10,5), ncols=2, nrows=1)

    # cmaps=[transparent_cmap(238/360), transparent_cmap(120/360), 'Reds']
    cmaps=[transparent_cmap2(blue_to_a), transparent_cmap2(green_to_a), transparent_cmap2(red_to_a)]
    colors = ['blue', 'green','red']

    Tresults = []
    pHresults = []

    pHnoms = np.linspace(7,12,num=int(pHnum))
    Tnoms = np.linspace(273, 400, num=int(pHnum))


    for i, T in enumerate(Ts):
        pHvals, PS = samplepH(samplesize, Temp=T, pHrange=[7,12])#, pHnum=pHnum) #random sample
        PSnoms=[]
        for pHnom in pHnoms:
            PSnoms.append(EG.getPSfromSigmas([0,0,0,1,0,T,pHnom], dummyvals=True))

        zeroes = (np.log10(PS) != -50.)
        y = np.log10(PS)[zeroes]
        x = pHvals[zeroes]
        # ax[0].hexbin(x, y, gridsize=(int(pHnum/2), int(pHnum/8)), cmap=cmaps[i])
        ax[0].hist2d(x,y, bins=[45,45], range=[[7, 12], [-35, -5]], cmap=cmaps[i], edgecolor=None)

        nomzeroes = (np.log10(PSnoms) != -50.)
        nomy = np.log10(PSnoms)[nomzeroes]
        nomx = pHnoms[nomzeroes]
        ax[0].plot(nomx, nomy, c=colors[i], linewidth=2, label='T = '+ str(T))

    for i, pH in enumerate(pHs):
        Tvals, PS = sampleT(samplesize, pH=pH)

        PSnoms=[]
        for Tnom in Tnoms:
            PSnoms.append(EG.getPSfromSigmas([0,0,0,1,0,Tnom,pH], dummyvals=True))

        zeroes = (np.log10(PS) != -50.)
        y = np.log10(PS)[zeroes]
        x = Tvals[zeroes]
        # ax[0].hexbin(x, y, gridsize=(int(pHnum/2), int(pHnum/8)), cmap=cmaps[i])
        ax[1].hist2d(x,y, bins=[45,45], range=[[273, 400], [-35, -5]], cmap=cmaps[i], edgecolor=None)

        nomzeroes = (np.log10(PSnoms) != -50.)
        nomy = np.log10(PSnoms)[nomzeroes]
        nomx = Tnoms[nomzeroes]
        ax[1].plot(nomx, nomy, c=colors[i], linewidth=2, label='pH = '+str(pH))

    for a in ax:
            a.set_ylabel('log10 (Power Supply [W/cell])')
            a.set_ylim(-35,-5)
            # EPS.add_maintnenace_lines(a)
    ax[0].set_xlabel('pH')
    ax[1].set_xlabel('Temperature [K]')
    ax[0].set_xlim(7,12)
    ax[1].set_xlim(273,400)

    ax[0].legend(bbox_to_anchor=(0., 1.05, 1.0, .102), loc='center',
           ncol=3, mode="expand", borderaxespad=0., fontsize=12)
    ax[1].legend(bbox_to_anchor=(0., 1.05, 1.0, .102), loc='center',
           ncol=3, mode="expand", borderaxespad=0., fontsize=12)
    plt.tight_layout()
    plt.savefig('2_binline.pdf')