Hi, Has anyone tried to import a snapshot from SWIFT (https://swift.dur.ac.uk/) into yt? yt.load(SNAPSHOT) gives me the traceback:
yt.load('eagle_0149.hdf5') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/loaders.py", line 93, in load return candidates[0](fn, *args, **kwargs) File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/swift/data_structures.py", line 41, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/sph/data_structures.py", line 43, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/data_objects/static_output.py", line 1934, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/data_objects/static_output.py", line 228, in __init__ self._parse_parameter_file() File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/swift/data_structures.py", line 103, in _parse_parameter_file runtime_parameters = self._get_info_attributes("RuntimePars") File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/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 "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/h5py/_hl/group.py", line 264, 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)"
The snapshot format is similar to Gadget but it appears RunTimePars are in other fields. Here are the hdf5 fields: $ h5ls eagle_0149.hdf5 BHParticles Soft Link {/PartType5} Cells Group Code Group Cosmology Group DMParticles Soft Link {/PartType1} GasParticles Soft Link {/PartType0} GravityScheme Group Header Group HydroScheme Group InternalCodeUnits Group Parameters Group PartType0 Group PartType1 Group PartType4 Group PartType5 Group PhysicalConstants Group Policy Group StarsParticles Soft Link {/PartType4} StarsScheme Group SubgridScheme Group Units Group UnusedParameters Group Some of the other field names within PartType0 etc are also somewhat different, e.g. MetalMassFractions instead of Metallicity. thanks, romeel
Hi Romeel, This used to work a few years ago when we added a SWIFT frontend to yt. However, the SWIFT data format has changed quite a lot, particularly the metadata and the units. As such, I'm not surprised this doesn't work anymore. I'm not sure how much work would be required to get this working again, as I haven't looked at the SWIFT data format recently. Here is the code - https://github.com/yt-project/yt/tree/main/yt/frontends/swift Apologies about this! Best wishes, Ash ________________________________ From: Romeel Davé <romeeld@gmail.com> Sent: 26 January 2022 10:31 To: yt-users@python.org <yt-users@python.org> Subject: [yt-users] import SWIFT snapshot into yt [EXTERNAL EMAIL] Hi, Has anyone tried to import a snapshot from SWIFT (https://swift.dur.ac.uk/) into yt? yt.load(SNAPSHOT) gives me the traceback:
yt.load('eagle_0149.hdf5') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/loaders.py", line 93, in load return candidates[0](fn, *args, **kwargs) File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/swift/data_structures.py", line 41, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/sph/data_structures.py", line 43, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/data_objects/static_output.py", line 1934, in __init__ default_species_fields=default_species_fields, File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/data_objects/static_output.py", line 228, in __init__ self._parse_parameter_file() File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/yt/frontends/swift/data_structures.py", line 103, in _parse_parameter_file runtime_parameters = self._get_info_attributes("RuntimePars") File "/cosma/home/dc-dave2/anaconda3/lib/python3.7/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 "/cosma/home/dc-dave2/anaconda3/lib/python3.7/site-packages/h5py/_hl/group.py", line 264, 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)"
The snapshot format is similar to Gadget but it appears RunTimePars are in other fields. Here are the hdf5 fields: $ h5ls eagle_0149.hdf5 BHParticles Soft Link {/PartType5} Cells Group Code Group Cosmology Group DMParticles Soft Link {/PartType1} GasParticles Soft Link {/PartType0} GravityScheme Group Header Group HydroScheme Group InternalCodeUnits Group Parameters Group PartType0 Group PartType1 Group PartType4 Group PartType5 Group PhysicalConstants Group Policy Group StarsParticles Soft Link {/PartType4} StarsScheme Group SubgridScheme Group Units Group UnusedParameters Group Some of the other field names within PartType0 etc are also somewhat different, e.g. MetalMassFractions instead of Metallicity. thanks, romeel _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: a.j.kelly@durham.ac.uk
participants (2)
-
KELLY, ASH J. -
Romeel Davé