Example #1
0
    thisSeq = cstSequence(thisSet, theSlice, filters)

    mgPlot = thisSeq.getSeqPlot([xVar], ["gravMass"], filters, xcolFunc=lambda x: x / 1000.0, ycolFunc=mgYfunc)
    mbPlot = thisSeq.getSeqPlot([xVar], ["baryMass"], filters, xcolFunc=lambda x: x / 1000.0)
    labelKwarg = {"label": script}
    ax_mg.plot(*mgPlot, c=colors[script], ms=8, lw=lineWidths[script], markeredgecolor=colors[script])
    ax_mb.plot(*mbPlot, c=colors[script], ms=8, lw=lineWidths[script], markeredgecolor=colors[script], dashes=(20, 5))
    del thisSet
    thisSet = cstDataset(script, eosName, ye, sourceDb)

    if toroidSymbols:
        filters = ("RedMax>0.0",)
        markerSize = 6
        edgeColor = colors[script]
    else:
        filters = nearValueFilter("edMax", ed)
        print filters
        theSlice = {"a": a, "rpoe": "min"}
        markerSize = 8
        edgeColor = "k"
    thisSeq = cstSequence(thisSet, theSlice, filters)
    mbToroid = thisSeq.getSeqPlot([xVar], ["baryMass"], filters, xcolFunc=lambda x: x / 1000.0)
    mgToroid = thisSeq.getSeqPlot([xVar], ["gravMass"], filters, xcolFunc=lambda x: x / 1000.0, ycolFunc=mgYfunc)
    # print mbToroid
    ax_mg.plot(
        *mgToroid,
        c=colors[script],
        marker=symbols[script],
        ms=markerSize,
        lw=lineWidths[script],
        markeredgecolor=edgeColor,
                             ycolFunc=mgYfunc)
 mbPlot = thisSeq.getSeqPlot([xVar], ['baryMass'], filters, xcolFunc=lambda x: x/1000.0)
 labelKwarg = {'label': script}
 plt.plot(*mgPlot, c=colors[script],  ms=8, lw=lineWidths[script],
          markeredgecolor=colors[script])
 plt.plot(*mbPlot, c=colors[script],  ms=8, lw=lineWidths[script],
          markeredgecolor=colors[script], dashes=(20, 5))
 del thisSet
 thisSet = cstDataset(script, eosName, ye, sourceDb)
 
 if toroidSymbols:
     filters = ('RedMax>0.0',)
     markerSize = 6
     edgeColor = colors[script]
 else: 
     filters = nearValueFilter('edMax', ed)
     print filters
     theSlice = {'a': a, 'rpoe': 'min'}
     markerSize = 8
     edgeColor = 'k'
 thisSeq = cstSequence(thisSet, theSlice, filters)
 mbToroid = thisSeq.getSeqPlot([xVar], ['baryMass'], filters, xcolFunc=lambda x: x/1000.0)
 mgToroid = thisSeq.getSeqPlot([xVar], ['gravMass'], filters, xcolFunc=lambda x: x/1000.0,
                               ycolFunc=mgYfunc)
 #print mbToroid
 plt.plot(*mgToroid, c=colors[script], marker=symbols[script], ms=markerSize,
          lw=lineWidths[script], markeredgecolor=edgeColor,
          **labelKwarg)
 plt.plot(*mbToroid, c=colors[script], marker=symbols[script], ms=markerSize,
          lw=lineWidths[script], dashes=(20, 5), markeredgecolor=edgeColor)
 filters = ()
tempFuncs = [getTRollFunc(params[0], 0.01, params[1], params[2]) for params in cXXp0_params]
tempFuncs.append(kentaDataTofLogRhoFit1())
tempFuncs.append(kentaDataTofLogRhoFit2())
tempFuncs.append(lambda x: 0.01)
tempFuncsDict = {scriptsList[i]: tempFuncs[i] for i in range(len(scriptsList))}


scriptsList = scriptsList[::-1]
for script in scriptsList:
    if script == 'c30p10':
        thisSet = cstDataset(script, eosName, ye, c30p10Db)
    else:
        thisSet = cstDataset(script, eosName, ye, shedDb)
    c = thisSet.dbConn.cursor()
    # c.execute("SELECT MAX(gravMass) FROM models WHERE ToverW<0.25")
    # mg_max = c.fetchall()[0][0]
    c.execute("SELECT MAX(baryMass) FROM models WHERE ToverW<0.25")
    mb = c.fetchall()[0][0]
    filt = nearValueFilter('baryMass', mb, 1e-7) + ('ToverW<0.25',)
    #print filt
    c.execute("SELECT edMax,baryMass,gravMass,arealR,rpoe,a,omega_c,ToverW FROM models WHERE "
              + " AND ".join(filt))
    values = c.fetchall()[0]
    mg_at_maxMb = values[2]
    rhob = theEos.rhobFromEnergyDensityWithTofRho(values[0], ye, tempFuncsDict[script])
    print eosText + " " + script + "   ",
    print "& %2.3f & %2.3f & %2.3f & %2.3f & %2.3f & %1.1f & %2.3f & %2.3f\\\\" \
          % (rhob/1.e15, values[1], values[2], values[3], values[4],
             values[5], values[6]/1000.0, values[7])
    #print 'MG FRACDIFF: ', (mg_max - mg_at_maxMb)/mg_max
    del thisSet
#xLabel = r"$E_\mathrm{max}$"
yLabel = "$M_\mathrm{g} \,[M_\odot]$"
#yLabel = "T - W"
yLabel = "$T$ \,[M_\odot]"#/M^2$"
#yLabel = "$r_{p/e}$"
#yLabel = "$\Omega_c$"
yFunc = lambda x,y: y

a = 1.0

tovSlice = {'a': 0.0, 'rpoe': 1.0}
uniformMaxRotSlice = {'a': 0.0, 'rpoe': 'min'}
theMaxRotSlice = {'a': a, 'rpoe': 'min'}
mbLimit = 2.9
#mbLimit = 2.63
filters = nearValueFilter('baryMass', mbLimit, 1.e-3) #('baryMass<%s' % mbLimit)

aList = [0.0, 0.3, 0.6, 0.9, 1.1]
#aList = [0.0, 1.1]
#aList = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
dashList = ['_', ':', '-.', '--', '-', '--', '-.', ':', '_', ':', '-.']
dashList = [(None, None), (25, 4), (13, 5), (20, 4, 10, 6), (10, 3, 5, 5)]
dashList = dashList[::-1]
colors = {'c30p0': 'g',
          'c20p0': 'b',
          'c40p0': 'r',
          'cold': 'k',
          'c30p5': 'c',
          'c30p10': 'm'}

symbols = {'c30p0': 's',
Example #5
0
#xLabel = r"$E_\mathrm{max}$"
yLabel = "$M_\mathrm{g} \,[M_\odot]$"
#yLabel = "T - W"
yLabel = "$T$ \,[M_\odot]"  #/M^2$"
#yLabel = "$r_{p/e}$"
#yLabel = "$\Omega_c$"
yFunc = lambda x, y: y

a = 1.0

tovSlice = {'a': 0.0, 'rpoe': 1.0}
uniformMaxRotSlice = {'a': 0.0, 'rpoe': 'min'}
theMaxRotSlice = {'a': a, 'rpoe': 'min'}
mbLimit = 2.9
#mbLimit = 2.63
filters = nearValueFilter('baryMass', mbLimit,
                          1.e-3)  #('baryMass<%s' % mbLimit)

aList = [0.0, 0.3, 0.6, 0.9, 1.1]
#aList = [0.0, 1.1]
#aList = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
dashList = ['_', ':', '-.', '--', '-', '--', '-.', ':', '_', ':', '-.']
dashList = [(None, None), (25, 4), (13, 5), (20, 4, 10, 6), (10, 3, 5, 5)]
dashList = dashList[::-1]
colors = {
    'c30p0': 'g',
    'c20p0': 'b',
    'c40p0': 'r',
    'cold': 'k',
    'c30p5': 'c',
    'c30p10': 'm'
}

scriptsList = ['c40p0', 'c30p10', 'c30p5', 'c30p0', 'c20p0', 'cold']
cXXp0_params = [(40.0, 14.18, 0.5,), (30.0, 14.055, 0.375),  (20.0, 13.93, 0.25)]
tempFuncs = [getTRollFunc(params[0], 0.01, params[1], params[2]) for params in cXXp0_params]
tempFuncs.append(kentaDataTofLogRhoFit1())
tempFuncs.append(kentaDataTofLogRhoFit2())
tempFuncs.append(lambda x: 0.01)
tempFuncsDict = {scriptsList[i]: tempFuncs[i] for i in range(len(scriptsList))}


scriptsList = scriptsList[::-1]
for script in scriptsList:
    thisSet = cstDataset(script, eosName, ye, shedDb)
    c = thisSet.dbConn.cursor()
    c.execute("SELECT MAX(baryMass) FROM models")
    mb = c.fetchall()[0][0]
    c.execute("SELECT MAX(gravMass) FROM models WHERE ToverW<0.25")
    mg_max = c.fetchall()[0][0]
    filt = nearValueFilter('baryMass', mb, 1e-7)
    #print filt
    c.execute("SELECT edMax,baryMass,gravMass,arealR,rpoe,omega_c,ToverW FROM models WHERE "
              + " AND ".join(filt))
    values = c.fetchall()[0]
    mg_at_maxMb = values[2]
    rhob = theEos.rhobFromEnergyDensityWithTofRho(values[0], ye, tempFuncsDict[script])
    print eosText + " " + script + "   ",
    print "& %2.3f & %2.3f & %2.3f & %2.3f & %2.3f & %2.3f & %2.3f\\\\" \
          % (rhob/1.e15, values[1], values[2], values[3], values[4], values[5]/1000.0, values[6])
    #print 'MG FRACDIFF: ', (mg_max - mg_at_maxMb)/mg_max
    del thisSet