Automatic construction of file paths (Simulation class)¶
The paths to the various simulation files can be constructed automatically, as long as the the internal file structure is mirrored from the data repository (which is automatically the case for data downloaded with the download tool). For this, the library provides the Simulation class.
It is instantiated by specifying the particular simulation run for which to create file paths. Simulation-wide file paths are set directly during instantiation and are available as attributes:
| Attribute | Meaning |
|---|---|
run_dir |
Base directory of the simulation |
high_level_dir |
Directory containing high-level catalogues |
fgt_loc |
File containing pre-compiled galaxy evolution tables |
gps_loc |
File containing galaxy positions and velocities in all snapshots |
galaxy_path_loc |
File containing approximate galaxy positions and velocities in all outputs (including snipshots) |
spider_loc |
File containing the SpiderWeb tables, which connect
subhaloes in different snapshots to galaxies. |
sh_extra_loc |
File containing extra subhalo-level information, beyond what is available in the Subfind catalogue |
interpolation_loc |
File containing finely interpolated orbits for all reasonably massive galaxies |
For more information on these files and their content, please refer to the data content section of the Hydrangea/C-EAGLE simulation website.
Examples¶
To work with the Hydrangea version of CE-8 (including baryons, and assuming the local data repository has its root at /data/repository/base/; the base_dir keyword can be ommitted if the base directory has been set during the installation):
sim = hydrangea.Simulation(8, base_dir='/data/repository/base/')
Now form the location of the galaxy tables, and the first file of the snapshot 29 particle catalogue:
galaxy_tables_file = sim.fgt_loc
snapshot_29 = sim.get_snapshot_file(29)
For the non-Hydrangea version of the same cluster:
sim = hydrangea.Simulation(8, base_dir='/data/repository/base', suite_name='5r200')
For the DM-only version of CE-1 (Hydrangea), DM-only:
sim_dm = hydrangea.Simulation(1, base_dir='/data/repository/base', sim_type='DM')
Some more use cases are provided by the demonstration scripts in the examples directory.
Reference¶
hydrangea.Simulation: Instantiate the class
Simulation-wide paths¶
- See table above for attributes containing simulation-wide paths.
Construct output-specific file names¶
hydrangea.Simulation.get_snapshot_file(): Form a file from a snapshot cataloguehydrangea.Simulation.get_snipshot_file(): Form a file from a snipshot cataloguehydrangea.Simulation.get_subfind_file(): Form a file from a subfind catalogue
-
class
hydrangea.Simulation(index=None, run_dir=None, base_dir=None, sim_type='Hydro', suite_name='10r200')¶ Representation of one simulation, for path handling.
Parameters: - index (int or None, optional) – The index of the simulation. If None (default), run_dir must be specified.
- run_dir (str or None, optional) – The base directory of the simulation. If None (default), it is constructed internally from the other parameters.
- base_dir (str or None, optional) – The base directory of the local data repository. If None (default), run_dir must be specified.
- sim_type (str or None, optional) – Type of simulation (‘HYDRO’ or ‘DM’, case-insensitive). If None (default), run_dir must be specified.
- suite_name (str, optional) – Suite from which to draw the simulation from. Options are ‘10r200’ (default), ‘5r200’, ‘10r200_only’, and ‘5r200_only’. The ‘…_only’ options do not switch to the other suite for simulations that are not part of the selected suite.
-
get_galaxy_magnitude_file(index)¶ Form the (first) file of a given galaxy magnitude catalogue.
Parameters: index (int) – The index of the snapshot for which to form the file. Returns: file_path (str) – The path to the first file of the specified catalogue.
-
get_magnitude_file(index)¶ Form the (first) file of a given snapshot magnitude catalogue.
Parameters: index (int) – The index of the snapshot for which to form the file. Returns: file_path (str) – The path to the first file of the specified catalogue.
-
get_snap_file(index)¶ Shorthand alias for
get_snapshot_file().
-
get_snapshot_file(index)¶ Form the (first) file of a given snapshot particle catalogue.
Parameters: index (int) – The index of the snapshot for which to form the file. Returns: file_path (str) – The path to the first file of the specified snapshot catalogue.
-
get_snip_file(index)¶ Shorthand alias for
get_snipshot_file().
-
get_snipshot_file(index)¶ Form the (first) file of a given snipshot particle catalogue.
Parameters: index (int) – The index of the snipshot for which to form the file. Returns: file_path (str) – The path to the first file of the specified catalogue.
-
get_subfind_file(index)¶ Form the (first) file of a given subfind catalogue.
Parameters: index (int) – The index of the snapshot whose subfind catalogue file should be formed. Returns: file_path (str) – The path to the first file of the specified catalogue.