SWIFTSIM / swiftsimio

Python library for reading SWIFT data. Uses unyt and h5py.
GNU Lesser General Public License v3.0
15 stars 12 forks source link

`cosmo_array.in_cgs()` returns `Comoving` quantity when original array was `physical` #185

Open mladenivkovic opened 4 months ago

mladenivkovic commented 4 months ago

        data = swiftsimio.load(snapshot_name)
        gas = data.gas
        u = gas.internal_energies

        u_phys = u.to_physical()

        #  print(u_phys[:1])
        #  [1.0279273e-19] kpc**2/kyr**2 (Physical)

        u_phys_cgs = u_phys.in_cgs()
        #  print(u_phys_cgs[:1])
        #  [982.7783] erg/g (Comoving)

        u_phys.convert_to_cgs()
        #  print(u_phys[:1])
        #  [982.7783] erg/g (Physical)
        # ok, this works.
MatthieuSchaller commented 1 week ago

This case will be covered correctly now with the changes proposed to the outputs to handle physical elements better.