# yt_idefix
[![PyPI](https://img.shields.io/pypi/v/yt-idefix.svg?logo=pypi&logoColor=white&label=PyPI)](https://pypi.org/project/yt_idefix/)
[![yt-project](https://img.shields.io/static/v1?label="works%20with"&message="yt"&color="blueviolet")](https://yt-project.org)
<!--- Tests and style --->
[![CI](https://github.com/neutrinoceros/yt_idefix/actions/workflows/ci.yml/badge.svg)](https://github.com/neutrinoceros/yt_idefix/actions/workflows/ci.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/neutrinoceros/yt_idefix/main.svg)](https://results.pre-commit.ci/latest/github/neutrinoceros/yt_idefix/main)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)
A maturing yt frontend for Idefix and Pluto, packaged as an extension for yt.
## Installation
```shell
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.
```python
ds = yt.load(
"data.0010.vtk",
definitions_header="../definitions.h",
inifile="example.ini",
)
```
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").
```python
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. Data is always interpreted as dimensionful.
For Pluto simulation, metadata is retrieved from `definitions.h` and `pluto.ini` to guess the proper on-disk units automatically.
Units may also be provided at runtime using the `units_override` argument
```python
ds = yt.load(
"data.0010.vtk",
units_override={
"length_unit": (100.0, "au"),
"mass_unit": yt.units.mass_sun,
},
)
```
Note that other units will also be changed for consistency (Pluto).
Displayed units can also be controled using the `unit_system` argument.
Accepted values are `"cgs"` (default), `"mks"` and `"code"`.
```python
ds = yt.load("data.0010.vtk", unit_system="mks")
```
With Pluto data, units not specified with `units_override` 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
```python
{"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.
```python
ds = yt.load("data.0010.vtk", default_species_fields="ionized")
```
### Conventions on field names
Field names of on-disk fields for density, pressure, velocity and magnetic field components are always normalized to upper case, even if Pluto may use lowercase in some versions.
```python
>>> ds.field_list
[('pluto-vtk', 'PRS'),
('pluto-vtk', 'RHO'),
('pluto-vtk', 'VX1'),
('pluto-vtk', 'VX2'),
('pluto-vtk', 'VX3')]
```
This normalization is only applied to non-user-defined outputs and Pluto's ion
fraction outputs.
Raw data
{
"_id": null,
"home_page": null,
"name": "yt-idefix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "astronomy astrophysics visualization amr adaptivemeshrefinement",
"author": "C.M.T. Robert",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/40/6f/75eea6277495033d527beb9710c928e8550377217924c3446c22a56a3917/yt_idefix-2.4.0.tar.gz",
"platform": null,
"description": "\n# yt_idefix\n[![PyPI](https://img.shields.io/pypi/v/yt-idefix.svg?logo=pypi&logoColor=white&label=PyPI)](https://pypi.org/project/yt_idefix/)\n[![yt-project](https://img.shields.io/static/v1?label=\"works%20with\"&message=\"yt\"&color=\"blueviolet\")](https://yt-project.org)\n\n<!--- Tests and style --->\n[![CI](https://github.com/neutrinoceros/yt_idefix/actions/workflows/ci.yml/badge.svg)](https://github.com/neutrinoceros/yt_idefix/actions/workflows/ci.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/neutrinoceros/yt_idefix/main.svg)](https://results.pre-commit.ci/latest/github/neutrinoceros/yt_idefix/main)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)\n\nA maturing yt frontend for Idefix and Pluto, packaged as an extension for yt.\n\n## Installation\n\n```shell\npython -m pip install yt_idefix\n```\n\n## Supported formats\n\n| Code | format | supported since | additional dependencies |\n|--------|:------:|:---------------:|-------------------------|\n| Idefix | `.dmp` | v0.1.0 | |\n| Idefix | `.vtk` | v0.3.0 | |\n| Pluto | `.vtk` | v0.9.0 | |\n| Pluto | XDMF | v1.1.0 | `h5py` |\n\n## Usage\n\nIntegration with yt is seamless. *Installing* this plugin is all that's required to make yt\ncompatible with data formats supported by `yt_idefix` !\n\n### Additional arguments to `yt.load`\nThe metadata are parsed from data file, definitions header file and inifile when loading dataset.\n\nDefinitions 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.\n\n```python\nds = yt.load(\n \"data.0010.vtk\",\n definitions_header=\"../definitions.h\",\n inifile=\"example.ini\",\n)\n```\n\nGeometry 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\").\n\n```python\nds = yt.load(\"data.0010.vtk\", geometry=\"spherical\")\n```\n\nThe data are loaded as physical quantities with units. The default unit system is `cgs` in yt. Data is always interpreted as dimensionful.\nFor Pluto simulation, metadata is retrieved from `definitions.h` and `pluto.ini` to guess the proper on-disk units automatically.\n\nUnits may also be provided at runtime using the `units_override` argument\n```python\nds = yt.load(\n \"data.0010.vtk\",\n units_override={\n \"length_unit\": (100.0, \"au\"),\n \"mass_unit\": yt.units.mass_sun,\n },\n)\n```\nNote that other units will also be changed for consistency (Pluto).\n\nDisplayed units can also be controled using the `unit_system` argument.\nAccepted values are `\"cgs\"` (default), `\"mks\"` and `\"code\"`.\n\n```python\nds = yt.load(\"data.0010.vtk\", unit_system=\"mks\")\n```\n\nWith Pluto data, units not specified with `units_override` will be derived consistently with given units, within the following rules:\n1. Temperature unit cannot be overridden (always set to Kelvin)\n2. No more than three units can be overridden at once (overconstrained systems are never validated for simplicity)\n3. When given less than three overrides, base units in Pluto (ordered: velocity_unit, density_unit, length_unit) are assumed\n4. The following combinations are not allowed\n\n```python\n{\"magnetic_unit\", \"velocity_unit\", \"density_unit\"},\n{\"velocity_unit\", \"time_unit\", \"length_unit\"},\n{\"density_unit\", \"length_unit\", \"mass_unit\"}\n```\n\nyt 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.\n\n```python\nds = yt.load(\"data.0010.vtk\", default_species_fields=\"ionized\")\n```\n\n### Conventions on field names\n\nField names of on-disk fields for density, pressure, velocity and magnetic field components are always normalized to upper case, even if Pluto may use lowercase in some versions.\n\n```python\n>>> ds.field_list\n[('pluto-vtk', 'PRS'),\n ('pluto-vtk', 'RHO'),\n ('pluto-vtk', 'VX1'),\n ('pluto-vtk', 'VX2'),\n ('pluto-vtk', 'VX3')]\n```\n\nThis normalization is only applied to non-user-defined outputs and Pluto's ion\nfraction outputs.\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "An extension module for yt, adding a frontend for Idefix and Pluto",
"version": "2.4.0",
"project_urls": {
"Documentation": "https://yt-project.org/docs/dev/",
"Homepage": "https://yt-project.org/",
"Source": "https://github.com/neutrinoceros/yt_idefix",
"Tracker": "https://github.com/neutrinoceros/yt_idefix/issues"
},
"split_keywords": [
"astronomy",
"astrophysics",
"visualization",
"amr",
"adaptivemeshrefinement"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1f41322f9c97f893559c2a338ab651f6eb573f735d6ff43430bb4ebc5b3469c5",
"md5": "9dbb83cad2d68049b47f0f592c780ff0",
"sha256": "5e9989516d6bd41f354e3d5958ad1aac56b91597629863dce5bfe016987d8c68"
},
"downloads": -1,
"filename": "yt_idefix-2.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9dbb83cad2d68049b47f0f592c780ff0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 39600,
"upload_time": "2024-11-26T14:04:30",
"upload_time_iso_8601": "2024-11-26T14:04:30.755530Z",
"url": "https://files.pythonhosted.org/packages/1f/41/322f9c97f893559c2a338ab651f6eb573f735d6ff43430bb4ebc5b3469c5/yt_idefix-2.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "406f75eea6277495033d527beb9710c928e8550377217924c3446c22a56a3917",
"md5": "e58fa43e8b95e9e798308933c25920cb",
"sha256": "01f357faf208f5f1307d8572475411cdd478d13b35f4e2e3920841acab08cf7f"
},
"downloads": -1,
"filename": "yt_idefix-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "e58fa43e8b95e9e798308933c25920cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 51442438,
"upload_time": "2024-11-26T14:04:33",
"upload_time_iso_8601": "2024-11-26T14:04:33.301279Z",
"url": "https://files.pythonhosted.org/packages/40/6f/75eea6277495033d527beb9710c928e8550377217924c3446c22a56a3917/yt_idefix-2.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-26 14:04:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "neutrinoceros",
"github_project": "yt_idefix",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "yt-idefix"
}