In [1]:
import pandas as pd
from exosyspop.populations import TRILEGAL_BGBinaryPopulation
targets = pd.read_hdf('targets.h5')
bgstars = pd.read_hdf('bgstars.h5').query('m_ini > 0.11')
# Sanitize dtypes of targets DataFrame
for c in targets.columns:
if targets[c].dtype == object:
targets.loc[:,c] = targets.loc[:,c].astype(str)
pop = TRILEGAL_BGBinaryPopulation(targets, bgstars)
import logging
rootLogger = logging.getLogger()
In [2]:
pop = TRILEGAL_BGBinaryPopulation(targets.sample(1000), bgstars.sample(1000), fB=1)
In [3]:
rB = pop.radius_B
In [4]:
rootLogger.setLevel(logging.INFO)
pop._train_trap(N=200);
rootLogger.setLevel(logging.DEBUG)
In [5]:
obs = pop.observe(regr_trap=True)
In [6]:
pop.save('test', overwrite=True)
In [7]:
import cPickle as pickle
pickle.dump(pop, open('test.pkl', 'wb'))
In [8]:
pop = pickle.load(open('test.pkl', 'rb'))
In [9]:
print(pop.params['fB'])
pop._generate_binaries()
pop.params['fB']
Out[9]:
In [10]:
pop.radius_B[:10]
Out[10]:
In [11]:
rB[:10]
Out[11]:
In [2]:
%matplotlib inline
rootLogger.setLevel(logging.INFO)
pop._train_pipelines(n_jobs=8, plot=True)
pop._train_trap(N=1000, plot=True);
In [4]:
from copy import deepcopy
pop2 = deepcopy(pop)
In [5]:
pop._generate_binaries()
pop2._generate_binaries(use_ic=True)
In [8]:
import matplotlib.pyplot as plt
import numpy as np
ok = np.isfinite(pop.stars.radius_B)
plt.plot(pop.stars.mass_B[ok], np.log10(pop.stars.radius_B[ok]), 'o', ms=1, mew=1)
ok = np.isfinite(pop2.stars.radius_B)
plt.figure()
plt.plot(pop2.stars.mass_B[ok], np.log10(pop2.stars.radius_B[ok]), 'o', ms=1, mew=1)
Out[8]:
In [7]:
pop.stars.query('radius_B == -100')[['mass_A', 'radius_A', 'mass_B', 'radius_B']]
Out[7]:
In [3]:
obs_pop = pop.get_N_observed(N=5000, new_orbits=True, query='T14_pri < 2 or T14_sec < 2')
In [4]:
obs_pop.trap_corner(range=[(0,0.8), (-5,0), (2,10)]);
In [5]:
pop.save('bgpop', overwrite=True)
In [6]:
pop = TRILEGAL_BGBinaryPopulation.load('bgpop')
In [7]:
obs = pop.observe(regr_trap=True)
In [9]:
rootLogger.setLevel(logging.INFO)
%timeit pop.observe(new=True, use_ic=True, regr_trap=True)
In [10]:
%matplotlib inline
import matplotlib.pyplot as plt
obs = pop.observe(new=True)
plt.hist(obs.b_target.values, bins=20);
plt.xlabel('Galactic Latitude')
plt.ylabel('N');
In [ ]: