Skip to main content

An extension module for yt, adding a frontend for Idefix and Pluto

Project description

yt_idefix

PyPI PyPI yt-project

CI pre-commit.ci status Code style: black Ruff

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

Integration with yt is seamless. Installing this plugin is all that's required to make yt compatible with data formats supported by yt_idefix !

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)

# Caution that other units will also be changed for consistency!
ds = yt.load("data.0010.vtk", unit_override=unit_override)

With Pluto data, the rest of the system will be derived consistently with given units, within the following rules:

  1. Temperature unit cannot be overridden (always set to Kelvin)
  2. No more than three units can be overridden at once (overconstrained systems are never validated for simplicity)
  3. When given less than three overrides, base units in Pluto (ordered: velocity_unit, density_unit, length_unit) are assumed
  4. 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yt_idefix-2.2.1.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

yt_idefix-2.2.1-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file yt_idefix-2.2.1.tar.gz.

File metadata

  • Download URL: yt_idefix-2.2.1.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for yt_idefix-2.2.1.tar.gz
Algorithm Hash digest
SHA256 c9683f33d7369b299f91f4e28cb518bd924d1f37de1807ffe72a3c6c1ad7cfd0
MD5 7797d8cbe9999a3f4b1486d4e9274ece
BLAKE2b-256 e7b06659de9a21999bd477df337d37eda2b3cdaf3a2aca8210a452cef96f9041

See more details on using hashes here.

Provenance

File details

Details for the file yt_idefix-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: yt_idefix-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for yt_idefix-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3599f6f570cee20c99c3c1621d572afbe31860a4b0702f6082b4f3aad4e04ee
MD5 1ed2768f7675db3a3aa4270152b33da4
BLAKE2b-256 a02cc7379e1985d66589f915e2452d7e0711abc29bbd207fa9422260879386a1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page