Metadata-Version: 2.5
Name: gusteau-translate
Version: 0.1.2
Summary: Tool for translating common astrophysical particle snapshots to the  GUSTEAU specification
Project-URL: home, https://github.com/astrosocket/gusteau_translate
Project-URL: source, https://github.com/astrosocket/gusteau_translate
Project-URL: issues, https://github.com/astrosocket/gusteau_translate/issues/new
Author-email: Michael Ryan <mryan1@sas.upenn.edu>, Josh Borrow <josh@joshborrow.com>
License-Expression: MIT
License-File: LICENSE
Keywords: astronomy,astrophysics
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Astronomy
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.13
Requires-Dist: h5py
Requires-Dist: natsort<9,>=8.4.0
Requires-Dist: numpy<2.5,>=2.4
Requires-Dist: packingcubes<0.8,>=0.7.1
Requires-Dist: pydantic<3,>=2.13.4
Requires-Dist: ruamel-yaml<0.20,>=0.19.1
Requires-Dist: swiftsimio
Requires-Dist: tomlkit<0.16,>=0.15.0
Description-Content-Type: text/markdown

# GUSTEAU-Translate

[![PyPI](https://img.shields.io/pypi/v/gusteau-translate)](https://pypi.org/project/gusteau-translate)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/gusteau-translate)](https://pypi.org/project/gusteau-translate/)

<!--- Tests and style --->

<!-- [![Tested with Hypothesis](https://img.shields.io/badge/hypothesis-tested-brightgreen.svg)](https://hypothesis.readthedocs.io/) -->
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/charliermarsh/ruff)

Demo translation software for Project GUSTEAU

View the documentation at <https://gusteau-translate.readthedocs.io>.

See the GUSTEAU specification at <https://gusteau-spec.readthedocs.io>.

Supported by the National Science Foundation through [Award 2513426](https://www.nsf.gov/awardsearch/show-award/?AWD_ID=2513426).

## Requirements

<!-- --8<-- [start:requirements] -->

[![Supported Python Versions](https://img.shields.io/pypi/pyversions/gusteau-tramslate)](https://pypi.org/project/gusteau-translate/) is required.
Python versions outside this range may work, but their usage is not supported, and at least some features are >Python 3.13.

### Python packages

- `numpy` - required for core routines
- `h5py` - required for reading and saving snapshot data
- `swiftsimio` - required for cosmological unit conversion
- `tomlkit` - required for reading toml-based style files
- `ruamel-yaml` - required for reading yaml-based style files
- `pydantic` - required for validating translations
- `natsort` - required for correctly handling multipart files
- `packingcubes` - required for sorting the data and generating the packingcubes structure.
  Note that `packingcubes` is lazily imported in python 3.15+, so while it is not yet an optional package, it will be in the future.

<!-- --8<-- [end:requirements] -->

## Example Usage

GUSTEAU-Translate has a CLI via the `alchemize` command[^alchemize]:

``` sh
alchemize -t style INPUT OUTPUT
```

which will translate the `INPUT` HDF5 snapshot using the specified `style`(see below), saving a GUSTEAU formatted snapshot to `OUTPUT`.
The output file will be then validated against the GUSTEAU specification.

You can optionally skip the validation or translation steps by passing `--to/--translate-only` or `--vo/--validate-only`, if, e.g., you are testing GUSTEAU creation directly.

> **NOTE**:
> Multipart _input_ files that do not use virtual datasets should be specified via a psuedo-glob pattern.
> For example, if you have `snapshot_XXX.0.hdf5`, `snapshot_XXX.1.hdf5`, etc., you would specify the input file as `snapshot_XXX` (notice no .0, .hdf5).
>
> Mulitpart _output_ files can be specified via the `--num-partfiles` option, which will produce `$num_partfiles + 1` outputs.
> The output files will look like `output.hdf5`, `output.0.hdf5`, `output.1.hdf5`, etc. 
> `output.hdf5` will contain virtual datasets comprised of the datasets in the partfiles.

As always, you can specify `--help` to get the available options.

### Including `packingcubes`

You can additionally run the [`packingcubes`](https://packingcubes.readthedocs.io) software as part of the translation pipeline via `-p/--packingcubes`.
This will spatially sort the data (currently all particle groups listed in `/Header.ParticleNames` in the output file) and save the `ParticleCubes`/`PackedTree` information at the same time it translates it.

This adds a little bit of time to the startup (for the initial cubing) and will use more memory while running.
The contribution to the final snapshot size should be pretty minimal though; an EAGLE snapshot was actually _smaller_ in GUSTEAU format.

## Available Styles

The current available styles are

- `swift-eagle` - for converting [SWIFT](https://swift.strw.leidenuniv.nl/)-style snapshots[^swift-style]
- `illustrisTNG` - for converting [IllustrisTNG](https://github.com/astrosocket/gusteau-translate/tree/mainwww.tng-project.org/)-style snapshots



[^alchemize]: `gusteau-alchemize` and `gusteau-translate` also map to the same command.
[^swift-style]: This style was built off of the snapshots from the EAGLE simulation as found at [CAMELS](https://camels.readthedocs.io) and so is based on SWIFT v1.0.0
