Planck Model¶
- class rapoc.Planck(input_data)[source]¶
Planck model class. This class implements the Planck Opacity model:
\[k = \frac{\int_{\nu_1}^{\nu_2} k_{\nu} B_\nu(T) d\nu} {\int_{\nu_1}^{\nu_2} B_\nu(T) d\nu}\]where \(\nu_1\) and \(\nu_2\) are the investigated frequency band edges, \(k_{\nu}\) is the input data opacity at a given frequency, and \(B_\nu(T)\) is the black body radiation energy distribution computed at a certain temperature:
\[B_\nu(T) = \frac{2h \nu^3}{c^2} \frac{1}{e^{\frac{h\nu}{k_B T}-1}}\]- Variables:
input_data (str or dict) – data file name or data dictionary
model_name (str) – model name
band (tuple) – investigated band. Is initialised only after the use of
map()
selected_grid (astropy.units.Quantity) – investigated grid. Is initialised only after the use of
map()
mol (str) – molecule name
mol_mass (astropy.units.Quantity) – molecular mass
pressure_grid (astropy.units.Quantity) – data pressure grid in si units
temperature_grid (astropy.units.Quantity) – data temperature grid in si units
wavenumber_grid (astropy.units.Quantity) – data wavenumber grid
opacities (astropy.units.Quantity) – data opacities grid in si units
frequency_grid (astropy.units.Quantity) – data frequency grid
wavelength_grid (astropy.units.Quantity) – data wavelength grid
- Parameters:
input_data (str or dict) – data file name or input_data dictionary. If the input is a str, the correspondent loader is used (
ExoMolFileLoader
) if the file format is supported. If is dict, thenDictLoader
is used.- Raises:
IOError – if data format is not supported:
Examples
First we prepare a data dictionary:
>>> import numpy as np >>> data_dict = {'mol': 'H2O', >>> 'pressure': np.array([1.00000000e+00, 1.00000000e+01, 1.00000000e+02, 1.00000000e+03, >>> 1.00000000e+04, 1.00000000e+05, 1.00000000e+06, 1.00000000e+07]), >>> 'temperature': np.array([500, 1000, 1500, 2000, 3000]), >>> 'wavenumber': np.array([100000, 1000])} >>> ktab = np.ones((data_dict['pressure'].size,data_dict['temperature'].size,data_dict['wavenumber'].size,)) >>> data_dict['opacities'] = ktab
Let’s build the Planck method using an Exomol file as input
>>> from rapoc import Planck >>> dict_data = 'example.TauREx.h5' >>> model = Planck(input_data=data_dict)
Now the model is ready to be used
- opacity_model(opacities, nu, T_input)[source]¶
This function computes the Planck Opacity model:
\[k = \frac{\int_{\nu_1}^{\nu_2} k_{\nu} B_\nu(T) d\nu} {\int_{\nu_1}^{\nu_2} B_\nu(T) d\nu}\]where \(\nu_1\) and \(\nu_2\) are the investigated frequency band edges, \(k_{\nu}\) is the input data opacity at a given frequency, and \(B_\nu(T)\) is the black body radiation energy distribution computed at a certain temperature:
\[B_\nu(T) = \frac{2h \nu^3}{c^2} \frac{1}{e^{\frac{h\nu}{k_B T}-1}}\]- Parameters:
opacities (np.array) – opacity array. Has the same dimension of the frequency grid nu
nu (np.array) – frequency grid
T_input (float) – temperature
- Returns:
mean opacity computed from the model
- Return type:
float