Yeah it doesn’t work.  I use this version of yt from Doug Rennehan:
https://github.com/rennehan/yt-swift

Cheers,
romeel


> On 10 Jan 2024, at 18:25, hannah.obrennan.2021--- via yt-users 
> <[email protected]> wrote:
> 
> Has anyone recently been able to load a SWIFT snapshot using yt.load?
> 
> I created a conda env using python=3.
> I installed the latest version of yt using: conda install -c conda-forge yt
> I installed h5py using: conda install h5py
> I also installed yt_astro_analysis (to use HaloCatalog later) using: git 
> clone https://github.com/yt-project/yt_astro_analysis; cd yt_astro_analysis; 
> python -m pip install -e .
> 
> I attempted to create a Dataset using yt.load("SWIFT_filename.hdf5") and 
> found the following error:
> 
> Traceback (most recent call last):
>  File 
> "/data/regan_data/Hannah_WS/Halo_mass_function_project/2023-10_11_12/FOF_Rockstar_comparison/hc_creation.py",
>  line 62, in <module>
>    data_ds = yt.load(dir_name)
>              ^^^^^^^^^^^^^^^^^
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/_maintenance/deprecation.py",
>  line 69, in inner
>    return func(*args, **kwargs)
>           ^^^^^^^^^^^^^^^^^^^^^
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/loaders.py",
>  line 144, in load
>    return cls(fn, *args, **kwargs)
>           ^^^^^^^^^^^^^^^^^^^^^^^^
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/frontends/swift/data_structures.py",
>  line 36, in __init__
>    super().__init__(
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/frontends/sph/data_structures.py",
>  line 34, in __init__
>    super().__init__(
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/data_objects/static_output.py",
>  line 2123, in __init__
>    super().__init__(
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/data_objects/static_output.py",
>  line 293, in __init__
>    self._parse_parameter_file()
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/frontends/swift/data_structures.py",
>  line 100, in _parse_parameter_file
>    runtime_parameters = self._get_info_attributes("RuntimePars")
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/yt/frontends/swift/data_structures.py",
>  line 84, in _get_info_attributes
>    header = dict(handle[dataset].attrs)
>                  ~~~~~~^^^^^^^^^
>  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
>  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
>  File 
> "/home/hannah/anaconda3/envs/yt-10_01_2024/lib/python3.12/site-packages/h5py/_hl/group.py",
>  line 357, in __getitem__
>    oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
>  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
>  File "h5py/h5o.pyx", line 190, in h5py.h5o.open
> KeyError: "Unable to open object (object 'RuntimePars' doesn't exist)"
> 
> 
> When I examine the keys from the .hdf5 file in python, I find:
> 
>>>> import h5py
>>>> f = h5py.File('../SWIFT__0.5_cMpc_h/N_512/RedshiftOutput0002.hdf5')
>>>> list(f.keys())
> ['Cells', 'Code', 'Cosmology', 'DMParticles', 'GravityScheme', 'Header', 
> 'InternalCodeUnits', 'Parameters', 'PartType1', 'PhysicalConstants', 
> 'Policy', 'SubgridScheme', 'Units', 'UnusedParameters']
> 
> 'RuntimePars' is not one of the keys listed.
> 
> Strangely, I was able to load the snapshot successfully on 12/12/2023 but 
> cannot now, nor can I load any others.
> This is the same error found by Romeel Davé (January 2022) in 
> https://mail.python.org/archives/list/[email protected]/message/NUKRAWV7JEXSSJ4QEOOP2IOVMW4JXF4H/
>  
> 
> Any help with would be much appreciated, thank you!
> - Hannah
> _______________________________________________
> yt-users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/yt-users.python.org/
> Member address: [email protected]

_______________________________________________
yt-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: [email protected]

Reply via email to