def main(modelid): make_threadsafe = 0 cut_tess = 1 fitindiv = 1 phaseplot = 1 cornerplot = 1 subsetcorner = 1 grounddepth = 1 N_samples = 30000 target_accept = 0.9 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join(RESULTSDIR, '{}_{}_phot_results'.format(REALID, modelid)) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) datestr = '20200711' PLOTDIR = os.path.join(PLOTDIR, datestr) ########################################## assert modelid in ['tessindivtransit'] print(42 * '#') print(modelid) print(42 * '#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', f'{REALID}_model_{modelid}_{datestr}.pkl') np.random.seed(42) # get tess data provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) #y_flat, y_trend = detrend_tessphot(x_obs, y_obs, y_err) s = np.isfinite(y_obs) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_obs, y_err = x_obs[s], y_obs[s], y_err[s] if cut_tess: x_obs, y_obs, y_err = _subset_cut(x_obs, y_obs, y_err, n=3.5) ngroups, groupinds = find_lc_timegroups(x_obs, mingap=4.0) assert ngroups == 5 datasets = OrderedDict() for ix, g in enumerate(groupinds): tess_texp = np.nanmedian(np.diff(x_obs[g])) datasets[f'tess_{ix}'] = [x_obs[g], y_obs[g], y_err[g], tess_texp] mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents, datasets=datasets) m = ModelFitter(modelid, datasets, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE, N_samples=N_samples, target_accept=target_accept) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) printparams = ['r_planet', 'b'] print(42 * '-') for p in printparams: med = np.percentile(m.trace[p], 50) up = np.percentile(m.trace[p], 84) low = np.percentile(m.trace[p], 36) print(f'{p} limit: {med:.3f} +{up-med:.3f} -{med-low:.3f}') print(42 * '-') if make_threadsafe: pass else: # if grounddepth: # outpath = join(PLOTDIR, f'{REALID}_{modelid}_grounddepth.png') # tp.plot_grounddepth(m, summdf, outpath, modelid=modelid, # showerror=0) if subsetcorner: outpath = join(PLOTDIR, f'{REALID}_{modelid}_subsetcorner.png') tp.plot_subsetcorner(m, outpath) if phaseplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_phaseplot.png') tp.plot_phasefold(m, summdf, outpath, modelid=modelid, inppt=1) if fitindiv: outpath = join(PLOTDIR, f'{REALID}_{modelid}_fitindiv.png') tp.plot_fitindiv(m, summdf, outpath, modelid=modelid) if cornerplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_cornerplot.png') tp.plot_cornerplot(prior_d, m, outpath)
def main(modelid): make_threadsafe = 0 cut_tess = 1 fitindiv = 1 phaseplot = 1 grounddepth = 1 cornerplot = 1 subsetcorner = 1 N_samples = 30000 # took 2h 20m, but Rhat=1.0 for all # N_samples = 2000 # took 16m, 14s. but Rhat=1.01 for b, rp/rs, + a few a1/a2s target_accept = 0.9 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join(RESULTSDIR, '{}_{}_phot_results'.format(REALID, modelid)) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) datestr = '20200711' PLOTDIR = os.path.join(PLOTDIR, datestr) ########################################## assert modelid in ['allindivtransit'] print(42 * '#') print(modelid) print(42 * '#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', f'{REALID}_model_{modelid}_{datestr}.pkl') np.random.seed(42) # get tess data provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) #y_flat, y_trend = detrend_tessphot(x_obs, y_obs, y_err) s = np.isfinite(y_obs) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_obs, y_err = x_obs[s], y_obs[s], y_err[s] if cut_tess: x_obs, y_obs, y_err = _subset_cut(x_obs, y_obs, y_err, n=3.5) ngroups, groupinds = find_lc_timegroups(x_obs, mingap=4.0) assert ngroups == 5 datasets = OrderedDict() for ix, g in enumerate(groupinds): tess_texp = np.nanmedian(np.diff(x_obs[g])) datasets[f'tess_{ix}'] = [x_obs[g], y_obs[g], y_err[g], tess_texp] datestrs = ['20200401', '20200426', '20200521', '20200614'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_elsauce_phot(datestr=d) x_obs -= 2457000 # convert to BTJD elsauce_texp = np.nanmedian(np.diff(x_obs)) datasets[f'elsauce_{ix}'] = [x_obs, y_obs, y_err, elsauce_texp] datestrs = ['20200529', '20200614', '20200623'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_astep_phot(datestr=d) x_obs += 2450000 # convert to BJD_TDB x_obs -= 2457000 # convert to BTJD astep_texp = np.nanmedian(np.diff(x_obs)) datasets[f'astep_{ix}'] = [x_obs, y_obs, y_err, astep_texp] mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents, datasets=datasets) m = ModelFitter(modelid, datasets, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE, N_samples=N_samples, target_accept=target_accept) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) rp_limit = np.percentile(m.trace.r_planet, 1 - 0.9973) print(42 * '-') print(f'Rp limit: {rp_limit:.3f} Rjup') print(42 * '-') if make_threadsafe: pass else: if grounddepth: outpath = join(PLOTDIR, f'{REALID}_{modelid}_grounddepth.png') tp.plot_grounddepth(m, summdf, outpath, modelid=modelid, showerror=0) if subsetcorner: outpath = join(PLOTDIR, f'{REALID}_{modelid}_subsetcorner.png') tp.plot_subsetcorner(m, outpath) if phaseplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_phaseplot.png') tp.plot_phasefold(m, summdf, outpath, modelid=modelid, inppt=1) if fitindiv: outpath = join(PLOTDIR, f'{REALID}_{modelid}_fitindiv.png') tp.plot_fitindiv(m, summdf, outpath, modelid=modelid) if cornerplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_cornerplot.png') tp.plot_cornerplot(prior_d, m, outpath)
def main(modelid): make_threadsafe = 0 cut_tess = 1 fitindiv = 0 phaseplot = 0 grounddepth = 0 cornerplot = 0 subsetcorner = 0 N_samples = 30000 # took 2h 20m, but Rhat=1.0 for all # N_samples = 100 # testing target_accept = 0.9 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join( RESULTSDIR, '{}_{}_phot_results'.format(REALID, modelid) ) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) datestr = '20200805' PLOTDIR = os.path.join(PLOTDIR, datestr) ########################################## assert modelid in ['evenindivtransit', 'oddindivtransit'] print(42*'#') print(modelid) print(42*'#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join( os.path.expanduser('~'), 'local', 'timmy', f'{REALID}_model_{modelid}_{datestr}.pkl' ) np.random.seed(42) # get tess data provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) s = np.isfinite(y_obs) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_obs, y_err = x_obs[s], y_obs[s], y_err[s] if cut_tess: if 'even' in modelid: onlyeven = True onlyodd = False elif 'odd' in modelid: onlyeven = False onlyodd = True else: raise NotImplementedError x_obs, y_obs, y_err = _subset_cut( x_obs, y_obs, y_err, n=3.5, onlyeven=onlyeven, onlyodd=onlyodd ) ngroups, groupinds = find_lc_timegroups(x_obs, mingap=4.0) assert ngroups in [2,3] datasets = OrderedDict() for ix, g in enumerate(groupinds): tess_texp = np.nanmedian(np.diff(x_obs[g])) datasets[f'tess_{ix}'] = [x_obs[g], y_obs[g], y_err[g], tess_texp] # see /doc/20200805_ephemeris_counting.txt if 'even' in modelid: datestrs = ['20200401', '20200521'] elif 'odd' in modelid: datestrs = ['20200426', '20200614'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_elsauce_phot(datestr=d) x_obs -= 2457000 # convert to BTJD elsauce_texp = np.nanmedian(np.diff(x_obs)) datasets[f'elsauce_{ix}'] = [x_obs, y_obs, y_err, elsauce_texp] if 'even' in modelid: datestrs = ['20200623'] elif 'odd' in modelid: datestrs = ['20200529', '20200614'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_astep_phot(datestr=d) x_obs += 2450000 # convert to BJD_TDB x_obs -= 2457000 # convert to BTJD astep_texp = np.nanmedian(np.diff(x_obs)) datasets[f'astep_{ix}'] = [x_obs, y_obs, y_err, astep_texp] mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents, datasets=datasets) m = ModelFitter(modelid, datasets, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE, N_samples=N_samples, target_accept=target_accept) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median':np.nanmedian}, extend=True) printparams = ['r_planet', 'b', 'log_r', 'log_r_sq'] print(42*'-') print(modelid) for p in printparams: if p != 'log_r_sq': med = np.percentile(m.trace[p], 50) up = np.percentile(m.trace[p], 84) low = np.percentile(m.trace[p], 36) else: med = np.percentile(np.exp(m.trace['log_r'])**2, 50) up = np.percentile(np.exp(m.trace['log_r'])**2, 84) low = np.percentile(np.exp(m.trace['log_r'])**2, 36) print(f'{p} limit: {med:.6f} +{up-med:.6f} -{med-low:.6f}') print(42*'-') if make_threadsafe: pass else: if grounddepth: outpath = join(PLOTDIR, f'{REALID}_{modelid}_grounddepth.png') tp.plot_grounddepth(m, summdf, outpath, modelid=modelid, showerror=0) if subsetcorner: outpath = join(PLOTDIR, f'{REALID}_{modelid}_subsetcorner.png') tp.plot_subsetcorner(m, outpath) if phaseplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_phaseplot.png') tp.plot_phasefold(m, summdf, outpath, modelid=modelid, inppt=1) if fitindiv: outpath = join(PLOTDIR, f'{REALID}_{modelid}_fitindiv.png') tp.plot_fitindiv(m, summdf, outpath, modelid=modelid) if cornerplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_cornerplot.png') tp.plot_cornerplot(prior_d, m, outpath)
def main(modelid): assert modelid == 'rv' make_threadsafe = 0 phaseplot = 0 cornerplot = 1 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join(RESULTSDIR, '{}_{}_fitting_results'.format(REALID, modelid)) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) PLOTDIR = os.path.join(PLOTDIR, '20200525') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) print(42 * '#') print(modelid) print(42 * '#') pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', '{}_model_{}.pkl'.format(REALID, modelid)) np.random.seed(42) rv_df = get_clean_rv_data() mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents) m = ModelFitter(modelid, rv_df, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE) var_names = [ 'r_star', 'logg_star', 'log_K', 'period', 'ecc', 'omega', 'phase', 't0', 'S_tot', 'ell', 'means', 'sigmas' ] print(pm.summary(m.trace, var_names=var_names)) summdf = pm.summary(m.trace, var_names=var_names, round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) if make_threadsafe: pass else: if cornerplot: outpath = join(PLOTDIR, '{}_{}_cornerplot.png'.format(REALID, modelid)) tp.plot_cornerplot(prior_d, m, outpath) import IPython IPython.embed() #FIXME: save the SAMPLES from the trace (rather than the trace itself, #b/c of the local functions definined within the model context) assert 0 #FIXME plots below if phaseplot: outpath = join(PLOTDIR, '{}_{}_phaseplot.png'.format(REALID, modelid)) tp.plot_phasefold(m, summdf, outpath) assert 0 if sampleplot: outpath = join(PLOTDIR, '{}_{}_sampleplot.png'.format(REALID, modelid)) tp.plot_sampleplot(m, outpath, N_samples=100)
def main(modelid): make_threadsafe = 0 cut_tess = 1 phaseplot = 1 grounddepth = 1 fittedzoom = 0 cornerplot = 0 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join(RESULTSDIR, '{}_{}_phot_results'.format(REALID, modelid)) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) PLOTDIR = os.path.join(PLOTDIR, '20200617') ########################################## assert modelid in [ 'alltransit', 'alltransit_quad', 'alltransit_quaddepthvar' ] print(42 * '#') print(modelid) print(42 * '#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', '{}_model_{}.pkl'.format(REALID, modelid)) np.random.seed(42) # get tess data provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) y_flat, y_trend = detrend_tessphot(x_obs, y_obs, y_err) s = np.isfinite(y_flat) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_flat, y_err = x_obs[s], y_flat[s], y_err[s] if cut_tess: x_obs, y_flat, y_err = _subset_cut(x_obs, y_flat, y_err) tess_texp = np.nanmedian(np.diff(x_obs)) datasets = OrderedDict() datasets['tess'] = [x_obs, y_flat, y_err, tess_texp] datestrs = ['20200401', '20200426', '20200521', '20200614'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_elsauce_phot(datestr=d) x_obs -= 2457000 # convert to BTJD elsauce_texp = np.nanmedian(np.diff(x_obs)) datasets[f'elsauce_{ix}'] = [x_obs, y_obs, y_err, elsauce_texp] # note: we're fitting the detrended data mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents, datasets=datasets) m = ModelFitter(modelid, datasets, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) if modelid == 'alltransit_quaddepthvar': var_names = [ 'tess_roughdepth', 'elsauce_0_roughdepth', 'elsauce_1_roughdepth', 'elsauce_2_roughdepth', 'elsauce_3_roughdepth' ] ddf = pm.summary(m.trace, var_names=var_names, round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) print(ddf) if make_threadsafe: pass else: if cornerplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_cornerplot.png') tp.plot_cornerplot(prior_d, m, outpath) if phaseplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_phaseplot.png') tp.plot_phasefold(m, summdf, outpath, modelid=modelid, inppt=1) if fittedzoom: outpath = join(PLOTDIR, '{}_{}_fittedzoom.png'.format(REALID, modelid)) tp.plot_fitted_zoom(m, summdf, outpath, modelid=modelid) if grounddepth: outpath = join(PLOTDIR, f'{REALID}_{modelid}_grounddepth.png') tp.plot_grounddepth(m, summdf, outpath, modelid=modelid)
def main(modelid): make_threadsafe = 0 phaseplot = 0 cornerplot = 0 fittedzoom = 0 grounddepth = 1 writevespa = 0 sampleplot = 0 OVERWRITE = 1 REALID = 'TOI_837' provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX PLOTDIR = os.path.join(RESULTSDIR, '{}_{}_phot_results'.format(REALID, modelid)) if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) PLOTDIR = os.path.join(PLOTDIR, '20200518') ########################################## assert modelid == 'transit' print(42 * '#') print(modelid) print(42 * '#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', '{}_model_{}.pkl'.format(REALID, modelid)) np.random.seed(42) x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) y_flat, y_trend = detrend_tessphot(x_obs, y_obs, y_err) s = np.isfinite(y_flat) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_flat, y_err = x_obs[s], y_flat[s], y_err[s] if writevespa: _write_vespa(x_obs, y_flat, y_err) return # note: we're fitting the detrended data mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents) data_df = pd.DataFrame({'x_obs': x_obs, 'y_obs': y_flat, 'y_err': y_err}) m = ModelFitter(modelid, data_df, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) if make_threadsafe: pass else: if fittedzoom: outpath = join(PLOTDIR, '{}_{}_fittedzoom.png'.format(REALID, modelid)) tp.plot_fitted_zoom(m, summdf, outpath) if grounddepth: outpath = join(PLOTDIR, '{}_{}_grounddepth.png'.format(REALID, modelid)) tp.plot_grounddepth(m, summdf, outpath) if phaseplot: outpath = join(PLOTDIR, '{}_{}_phaseplot.png'.format(REALID, modelid)) tp.plot_phasefold(m, summdf, outpath) if cornerplot: outpath = join(PLOTDIR, '{}_{}_cornerplot.png'.format(REALID, modelid)) tp.plot_cornerplot(prior_d, m, outpath) # NOTE: following are deprecated if sampleplot: outpath = join(PLOTDIR, '{}_{}_sampleplot.png'.format(REALID, modelid)) tp.plot_sampleplot(m, outpath, N_samples=100)
def main(modelid): seldate = '20200426' bp = 'Rband' N_samples = 12000 # nb: 7.5mins, decent but not perfect convergence # seldate = '20200614' # bp = 'Bband' # Nsamples = 12000 # 7min: gets rhat = 1.0 for all parameters. cornerplot = 1 phaseplot = 0 grounddepth = 0 fittedzoom = 0 make_threadsafe = 0 cut_tess = 1 OVERWRITE = 1 REALID = 'TOI_837' PLOTDIR = os.path.join(RESULTSDIR, f'{REALID}_{modelid}_{seldate}_{bp}_phot_results') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) PLOTDIR = os.path.join(PLOTDIR, f'20200617_{bp}') ########################################## assert modelid in ['onetransit'] print(42 * '#') print(modelid) print(42 * '#') if not os.path.exists(PLOTDIR): os.mkdir(PLOTDIR) pklpath = os.path.join(os.path.expanduser('~'), 'local', 'timmy', f'{REALID}_model_{modelid}_{seldate}_{bp}.pkl') np.random.seed(42) # get tess data provenance = 'spoc' # could be "cdips" yval = 'PDCSAP_FLUX' # could be SAP_FLUX x_obs, y_obs, y_err = get_clean_tessphot(provenance, yval, binsize=None, maskflares=1) y_flat, y_trend = detrend_tessphot(x_obs, y_obs, y_err) s = np.isfinite(y_flat) & np.isfinite(x_obs) & np.isfinite(y_err) x_obs, y_flat, y_err = x_obs[s], y_flat[s], y_err[s] if cut_tess: x_obs, y_flat, y_err = _subset_cut(x_obs, y_flat, y_err) tess_texp = np.nanmedian(np.diff(x_obs)) datasets = OrderedDict() datasets['tess'] = [x_obs, y_flat, y_err, tess_texp] datestrs = ['20200401', '20200426', '20200521', '20200614'] for ix, d in enumerate(datestrs): x_obs, y_obs, y_err = get_elsauce_phot(datestr=d) x_obs -= 2457000 # convert to BTJD elsauce_texp = np.nanmedian(np.diff(x_obs)) datasets[f'elsauce_{ix}'] = [x_obs, y_obs, y_err, elsauce_texp] if seldate not in datestrs: raise NotImplementedError else: usedata = OrderedDict() tra_ind = int(np.argwhere(np.array(datestrs) == seldate)) usedata[f'elsauce_{tra_ind}'] = (deepcopy( datasets[f'elsauce_{tra_ind}'])) # note: we're fitting the detrended data mp = ModelParser(modelid) prior_d = initialize_prior_d(mp.modelcomponents, datasets=usedata) m = ModelFitter(modelid, usedata, prior_d, plotdir=PLOTDIR, pklpath=pklpath, overwrite=OVERWRITE, N_samples=N_samples) print(pm.summary(m.trace, var_names=list(prior_d.keys()))) summdf = pm.summary(m.trace, var_names=list(prior_d.keys()), round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) var_names = ['roughdepth'] ddf = pm.summary(m.trace, var_names=var_names, round_to=10, kind='stats', stat_funcs={'median': np.nanmedian}, extend=True) print(ddf) d_1sig = np.percentile(m.trace.roughdepth, 50 - (68 / 2)) d_2sig = np.percentile(m.trace.roughdepth, 50 - (95 / 2)) print(f'1 sigma depth lower limit: {d_1sig:.6f}') print(f'2 sigma depth lower limit: {d_2sig:.6f}') if make_threadsafe: pass else: if cornerplot: outpath = join(PLOTDIR, f'{REALID}_{modelid}_cornerplot.png') prior_d['roughdepth'] = 4600e-6 tp.plot_cornerplot(prior_d, m, outpath)