-
-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* restructure of geometry * add radial1d boundary logic * black format * several fixes * fix epsilon * add testing of boundaries * change the r_inner_active * first integration with `from_config` working * hunting down density indexing bug * all model tests (without csvy) pass * more fixes * fix of model to simulation_state * fix inner boundary packet error * fix some leftovers * final fix for csvy * blackify * restructure to readers and remove some leftover code * further cleanup * first start of the restructure * add comment about removing quantitiness * add velocity check * add new abundance functions * remove default units * add new matter module * several restructures. move decay from io to tardis/model/matter * mid restructure * slow progress on abundance refactor * include effective_element_masses * further updates * fix of csvy readers * last fixes to custom abundance widget * restructuring the radiation field * some cleanup * cleanup * further cleanup * clearnup * changes * remove matter base.py * removing matter * fixed last tests * add several parsers * add composition * remove isotopemassfractions * some small fixes * fixed w, t_rad to dilution_factor, t_radiative * add setters for w, t_rad * several fixes for instantiating the right t_rads. also ensuring that they are positive and len(t_rad) == dilution factor * add the from_config atom_data * fixing model.ipynb * fix some more tests * fix tests * fix some of the issues wdigets * assert mass fractions positive. Change IsotopeAbundances to Massfractions * add radiation_field_state * Fix isotope mass fraction typo and t_radiatve duplicate definition * Document remove functionality for effective element masses * Fix variable name in convert_to_nuclide_mass_fraction function * Refactor test names and variable names in test_base.py * Refactor gamma ray simulation setup and test functions * fix gamma ray tests * Add model_isotope_time_0 property to abundances schema * Add test for montecarlo main loop with vpacket tracking * Refactor config_reader and config_validator modules * Fix model_isotope_time_0 property in model_definitions.yml * Refactor simulation module to use pathlib * remove bad comment and refactor with ruff * Fix variable name in test_simulation_state_mass() function * Fix unit conversion in calculate_cell_masses function * Fix logger debug message in CSV reader and update method names in Composition class * black formatting * Refactor code to use composition variable in test_gamma_ray_transport.py * Refactor imports in atom_web_download.py and update return statement in config_internal.py * fix for documentation not builiding * add fix for model_isotope_time_0 * fix grid test * restructure the grid * final change * add stuff * add vpacket_log * Refactor model_reader.py and shell_info.py changing w to dilution_factor * Update damping constants and variable names in doc notebook * fix w in several places in tardis * slowly fixing radiation_field changes * last fix * change hdf from model to simulation_state * fixing model->simulation-state * Fix model_reader.py imports and formatting issues * Refactor variable names for clarity and consistency and being correct * Update variable names in model.ipynb * Update variable name for average temperature calculation * Refactor variable names in model reader and simulation base * Refactor store_model_to_hdf to store_simulation_state_to_hdf * Refactor HDF file handling and model reader imports * add docstr
- Loading branch information
1 parent
b68e542
commit df439d8
Showing
19 changed files
with
633 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,28 @@ | ||
from tardis.io.model.model_reader import simulation_state_to_dict | ||
|
||
|
||
import h5py | ||
|
||
from tardis.io.model.model_reader import simulation_state_to_dict | ||
|
||
|
||
def store_model_to_hdf(model, fname): | ||
def store_simulation_state_to_hdf(simulation_state, fname): | ||
""" | ||
Stores data from SimulationState object into a hdf file. | ||
Parameters | ||
---------- | ||
model : tardis.model.SimulationState | ||
filename : str | ||
simulation_state : tardis.model.SimulationState | ||
fname : str | ||
""" | ||
with h5py.File(fname, "a") as f: | ||
model_group = f.require_group("model") | ||
model_group.clear() | ||
simulation_state_group = f.require_group("simulation_state") | ||
simulation_state_group.clear() | ||
|
||
model_dict = simulation_state_to_dict(model) | ||
simulation_state_dict = simulation_state_to_dict(simulation_state) | ||
|
||
for key, value in model_dict.items(): | ||
for key, value in simulation_state_dict.items(): | ||
if key.endswith("_cgs"): | ||
model_group.create_dataset(key, data=value[0]) | ||
model_group.create_dataset(key + "_unit", data=value[1]) | ||
simulation_state_group.create_dataset(key, data=value[0]) | ||
simulation_state_group.create_dataset( | ||
key + "_unit", data=value[1] | ||
) | ||
else: | ||
model_group.create_dataset(key, data=value) | ||
simulation_state_group.create_dataset(key, data=value) |
Oops, something went wrong.