Study and projects
SimulationStudy
- class astrophysix.simdm.SimulationStudy(project=None)
HDF5 simulation study file for Project tree structure persistency
- Parameters:
project (
Project
) – study main project
- property creation_time
Study creation date/time (
datetime.datetime
).
- property last_modification_time
Study last modification date/time (
datetime.datetime
).
- classmethod load_HDF5(study_file_path)
Loads a new or existing SimulationStudy from a HDF5 (*.h5) file
- Parameters:
study_file_path (
string
) – SimulationStudy HDF5 (existing) file path- Returns:
study – Study loaded from HDF5 file.
- Return type:
- property project
Study main project
- save_HDF5(study_fname=None, dry_run=False, callback=None, galactica_checks=False)
Save the SimulationStudy into a HDF5 (*.h5) file
- Parameters:
study_fname (
string
) – Simulation study HDF5 filename.dry_run (
bool
) – perform a dry run ? Default False.callback (
callable
) – method to execute upon saving each item of the study.galactica_checks (
bool
) – Perform Galactica database validity checks and display warning in case of invalid content for upload on Galactica. Default False (quiet mode).
- property study_filepath
Simulation study HDF5 file path
- property uid
Study UUID
Project and ProjectCategory
- class astrophysix.simdm.ProjectCategory(value)
Project category enum
Example
>>> cat = ProjectCategory.PlanetaryAtmospheres >>> cat.verbose_name "Planetary atmospheres"
- Cosmology = ('COSMOLOGY', 'Cosmology')
- GalacticDynamics = ('GALAXIES', 'Galactic dynamics')
- HighEnergyAstrophysics = ('HIGH_ENERGY', 'High-energy astrophysics')
- InterstellarMedium = ('ISM', 'Interstellar medium')
- Magnetohydrodynamics = ('MHD', 'Magnetohydrodynamics')
- PlanetaryAtmospheres = ('PLANET_ATMO', 'Planetary atmospheres')
- SolarPhysics = ('SOLAR_PHYSICS', 'Solar Physics')
- StarFormation = ('STAR_FORM', 'Star formation')
- StarPlanetInteractions = ('STAR_PLANET_INT', 'Star-planet interactions')
- StellarEnvironments = ('STELLAR_ENVS', 'Stellar environments')
- StellarPhysics = ('STELLAR_PHYSICS', 'Stellar physics')
- Supernovae = ('SUPERNOVAE', 'Supernovae')
- property alias
Project category alias
- classmethod from_alias(alias)
- Parameters:
alias (
string
) – project category alias- Returns:
c – Project category matching the requested alias.
- Return type:
- Raises:
ValueError – if requested alias does not match any project category.
Example
>>> c = ProjectCategory.from_alias("STAR_FORM") >>> c.verbose_name "Star formation" >>> c2 = ProjectCategory.from_alias("MY_UNKNOWN_CATEGORY") ValuerError: No ProjectCategory defined with the alias 'MY_UNKNOWN_CATEGORY'.
- property verbose_name
Project category verbose name
- class astrophysix.simdm.Project(*args, **kwargs)
Numerical study project (Simulation data model)
- Parameters:
category (
ProjectCategory
orstring
) – project category or project category alias (mandatory)project_title (
string
) – project title (mandatory)alias (
string
) – Project alias (if defined, 16 max characters is recommended)short_description (
string
) – project short descriptiongeneral_description (
string
) – (long) project descriptiondata_description (
string
) – available data description in the projectacknowledgement (
string
) – Project acknowledgement text. describes how to acknowledge the work presented in this project in any publication.directory_path (
string
) – project directory paththumbnail_image (
string
orImageFile
) – project image thumbnail for fancy display on the Galactica simulation database.
Example
>>> # Define a new project >>> proj = Project(project_title="My M51 galaxy interaction model", category=ProjectCategory.GalaxyMergers, ... alias="M51_SIM2022", short_description="M51 interacting galaxy model at 10 pc scale with" ... "low-efficiency star formation", general_description=gen_descr, data_description=data_descr, ... directory_path="/raid/data/PROJS/M51_M/", thumbnail_image="~/Pictures/M51_M/thumb_M51.png", ... acknowledgement="Please cite Bournaud et al. 2022 (in prep.) if you use data from this project.") >>> >>> # Set the project in a study >>> study = SimulationStudy(project=proj)
- __unicode__()
String representation of the instance
- property acknowledgement
How to acknowledge this project.
New in version 0.5.0.
- property alias
Project alias
- property category
ProjectCategory
orProjectCategory.alias
(string
). Can be edited.
- property data_description
Data description available in this project
- property directory_path
Project data directory path
- galactica_validity_check(**kwargs)
Perform validity checks on this instance and eventually log warning messages.
- Parameters:
kwargs (dict) – keyword arguments (optional)
- property general_description
General description of the project
- property project_title
Project title
- property short_description
Short description of the project
- property simu_datatable_params
List of
InputParameter
objects coming from the projectSimulation
associatedSimulationCode
. These input parameters can be used in parametric studies to display the project simulations in a datatable (instead of a list) on the Galactica project page, (ObjectList
)New in version 0.7.0.
Example
>>> proj = Project(category="COSMOLOGY", project_title="Reionisation of the universe", ... alias="REIO_4") >>> ramses = protocol.SimulationCode(name="Ramses 3.0 (Hydro)", code_name="RAMSES", alias="RAMSES_CODE") >>> # Add input parameters >>> dx_min = InputParameter(key="max_res", name="dx_min", ... description="min. spatial resolution") >>> ramses.input_parameters.add(dx_min) >>> used_mhd_solver = InputParameter(key="with_mhd", name="MHD solver used", ... description="Pure hydro or MHD run ?") >>> ramses.input_parameters.add(used_mhd_solver) >>> >>> # Define parameter settings >>> dx_min_lores = ParameterSetting(input_param=dx_min, value=100.0, unit=U.kpc) >>> dx_min_hires = ParameterSetting(input_param=dx_min, value=10.0, unit=U.kpc) >>> use_hydro = ParameterSetting(input_param=used_mhd_solver, value=False) >>> use_mhd = ParameterSetting(input_param=used_mhd_solver, value=True) >>> >>> # Add simulations with defined parameter settings in project >>> simu_hydro_lores = experiment.Simulation(ramses, name="My simu low-res (hydro)", ... alias="SIMU_HYDRO_LOW", execution_time=exe_time) >>> simu_hydro_lores.parameter_settings.add(dx_min_lores) >>> simu_hydro_lores.parameter_settings.add(use_hydro) >>> proj.simulations.add(simu_hydro_lores) >>> >>> simu_hydro_hires = experiment.Simulation(ramses, name="My simu high-res (hydro)", ... alias="SIMU_HYDRO_HIGH", execution_time=exe_time)) >>> simu_hydro_hires.parameter_settings.add(dx_min_hires) >>> simu_hydro_hires.parameter_settings.add(use_hydro) >>> proj.simulations.add(simu_hydro_hires) >>> >>> simu_mhd_lores = experiment.Simulation(ramses, name="My simu low-res (MHD)", ... alias="SIMU_MHD_LOW", execution_time=exe_time) >>> simu_mhd_lores.parameter_settings.add(dx_min_lores) >>> simu_mhd_lores.parameter_settings.add(use_mhd) >>> proj.simulations.add(simu_mhd_lores) >>> >>> simu_mhd_hires = experiment.Simulation(ramses, name="My simu high-res (MHD)", ... alias="SIMU_MHD_HIGH", execution_time=exe_time) >>> simu_mhd_hires.parameter_settings.add(dx_min_hires) >>> simu_mhd_hires.parameter_settings.add(use_mhd) >>> proj.simulations.add(simu_mhd_hires) >>> >>> # Add input parameters in project simulation datatable parameter list >>> proj.simu_datatable_params.add(dx_min) >>> proj.simu_datatable_params.add(used_mhd_solver)
- property simulations
Project
Simulation
list (ObjectList
)
- property thumbnail_image
Thumbnail image for the project