pathSave = pathBase + 'plots/clumpTracking_mcmc_bootstrap/'
if not os.path.exists(pathSave): os.makedirs(pathSave)
fitInfoDict = {
    "spl": pstats.fitInfo_spl,
    "stpl": pstats.fitInfo_stpl,
    "tpl": pstats.fitInfo_tpl,
    "bcpl": pstats.fitInfo_bcpl,
    "bpl": pstats.fitInfo_bpl,
    "vtpl": pstats.fitInfo_vtpl,
    "tspl": pstats.fitInfo_tspl
}
fitInfo = fitInfoDict[fitKey]
################################################################################
# read peak files
doPlan = readerPlan.DataPlan(pathPlan,
                             nStart=nStart,
                             nTot=nStop,
                             nPar=512 * 512 * 512)
# read splitter ids and data
splitterIds = np.load(pathCT + "splitterIds.npy", allow_pickle=True)
splitterData = np.load(pathCT + "splitterData.npy", allow_pickle=True)
clumpObjList = []
ctFileNameList = os.listdir(pathCT)
for fileName in ctFileNameList:
    if fileName[0:8] != "splitter":
        inArr = np.load(pathCT + fileName, allow_pickle=True)
        #print(fileName)
        #print(inArr)
        clumpObjList.append(
            readerCt.Clump(inArr, doPlan, splitterIds, splitterData))
################################################################################
# get initial mass spectrum
G            = float(sys.argv[2])
pathBase     = str(sys.argv[3])
dt3d         = 1.0
################################################################################
path3d   = pathBase + '3d/'
pathSave = pathBase + 'plots/masterAnim/'
if not os.path.exists(pathSave): os.makedirs(pathSave)
do3d = reader3d.Data3d(path3d, dt=dt3d)
pathPlan = pathBase + 'planOutput/'
if do3d.nt > 15: nAvgEnd = 10*int(1.0/dt3d)
else:            nAvgEnd = 2
################################################################################
# 1    2    3      4    5    6
# npar mass r_hill xcom ycom zcom
planPlots = True
doPlan = readerPlan.DataPlan(pathPlan, G=G, dt=0.1)
#try:
	#doPlan = readerPlan.DataPlan(pathPlan, G=G, dt=0.1)
#except:
	#planPlots = False
if np.sum(do3d.get3d('dpar', 0)) > 1.e-20:
	dparPlots = True
else:
	dparPlots = False
################################################################################
if planPlots:
	pList   = []
	errList = []
	for n in range(0, doPlan.nTot):
		try:
			p, err = readerPlan.get_p(doPlan, n)
Ejemplo n.º 3
0
import planOutputReader as readerPlan
from matplotlib.backends.backend_pdf import PdfPages
from mpl_toolkits.mplot3d import Axes3D
import numpy.polynomial.polynomial as poly
################################################################################
# paths and CL args
pathSave = '../../plots/'
if not os.path.exists(pathSave): os.makedirs(pathSave)
plt.figure(0)
################################################################################
# set up data object and other params
# 1    2    3      4    5    6
# npar mass r_hill xcom ycom zcom
doPlanList = [
    readerPlan.DataPlan("../../data/prodRuns/run100/planOutput2/",
                        nStart=220,
                        nTot=275),
    readerPlan.DataPlan("../../data/prodRuns/run103/planOutput2/",
                        nStart=220,
                        nTot=299),
    readerPlan.DataPlan("../../data/prodRuns/run101/planOutput2/",
                        nStart=300,
                        nTot=390)
]
nStartList = [220, 220, 300]
################################################################################
# plot mass frac in planetesimals over time
colorList = ['k', 'b', 'r', 'g']
labelList = [
    'control', r'$\alpha=10^{-4}$', r'$\alpha=10^{-3.5}$', r'$\alpha=10^{-3}$'
]
Ejemplo n.º 4
0
from matplotlib.backends.backend_pdf import PdfPages
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.colors as colors
################################################################################
# paths
pathBase = str(sys.argv[1])
G = float(sys.argv[2])
pathPlan = pathBase + 'planOutput/'
pathSave = pathBase + 'plots/planAndGasAnim/'
path3d = pathBase + '3d/'
do3d = reader3d.Data3d(path3d)
if not os.path.exists(pathSave): os.makedirs(pathSave)
################################################################################
# 1    2    3      4    5    6
# npar mass r_hill xcom ycom zcom
doPlan = readerPlan.DataPlan(pathPlan, G=G)
nStart = 50
################################################################################
pList = []
errList = []
for n in range(0, doPlan.nt):
    p, err = readerPlan.get_p(doPlan, n)
    pList.append(p)
    errList.append(err)
pArr = np.asarray(pList)
errArr = np.asarray(errList)


################################################################################
def makeAnimFrame(self, n):
    print('saving anim frame for n = ' + str(n))
Ejemplo n.º 5
0
################################################################################
# paths and CL args
pathBase = str(sys.argv[1])
nStart = int(sys.argv[2])
nTot = int(sys.argv[3])
pathPlan = pathBase + 'planOutput/'
pathSave = pathBase + 'plots/planAnim_thesis/'
if not os.path.exists(pathSave): os.makedirs(pathSave)
plt.figure(0)
################################################################################
# set up data object and other params
# 1    2    3      4    5    6
# npar mass r_hill xcom ycom zcom
doPlan1 = readerPlan.DataPlan(pathPlan,
                              nStart=nStart,
                              nTot=nTot,
                              nPar=512 * 512 * 512,
                              dt=0.1)
p_mle_master = []
err_mle_master = []
p_fit_master = []
alpha_spl_master = []
alpha_stpl_master = []
xexp_stpl_master = []


################################################################################
def makeAnimFrame(doPlan, n):
    # calculate the PL slope with the MLE and fit
    doPlot = True
    try:
Ejemplo n.º 6
0
import numpy.polynomial.polynomial as poly
################################################################################
# paths and CL args
pathBase = str(sys.argv[1])
np1      = int(sys.argv[2])
np2      = int(sys.argv[3])
nTot     = int(sys.argv[4])
pathPlan = pathBase + 'planOutput/'
pathSave = pathBase + 'plots/plan/'
if not os.path.exists(pathSave): os.makedirs(pathSave)
plt.figure(0)
################################################################################
# set up data object and other params
# 1    2    3      4    5    6
# npar mass r_hill xcom ycom zcom
doPlan = readerPlan.DataPlan(pathPlan, nStart=200, nTot=nTot, nPar=128*128*128)
tp1    = np1*doPlan.dt
tp2    = np2*doPlan.dt


################################################################################
# MLE
################################################################################

# calculate the PL slope with the MLE at any times with enough planetesimals
pList=[]; errList=[]; tList=[]
for n in range(0, nTot):
	try:
		mp, dndmp = readerPlan.getDiffMassHist(doPlan, n)
		if len(mp)>4:
			p, err = readerPlan.get_p(doPlan, n)