for n in range(100,200,1): if n < 10: i = '0' + str(n) else: i = str(n) #same system case df = pd.read_csv('df_binary_test{}.csv'.format(i)) dar = Dartmouth_Isochrone() t = ObservationTree.from_df(df, name='test{}'.format(i)) t.define_models(dar) mod = StarModel(dar, obs=t) mod.fit_multinest(n_live_points=1000, basename='test{}_bound'.format(i)) #if rank == 0: f1 = open('evidence_bound2.txt','a') evi = mod.evidence evi = str(evi) f1.write('case{}: '.format(i) + evi + '\n') #mod.corner(['mass_0_0','mass_0_1','distance_0','AV_0']) fig = mod.corner_physical(props=['mass', 'distance', 'AV']) fig.savefig('test{}_bound_corner_physical.png'.format(i)) plt.close(fig) fig = mod.corner_observed() fig.savefig('test{}_bound_corner_observed.png'.format(i)) plt.close(fig)
else: return str(n) n = sys.argv[1] i = get_index(n) df = pd.read_csv('/tigress/np5/dataFrame/df_triplet_test{}.csv'.format(i)) #------------------------------------------------------------------------------- #triplet0 - all in same system dar = Dartmouth_Isochrone() t = ObservationTree.from_df(df, name='test{}'.format(i)) t.define_models(dar) mod = StarModel(dar, obs=t) mod.fit_multinest(n_live_points=1000, basename='/tigress/np5/chains/test{}_triplet0'.format(i)) #if rank == 0: f1 = open('/tigress/np5/evidence_triplet0.txt','a') evi = mod.evidence evi = str(evi) f1.write('case{}: '.format(i) + evi + '\n') f1.close() fig = mod.corner_physical(props=['mass', 'distance', 'AV']) fig.savefig('/tigress/np5/figures/test{}_triplet0_corner_physical.png'.format(i)) plt.close(fig) fig = mod.corner_observed() fig.savefig('/tigress/np5/figures/test{}_triplet0_corner_observed.png'.format(i)) plt.close(fig) #-------------------------------------------------------------------------------
else: return str(n) n = sys.argv[1] i = get_index(n) df = pd.read_csv('/tigress/np5/dataFrame/df_quad_test{}.csv'.format(i)) #------------------------------------------------------------------------------- #quad0 - all in same system dar = Dartmouth_Isochrone() t = ObservationTree.from_df(df, name='test{}'.format(i)) t.define_models(dar) mod = StarModel(dar, obs=t) mod.fit_multinest(n_live_points=1000, basename='/tigress/np5/chains/test{}_quad0'.format(i)) if rank == 0: f1 = open('/tigress/np5/evidence_quad0.txt','a') evi = mod.evidence evi = str(evi) f1.write('case{}: '.format(i) + evi + '\n') f1.close() fig = mod.corner_physical(props=['mass', 'distance', 'AV']) fig.savefig('/tigress/np5/figures/test{}_quad0_corner_physical.png'.format(i)) plt.close(fig) fig = mod.corner_observed() fig.savefig('/tigress/np5/figures/test{}_quad0_corner_observed.png'.format(i)) plt.close(fig) #-------------------------------------------------------------------------------
df = pd.read_csv('/tigress/np5/dataFrame/df_binary_test{}.csv'.format(i)) dar = Dartmouth_Isochrone() t = ObservationTree.from_df(df, name='test{}'.format(i)) leaves = t._get_leaves() boolean1 = np.isfinite(leaves[0].value[0]) boolean2 = np.isfinite(leaves[1].value[0]) boolean = boolean1 and boolean2 if boolean: t.define_models(dar) mod = StarModel(dar, obs=t) mod.fit_multinest(n_live_points=1000, basename='/tigress/np5/chains/test{}_bound'.format(i)) f1 = open('/tigress/np5/evidence_bound.txt','a') evi = mod.evidence evi = str(evi) f1.write('case{}: '.format(i) + evi + '\n') f1.close() fig = mod.corner_physical(props=['mass', 'distance', 'AV']) fig.savefig('/tigress/np5/figures/test{}_bound_corner_physical.png'.format(i)) plt.close(fig) fig = mod.corner_observed() fig.savefig('/tigress/np5/figures/test{}_bound_corner_observed.png'.format(i)) plt.close(fig) #unassociated case
import pandas as pd from isochrones.dartmouth import Dartmouth_Isochrone from isochrones.observation import ObservationTree from isochrones.starmodel import StarModel from datetime import datetime df = pd.read_csv('df.csv') dar = Dartmouth_Isochrone() t = ObservationTree.from_df(df, name='test-triplet') t.define_models(dar, index=[0,0,1]) t.add_limit(logg=(3.0,None)) mod = StarModel(dar, obs=t) startTime = datetime.now() mod.fit_multinest(n_live_points=1000) time = datetime.now() - startTime evi = mod.evidence print 'evidence = {}'.format(evi) print 'total time = {}'.format(time)