WARNING:
"fitting_parameters.h5" need to be in the directory you are working on or there will be an error for importing mr_forecast in the next cell.
If you don't want the file in this directory, change the mr_forecast.py line 16
hyper_file = 'fitting_parameters.h5'
->
hyper_file = [directory of fitting parameter file]+'fitting_parameters.h5'
In [18]:
import numpy as np
import mr_forecast as mr
import matplotlib.pyplot as plt
%matplotlib inline
================================
predict the mean and std of radius given those of the mass
In [19]:
Rmedian, Rplus, Rminus = mr.Mstat2R(mean=1.0, std=0.1, unit='Earth', sample_size=100, classify='Yes')
In [20]:
print 'R = %.2f (+ %.2f - %.2f) REarth' % (Rmedian, Rplus, Rminus)
================================
predict a vector of radius given a vector of mass
In [21]:
M1 = np.loadtxt('demo_mass.dat')
R1 = mr.Mpost2R(M1, unit='Earth', classify='Yes')
In [22]:
plt.plot(np.log10(M1), np.log10(R1), 'bx')
plt.xlabel(r'$log_{10}\ M/M_{\oplus}$')
plt.ylabel(r'$log_{10}\ R/R_{\oplus}$')
plt.show()
================================
predict the mean and std of mass given those of the radius
In [23]:
Mmedian, Mplus, Mminus = mr.Rstat2M(mean=0.1, std=0.01, unit='Jupiter', sample_size=100, grid_size=1e3, classify='Yes')
In [24]:
print 'M = %.3f (+ %.3f - %.3f) MEarth' % (Mmedian, Mplus, Mminus)
================================
predict a vector of mass given a vector of radius
In [25]:
R2 = np.loadtxt('demo_radius.dat')
M2 = mr.Rpost2M(R2, unit='Earth', grid_size=1e3, classify='Yes')
In [26]:
plt.hist(np.log10(M2))
plt.xlabel(r'$log_{10}\ M/M_{\odot}$')
plt.show()
In [ ]: