def run_tardis(configuration_dict, atom_data=None): """ This function is one of the core functions to run TARDIS from a given config object. It will return a model object containing Parameters ---------- configuration_dict: ~dict atom_data: ~tardis.atomic.AtomData Atomic data to use for this TARDIS simulation. If set to None, the atomic data will be loaded according to keywords set in the configuration [default=None] """ tardis_config = config_reader.Configuration.from_config_dict( configuration_dict, atom_data=atom_data) radial1d_mdl = model.Radial1DModel(tardis_config) simulation.run_radial1d(radial1d_mdl) return radial1d_mdl
def setup(self): self.atom_data_filename = pytest.config.getvalue("atomic-dataset") assert os.path.exists(self.atom_data_filename) self.config_yaml = yaml.load(open("tardis/io/tests/data/tardis_configv1_verysimple.yml")) self.config_yaml["atom_data"] = self.atom_data_filename self.config = TARDISConfiguration.from_config_dict(self.config_yaml) self.model = model.Radial1DModel(self.config) simulation.run_radial1d(self.model)
def setup(self): self.atom_data_filename = os.path.expanduser(os.path.expandvars( pytest.config.getvalue('atomic-dataset'))) assert os.path.exists(self.atom_data_filename), ("{0} atomic datafiles " "does not seem to " "exist".format( self.atom_data_filename)) self.config_yaml = yaml.load(open('tardis/io/tests/data/tardis_configv1_verysimple.yml')) self.config_yaml['atom_data'] = self.atom_data_filename self.config = Configuration.from_config_dict(self.config_yaml) self.model = model.Radial1DModel(self.config) simulation.run_radial1d(self.model)
def evaluate(self, *args, **kwargs): config = self._get_config_from_args(args) radial1d_mdl = model.Radial1DModel(config) simulation.run_radial1d(radial1d_mdl) runner = radial1d_mdl.runner param_names = ['t_inner'] param_values = [radial1d_mdl.t_inner] self.mdl = radial1d_mdl return (runner.emitted_packet_nu, runner.emitted_packet_luminosity, runner.virt_packet_nus * u.Hz, (runner.virt_packet_energies / runner.time_of_simulation), param_names, param_values)
def run_tardis(config, atom_data=None): """ This function is one of the core functions to run TARDIS from a given config object. It will return a model object containing Parameters ---------- config: ~str or ~dict filename of configuration yaml file or dictionary atom_data: ~str or ~tardis.atomic.AtomData if atom_data is a string it is interpreted as a path to a file storing the atomic data. Atomic data to use for this TARDIS simulation. If set to None, the atomic data will be loaded according to keywords set in the configuration [default=None] """ import yaml from tardis.io import config_reader from tardis import model, simulation, atomic import os try: config_dict = yaml.load(open(config)) config_dirname = os.path.dirname(config) except TypeError: config_dict = config config_dirname = '' if atom_data is not None: try: atom_data = atomic.AtomData.from_hdf5(atom_data) except TypeError: atom_data = atom_data tardis_config = config_reader.Configuration.from_config_dict( config_dict, atom_data=atom_data, config_dirname=config_dirname) radial1d_mdl = model.Radial1DModel(tardis_config) simulation.run_radial1d(radial1d_mdl) return radial1d_mdl
def run_tardis(config, atom_data=None): """ This function is one of the core functions to run TARDIS from a given config object. It will return a model object containing Parameters ---------- config: ~str or ~dict filename of configuration yaml file or dictionary atom_data: ~str or ~tardis.atomic.AtomData if atom_data is a string it is interpreted as a path to a file storing the atomic data. Atomic data to use for this TARDIS simulation. If set to None, the atomic data will be loaded according to keywords set in the configuration [default=None] """ import yaml from tardis.io import config_reader from tardis import model, simulation, atomic try: config_dict = yaml.load(open(config)) except TypeError: config_dict = config if atom_data is not None: try: atom_data = atomic.AtomData.from_hdf5(atom_data) except TypeError: atom_data = atom_data tardis_config = config_reader.Configuration.from_config_dict( config_dict, atom_data=atom_data) radial1d_mdl = model.Radial1DModel(tardis_config) simulation.run_radial1d(radial1d_mdl) return radial1d_mdl
def run_tardis(self, config): mdl = Radial1DModel(config) run_radial1d(mdl) return mdl