tardis.montecarlo.base module

class tardis.montecarlo.base.MontecarloRunner(*args, **kwargs)[source]

Bases: tardis.io.util.HDFWriterMixin

This class is designed as an interface between the Python part and the montecarlo C-part

calculate_emitted_luminosity(luminosity_nu_start, luminosity_nu_end)[source]

Calculate emitted luminosity.

Parameters
luminosity_nu_startastropy.units.Quantity
luminosity_nu_endastropy.units.Quantity
Returns
astropy.units.Quantity
calculate_f_lambda(wavelength)[source]
calculate_f_nu(frequency)[source]
calculate_luminosity_inner(model)[source]

Calculate inner luminosity.

Parameters
modelmodel.Radial1DModel
Returns
astropy.units.Quantity
calculate_radiationfield_properties()[source]

Calculate an updated radiation field from the :math: bar{nu}_textrm{estimator} and \(\J_\textrm{estimator}\) calculated in the montecarlo simulation. The details of the calculation can be found in the documentation.

Parameters
nubar_estimatornp.ndarray (float)
j_estimatornp.ndarray (float)
Returns
t_radastropy.units.Quantity (float)
wnumpy.ndarray (float)
calculate_reabsorbed_luminosity(luminosity_nu_start, luminosity_nu_end)[source]

Calculate reabsorbed luminosity.

Parameters
luminosity_nu_startastropy.units.Quantity
luminosity_nu_endastropy.units.Quantity
Returns
astropy.units.Quantity
calculate_time_of_simulation(model)[source]

Calculate time of montecarlo simulation.

Parameters
modelmodel.Radial1DModel
Returns
float
property emitted_packet_luminosity
property emitted_packet_mask
property emitted_packet_nu
classmethod from_config(config, packet_source=None, virtual_packet_logging=False)[source]

Create a new MontecarloRunner instance from a Configuration object.

Parameters
configtardis.io.config_reader.Configuration
virtual_packet_loggingbool
Returns
MontecarloRunner
get_line_interaction_id(line_interaction_type)[source]
hdf_name = 'runner'
hdf_properties = ['output_nu', 'output_energy', 'nu_bar_estimator', 'j_estimator', 'montecarlo_virtual_luminosity', 'last_interaction_in_nu', 'last_interaction_type', 'last_line_interaction_in_id', 'last_line_interaction_out_id', 'last_line_interaction_shell_id', 'packet_luminosity', 'spectrum', 'spectrum_virtual', 'spectrum_reabsorbed', 'time_of_simulation', 'emitted_packet_mask']
property integrator
legacy_return()[source]
property montecarlo_emitted_luminosity
property montecarlo_reabsorbed_luminosity
property montecarlo_virtual_luminosity
property output_energy
property output_nu
property packet_luminosity
property reabsorbed_packet_luminosity
property reabsorbed_packet_nu
run(model, plasma, no_of_packets, no_of_virtual_packets=0, nthreads=1, last_run=False, iteration=0)[source]

Run the montecarlo calculation

Parameters
modeltardis.model.Radial1DModel
plasmatardis.plasma.BasePlasma
no_of_packetsint
no_of_virtual_packetsint
nthreadsint
last_runbool
Returns
None
property spectrum
property spectrum_integrated
property spectrum_reabsorbed
property spectrum_virtual
t_rad_estimator_constant = 1.2523371456060662e-11
property virtual_packet_energy
property virtual_packet_luminosity
property virtual_packet_nu
vpacket_hdf_properties = ['virt_packet_last_interaction_in_nu', 'virt_packet_last_interaction_type', 'virt_packet_last_line_interaction_in_id', 'virt_packet_last_line_interaction_out_id', 'virt_packet_nus', 'virt_packet_energies']
w_estimator_constant = 4408.881331783647