skais_mapper.illustris.util
Illustris simulation snapshot utilities.
Adapted from: https://github.com/illustristng/illustris_python
Classes:
Name | Description |
---|---|
IllustrisH5File |
Represents an Illustris HDF5 file. Wrapper for the |
Functions:
Name | Description |
---|---|
pidx_from_ptype |
Mapping common names to indices of particle types. |
ptype_from_pidx |
Mapping indices to names of particle types. |
IllustrisH5File
IllustrisH5File(
base_path: str | Path,
snapshot: int,
partition: int = 0,
path_func: Callable | None = None,
mode: str = "r",
driver: str | None = None,
cache_size: int | float | str = "2G",
**kwargs,
)
Bases: h5py.File
Represents an Illustris HDF5 file. Wrapper for the
Initialize a IllustrisH5File instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_path
|
str | Path
|
Base path to the Illustris(TNG) snapshots. |
required |
snapshot
|
int
|
Snapshot ID {0-99}. |
required |
partition
|
int
|
Subfile partition ID {0-600+}. |
0
|
path_func
|
Callable | None
|
A function fetching the filename of the HDF5 file. The function
should accept |
None
|
mode
|
str
|
'r' Readonly, file must exist (default) 'r+' Read/write, file must exist 'w' Create file, truncate if exists 'w-' or 'x' Create file, fail if exists 'a' Read/write if exists, create otherwise. |
'r'
|
driver
|
str | None
|
Name of the driver to use; valid values are None (default), 'core', 'sec2', 'direct', 'stdio', 'mpio', 'ros3'. |
None
|
cache_size
|
int | float | str
|
Chunk cache size in bytes or passed as string. |
'2G'
|
**kwargs
|
More keyword arguments |
{}
|
Source code in skais_mapper/illustris/util.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
pidx_from_ptype
pidx_from_ptype(ptype: int | str) -> int
Mapping common names to indices of particle types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ptype
|
int | str
|
particle type description string |
required |
Returns:
Type | Description |
---|---|
int
|
(int) particle type index 0 -> gas particles 1 -> dark-matter particles 2 -> lowres dark-matter / stellar disc particles (in zoom simulations) 3 -> tracer / stellar buldge particles 4 -> star / wind / stellar particles 5 -> blackhole / sink particles |
Raises:
Type | Description |
---|---|
ValueError
|
If the name doesn't match any particle type. |
Source code in skais_mapper/illustris/util.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
ptype_from_pidx
ptype_from_pidx(pidx: int | str) -> str
Mapping indices to names of particle types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pidx
|
int | str
|
particle type index |
required |
Returns:
Type | Description |
---|---|
str
|
(int) particle type index gas particles -> 0 dark-matter particles -> 1 lowres dark-matter / stellar disc particles (in zoom simulations) -> 2 tracer / stellar buldge particles -> 3 star / wind / stellar particles -> 4 blackhole / sink particles -> 5 |
Raises:
Type | Description |
---|---|
ValueError
|
If the index is not |
Source code in skais_mapper/illustris/util.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|