An extension module for yt, adding a frontend for Idefix
Project description
yt_idefix
A maturing yt frontend for Idefix and Pluto, packaged as an extension for yt.
Installation
python -m pip install yt_idefix
Supported formats
Code | format | supported since | additional dependencies |
---|---|---|---|
Idefix | .dmp |
v0.1.0 | |
Idefix | .vtk |
v0.3.0 | |
Pluto | .vtk |
v0.9.0 | |
Pluto | XDMF | v1.1.0 | h5py |
Usage
After importing yt
itself, make sure to activate the extension
import yt
import yt_idefix
Now yt.load
will be able to read Pluto/Idefix output files.
Additional arguments to yt.load
The metadata are parsed from data file, definitions header file and inifile when loading dataset.
Definitions header file (definitions.h
for Pluto, or definitions.hpp
for Idefix) and inifile (pluto.ini
and idefix.ini
respectively) are discovered automatically if they match default names, are located along with data files, and unique. Otherwise, they can be specified explicitly as paths (either relative to data files or absolute paths) with parameters definitions_header
and inifile
respectively.
Geometry is parsed automatically whenever possible, but as a last resort, it can also be specified as a keyword argument (possible values are "cartesian", "spherical", "cylindrical" and "polar").
# Examples
ds = yt.load("data.0010.vtk", definitions_header="../definitions.h", inifile="example.ini")
ds = yt.load("data.0010.vtk", geometry='spherical")
The data are loaded as physical quantities with units. The default unit system is cgs
in yt. This frontend can convert data from code units into cgs
properly, based on the unit definitions from metadata.
Users are able to choose the unit displayed in two ways, through unit_system
("code", "mks" and "cgs") and units_override
(only valid for Pluto).
# Examples on units
ds = yt.load("data.0010.vtk", unit_system='mks")
units_override = dict(length_unit=(100.0, "au"), mass_unit=yt.units.mass_sun)
ds = yt.load("data.0010.vtk", unit_override=unit_override) # Caution that other units will also be changed for consistency!!
With Pluto data, the rest of the system will be derived consistently with given units, within the following rules:
- Temperature unit cannot be overridden (always set to Kelvin)
- No more than three units can be overridden at once (overconstrained systems are never validated for simplicity)
- When given less than three overrides, base units in Pluto (ordered: velocity_unit, density_unit, length_unit) are assumed
- The following combinations are not allowed
{"magnetic_unit", "velocity_unit", "density_unit"},
{"velocity_unit", "time_unit", "length_unit"},
{"density_unit", "length_unit", "mass_unit"},
yt is able to provide some derived fields from existed fields, e.g., "cell_volume"
. Fields related to element species can be created according to primordial abundances of H and He, through default_species_fields
("neutral"
and "ionized"
) parameters.
# Example
ds = yt.load("data.0010.vtk", default_species_fields="ionized")
Convention of field names
The outputs are loaded from disk with field names in uppercase. This normalization is only applied to the standard outputs but user-defined outputs and Pluto's ion fraction outputs.
# Example
ds.field_list
# Output:
# [('pluto-vtk', 'PRS'), # standard output
# ('pluto-vtk', 'RHO'), # standard output
# ('pluto-vtk', 'VX1'), # standard output
# ('pluto-vtk', 'VX2'), # standard output
# ('pluto-vtk', 'VX3'), # standard output
# ('pluto-vtk', 'temp')] # This is a user-defined output
Experimental features
Seamless plugin support
new in yt 4.2 (unreleased) + yt_idefix 0.16
yt>=4.2
supports automatic
loading for external frontends, i.e., the extra import line (import yt_idefix
)
will not be needed with this version.
This feature is marked as experimental until yt 4.2.0 is released. In the mean time, this feature can be enabled by installing yt from source as, i.e.,
python -m pip install git+https://github.com/yt-project/yt.git
Strecthed grids support
new in yt 4.1 + yt_idefix 0.12
yt_idefix>=0.12.0
natively supportsyt.SlicePlot
for streched gridsyt>=4.1.0
is required fromyt.ProjectionPlot
Streched grids support is considered experimental as of yt 4.1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yt_idefix-2.0.2.tar.gz
.
File metadata
- Download URL: yt_idefix-2.0.2.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 423154ed9888a7bbbe538bbde220ec018d306043bfdb3a430eac1f89d5e8b339 |
|
MD5 | 6931f0132b877595a53d731df9a0a93b |
|
BLAKE2b-256 | 49fd43bb9e9b1f3761e67f69187e1b9f274fe7e6786f518b0dbc8e2413ddc060 |
File details
Details for the file yt_idefix-2.0.2-py3-none-any.whl
.
File metadata
- Download URL: yt_idefix-2.0.2-py3-none-any.whl
- Upload date:
- Size: 39.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67a004c07e73ef844d0757e79e4e7196a4a5e9569f91960193d6d79c4a6cc5f6 |
|
MD5 | 0276263c942c3014351fa6d92c926325 |
|
BLAKE2b-256 | 7a91db9809214208944776dd4ffa144a3ac93b68ed424a441ac0a2501286ec0f |