tardis.simulation.base module¶
- class tardis.simulation.base.PlasmaStateStorerMixin(iterations, no_of_shells)[source]¶
- Bases: - object- Mixin class to provide the capability to the simulation object of storing plasma information and the inner boundary temperature during each MC iteration. - Currently, storage for the dilution factor, the radiation temperature and the electron density in each cell is provided. Additionally, the temperature at the inner boundary is saved. - reshape_plasma_state_store(executed_iterations)[source]¶
- Reshapes the storage arrays in case convergence was reached before all specified iterations were executed. - Parameters
- executed_iterationsint
- iteration index, i.e. number of iterations executed minus one! 
 
 
 - store_plasma_state(i, w, t_rad, electron_densities, t_inner)[source]¶
- Store current plasma information and inner boundary temperature used in iterated i. - Parameters
- iint
- current iteration index (0 for the first) 
- wnp.ndarray
- dilution factor 
- t_radastropy.units.Quantity
- radiation temperature 
- electron_densitiesnp.ndarray
- electron density 
- t_innerastropy.units.Quantity
- temperature of inner boundary 
 
 
 
- class tardis.simulation.base.Simulation(*args, **kwargs)[source]¶
- Bases: - tardis.simulation.base.PlasmaStateStorerMixin,- tardis.io.util.HDFWriterMixin- A composite object containing all the required information for a simulation. - Parameters
- convergedbool
- iterationsint
- modeltardis.model.Radial1DModel
- plasmatardis.plasma.BasePlasma
- runnertardis.montecarlo.MontecarloRunner
- no_of_packetsint
- last_no_of_packetsint
- no_of_virtual_packetsint
- luminosity_nu_startastropy.units.Quantity
- luminosity_nu_endastropy.units.Quantity
- luminosity_requestedastropy.units.Quantity
- convergence_plots_kwargs: dict
- nthreadsint
- The number of threads to run montecarlo with - Note - TARDIS must be built with OpenMP support in order for - nthreadsto have effect.
 
 - add_callback(cb_func, *args)[source]¶
- Add a function which will be called after every iteration. - The cb_func signature must look like: cb_func(simulation, extra_arg1, …) - Parameters
- cb_funccallable
- The callback function 
- arg1 :
- The first additional arguments passed to the callable function 
- …
 
- Returns
- : int
- The callback ID 
 
 
 - advance_state()[source]¶
- Advances the state of the model and the plasma for the next iteration of the simulation. Returns True if the convergence criteria are met, else False. - Returns
- convergedbool
 
 
 - classmethod from_config(config, packet_source=None, virtual_packet_logging=False, show_convergence_plots=True, show_progress_bars=True, **kwargs)[source]¶
- Create a new Simulation instance from a Configuration object. - Parameters
- configtardis.io.config_reader.Configuration
- **kwargs
- Allow overriding some structures, such as model, plasma, atomic data and the runner, instead of creating them from the configuration object. 
 
- Returns
- Simulation
 
 
 - hdf_name = 'simulation'¶
 - hdf_properties = ['model', 'plasma', 'runner', 'iterations_w', 'iterations_t_rad', 'iterations_electron_densities', 'iterations_t_inner']¶
 - log_plasma_state(t_rad, w, t_inner, next_t_rad, next_w, next_t_inner, log_sampling=5)[source]¶
- Logging the change of the plasma state - Parameters
- t_radastropy.units.Quanity
- current t_rad 
- wastropy.units.Quanity
- current w 
- next_t_radastropy.units.Quanity
- next t_rad 
- next_wastropy.units.Quanity
- next_w 
- log_samplingint
- the n-th shells to be plotted