cbyrohl / scida

scida is an out-of-the-box analysis tool for large scientific datasets. It primarily supports the astrophysics community, focusing on cosmological and galaxy formation simulations using particles or unstructured meshes, as well as large observational datasets. This tool uses dask, allowing analysis to scale.
https://scida.io
MIT License
26 stars 4 forks source link

idealized Arepo simulation support #74

Open dnelson86 opened 1 year ago

dnelson86 commented 1 year ago

We have so far focused mostly on cosmological simulations.

Let us also check minimal support for idealized simulations (e.g. much different units, different field conventions possible, etc).

e.g. isolated galaxy disk in arepo/examples/ (from public version of the code).

arkordt commented 1 month ago

I would like to support this issue and offer support for extending and generalizing scida in that regard. Here is a related issue that I encountered:

summary of the arepo setup

After defining some additional units for quantities, opening the snapshot works fine. While following the scida documentation regarding visualization with holoviews and datashader, generating the dataframe including all fields does not work. Excerpt from the error report

...

File ~/miniforge3/envs/astro/lib/python3.10/site-packages/scida/fields.py:504, in FieldContainer.get_dataframe(self, fields)
    502     idim = int(k[i:])
    503     k = k.split(k[i:])[0]
--> 504 v = self[k]
    505 assert v.ndim <= 2  # cannot support more than 2 here...
    506 if idim is not None:

...

File ~/miniforge3/envs/astro/lib/python3.10/site-packages/scida/customs/arepo/dataset.py:1658, in Temperature(arrs, ureg, **kwargs)
   1655     m_p = m_p * ureg.g
   1656     k_B = k_B * ureg.erg / ureg.K
-> 1658 xe = arrs[\"ElectronAbundance\"]
   1659 u_internal = arrs[\"InternalEnergy\"]
   1661 mu = 4 / (1 + 3 * xh + 4 * xh * xe) * m_p

...

File ~/miniforge3/envs/astro/lib/python3.10/site-packages/scida/fields.py:661, in FieldContainer._getitem(self, key, force_derived, update_dict, evaluate_recipe)
    659     return field
    660 else:
--> 661     raise KeyError(\"Unknown field '%s'\" % key)

KeyError: \"Unknown field 'ElectronAbundance'\""

Reading through src/scida/customs/arepo/dataset.py, I think that the ArepoSnapshot class should be much more general, e.g.