def from_abundance(cls, abundance_dict, density, atom_data, time_explosion, nlte_config=None, saha_treatment='lte'): """ Initializing the abundances from the a dictionary like {'Si':0.5, 'Fe':0.5} and a density. All other parameters are the same as the normal initializer Parameters ---------- abundance_dict : `~dict` A dictionary with the abundances for each element, e.g. {'Fe':0.5, 'Ni':0.5} density : `~float` density in g/cm^3 Returns ------- `Baseplasma` object """ abundance_series = parse_abundance_dict_to_dataframe(abundance_dict, atom_data) abundances = pd.DataFrame({0:abundance_series}) number_densities = abundances * density.to('g/cm^3').value number_densities = number_densities.div(atom_data.atom_data.mass.ix[number_densities.index], axis=0) atom_data.prepare_atom_data(number_densities.index.values) return cls(number_densities, atom_data, time_explosion.to('s').value, nlte_config=nlte_config, saha_treatment=saha_treatment)
def setup(self): atom_data = atomic.AtomData.from_hdf5(helium_test_db) density = 1e-15 * u.Unit("g/cm3") abundance = parse_abundance_dict_to_dataframe({"He": 1.0}) abundance = pd.DataFrame({0: abundance}) number_densities = abundance * density.to("g/cm^3").value number_densities = number_densities.div(atom_data.atom_data.mass.ix[number_densities.index], axis=0) self.plasma = LegacyPlasmaArray( number_densities, atomic_data=atom_data, time_explosion=10 * u.day, ionization_mode="nebular" )
def setup(self): atom_data = atomic.AtomData.from_hdf5(helium_test_db) density = 1e-15 * u.Unit('g/cm3') abundance = parse_abundance_dict_to_dataframe({'He':1.0}) abundance = pd.DataFrame({0:abundance}) number_densities = abundance * density.to('g/cm^3').value number_densities = number_densities.div( atom_data.atom_data.mass.ix[number_densities.index], axis=0) self.plasma = LegacyPlasmaArray(number_densities, atomic_data=atom_data, time_explosion=10 * u.day, ionization_mode='nebular')
def setup(self): atom_data = atomic.AtomData.from_hdf5(helium_test_db) density = 1e-15 * u.Unit('g/cm3') abundance = parse_abundance_dict_to_dataframe({'He': 1.0}) abundance = pd.DataFrame({0: abundance}) atom_data.prepare_atom_data([2]) # FIXME: hardcoded, bad number_densities = abundance * density.to('g/cm^3').value number_densities = number_densities.div( atom_data.atom_data.mass.ix[number_densities.index], axis=0) self.plasma = LegacyPlasmaArray( number_densities, atomic_data=atom_data, time_explosion=10 * u.day, ionization_mode='nebular')
def from_abundance(cls, abundance_dict, density, atom_data, time_explosion, nlte_config=None, ionization_mode='lte', excitation_mode='lte'): """ Initializing the abundances from the a dictionary like {'Si':0.5, 'Fe':0.5} and a density. All other parameters are the same as the normal initializer Parameters ---------- abundance_dict : `~dict` A dictionary with the abundances for each element, e.g. {'Fe':0.5, 'Ni':0.5} density : `~float` density in g/cm^3 Returns ------- `Baseplasma` object """ abundance_series = parse_abundance_dict_to_dataframe(abundance_dict) abundances = pd.DataFrame({0:abundance_series}) number_densities = abundances * density.to('g/cm^3').value number_densities = number_densities.div(atom_data.atom_data.mass.ix[number_densities.index], axis=0) if nlte_config is not None: nlte_species = nlte_config.species else: nlte_species = [] atom_data.prepare_atom_data(number_densities.index.values, nlte_species=nlte_species) return cls(number_densities, atom_data, time_explosion.to('s').value, nlte_config=nlte_config, ionization_mode=ionization_mode, excitation_mode=excitation_mode)