Skip to content

Commit

Permalink
Unit inference reporting (#130)
Browse files Browse the repository at this point in the history
* Update FLAMINGO test for index units

* Improve unit reporting

* improve docs on failing unit inference

* add missing tng sim doc page
  • Loading branch information
cbyrohl authored Jan 3, 2024
1 parent 11b22f7 commit 4709b9e
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 79 deletions.
24 changes: 24 additions & 0 deletions docs/supported_datasets/tng.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# The TNG Simulation Suite

## Overview
The IllustrisTNG project is a series of large-scale cosmological
magnetohydrodynamical simulations of galaxy formation. The data is
available at [www.tng-project.org](https://www.tng-project.org/).

## Demo data

Many of the examples in this documentation use the TNG50-4 simulation.
In particular, we make a snapshot and group catalog available to run
these examples. You can download and extract the snapshot and its group
catalog from the TNG50-4 test data:

``` bash
wget https://heibox.uni-heidelberg.de/f/dc65a8c75220477eb62d/?dl=1 -O snapshot.tar.gz
tar -xvf snapshot.tar.gz
wget https://heibox.uni-heidelberg.de/f/ff27fb6975fb4dc391ef/?dl=1 -O catalog.tar.gz
tar -xvf catalog.tar.gz
```

The snapshot and group catalog should be placed in the same folder.
Then you can load the snapshot with `ds = load("./snapdir_030")`. The group catalog should automatically be detected,
otherwise you can also pass the path to the catalog via the `catalog` keyword to `load()`.
5 changes: 5 additions & 0 deletions docs/tutorial/observations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Choosing a subset means that the data size is small and easy to work with. We de

First, we load the dataset using the convenience function `load()` that will determine the appropriate dataset class for us:

!!! info "Missing units"
Below snippet will report missing units for some fields. This is expected.
Those fields that cannot have their units determined automatically at this point and carry the unit **unknown**.
See [Units](../../units) for more information.


```pycon title="Loading a dataset"
>>> from scida import load
Expand Down
25 changes: 24 additions & 1 deletion docs/units.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,33 @@ ds = load("TNG50-4_snapshot")
```

will automatically attach units to the data. This can be deactivated by passing "units=False" to the load function.
By default, code units are used, alternatively, cgs conversions can be applied by passing "units='cgs'".
By default, code units are used, alternatively, cgs conversions can be applied by passing "units='cgs'" (experimental).

Units are introduced via the [pint](https://pint.readthedocs.io/en/stable/) package, see there for more details.

Sometimes, the units cannot be inferred or parsed.
This will be indicated in the output following the call to `load()`, e.g. as:

``` pycon
Missing units for 1 fields.
Fields with missing units:
- /PartType0/FieldWithoutUnits (missing)
```

You can obtain more information on the cause by setting

``` pycon
>>> import logging
>>> logging.getLogger().setLevel(logging.DEBUG)
```

before calling `load()`.

Units for custom datasets can also be manually be specified using unit files, see [here](configuration.md#unit-files).



## Using data with units

``` pycon
>>> gas = ds.data["PartType0"]
Expand Down
Loading

0 comments on commit 4709b9e

Please sign in to comment.