<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 WARNING
Step1:  ================================
predict the mean and std of radius given those of the mass
Step2:  ================================
predict a vector of radius given a vector of mass
Step3:  ================================
predict the mean and std of mass given those of the radius
Step4:  ================================
predict a vector of mass given a vector of radius
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import mr_forecast as mr
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: 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'
End of explanation
Rmedian, Rplus, Rminus = mr.Mstat2R(mean=1.0, std=0.1, unit='Earth', sample_size=100, classify='Yes')
print 'R = %.2f (+ %.2f - %.2f) REarth' % (Rmedian, Rplus, Rminus)
Explanation: ================================
predict the mean and std of radius given those of the mass
End of explanation
M1 = np.loadtxt('demo_mass.dat')
R1 = mr.Mpost2R(M1, unit='Earth', classify='Yes')
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()
Explanation: ================================
predict a vector of radius given a vector of mass
End of explanation
Mmedian, Mplus, Mminus = mr.Rstat2M(mean=0.1, std=0.01, unit='Jupiter', sample_size=100, grid_size=1e3, classify='Yes')
print 'M = %.3f (+ %.3f - %.3f) MEarth' % (Mmedian, Mplus, Mminus)
Explanation: ================================
predict the mean and std of mass given those of the radius
End of explanation
R2 = np.loadtxt('demo_radius.dat')
M2 = mr.Rpost2M(R2, unit='Earth', grid_size=1e3, classify='Yes')
plt.hist(np.log10(M2))
plt.xlabel(r'$log_{10}\ M/M_{\odot}$')
plt.show()
Explanation: ================================
predict a vector of mass given a vector of radius
End of explanation
<END_TASK>