[yt-dev] Issue #1344: Metallicity is broken in the stream frontend for grid data (yt_analysis/yt)

John ZuHone issues-reply at bitbucket.org
Sat Apr 8 11:23:55 PDT 2017


New issue 1344: Metallicity is broken in the stream frontend for grid data
https://bitbucket.org/yt_analysis/yt/issues/1344/metallicity-is-broken-in-the-stream

John ZuHone:

If one sets up a stream dataset with metallicity as an input field, the values get transformed. A simple script demonstrates this:

```python
import numpy as np
import yt

Z = np.random.uniform(size=(32,32,32))
d = np.random.uniform(size=(32,32,32))

data = {"density": d, "metallicity": Z}

ds = yt.load_uniform_grid(data, (32,32,32))

dd = ds.all_data()

print(Z.max())
print(dd["metallicity"].max())
```

gives:

```pycon
0.99996801409647373
0.012949585782549334 dimensionless
```

This happens regardless if one sets the units in the dict above. I am pretty sure that somehow the derived field for `metallicity` is being used instead, because that rescales `metal_density` by the solar value, and somehow the input field is getting interpreted as `metal_density`. 

This bug got accidentally introduced in yt 3.3.2 with this PR:

https://bitbucket.org/yt_analysis/yt/pull-requests/2331/adding-metallicity-to-alias-fields-in/

I'll see if I can track it down.

Responsible: jzuhone


More information about the yt-dev mailing list