
My hdf5 file looks something like this Header ... PartType0 Coordinates ... ElementAbundance Hydrogen Helium ... Mass .... PartType4 ... I know how to read some data ds = yt.load(fname) ad = ds.all_data() print(ad[('PartType0', 'Mass')]) .... but I don't know how to read the data such as Hydrogen in ElementAbundance in PartType0 How can I do that?

Hi! I think yt should be able to handle this data, but it's possible that it isn't being handled exactly right now. You can see all the fields that are registered for PartType0 by looking at: ds.particle_fields_by_type which is a dictionary keyed by particle types. You may see particle types there that are aliases of ones in the file; for instance, "gas" gets aliased to the SPH particles. yt also has a ds.fields object which has sub-objects for each field type (including particles) to see what is available, and if you're in a jupyter notebook you can do: ds.fields and it will show you an interactive panel with all the fields and their derivations. If you can't find the right hydrogen abundance field, it's possible we're not picking it up in this specific file format, which should be an easy fix -- so let us know! -Matt On Fri, Apr 15, 2022 at 5:11 AM <tylee@khu.ac.kr> wrote:

Thanks Matt but I couldn't solve the problem I wasn't asking properly I think yt is reading the data but not the way I want it to be PartType0 ElementAbundance Hydrogen (total 8 elements) ... ElementAbundanceHypernova (total 32 elements) I'm using multiple datasets for elements When I check the fields such as ds.particle_fields_by_type['PartType0'] or ds.field_list I could find this ('PartType0', 'Hydrogen') ... however, it only has 8 elements not 32 elements I added More, 8 elements(ElementAbundance) are also in 32 elements(ElementAbundanceHypernova) so reading as it does will be confusing for me ElementAbundance : Carbon <-> ElementAbundanceHypernova : carbon ('PartType0', 'Carbon') <-> ('PartType0', 'Carbon') I am hoping to know the way to read ElementAbundaceHypernova like h5py with yt f = h5pr.File(snapshot.hdf5, 'r') HN_hydrogen = f['/PartType0/ElementAbundanceHypernova/Hydrogen'] Pop3_hydrogen = f['/PartType0/ElementAbundancePop3/Hydrogen'] - TY

Hi! I think yt should be able to handle this data, but it's possible that it isn't being handled exactly right now. You can see all the fields that are registered for PartType0 by looking at: ds.particle_fields_by_type which is a dictionary keyed by particle types. You may see particle types there that are aliases of ones in the file; for instance, "gas" gets aliased to the SPH particles. yt also has a ds.fields object which has sub-objects for each field type (including particles) to see what is available, and if you're in a jupyter notebook you can do: ds.fields and it will show you an interactive panel with all the fields and their derivations. If you can't find the right hydrogen abundance field, it's possible we're not picking it up in this specific file format, which should be an easy fix -- so let us know! -Matt On Fri, Apr 15, 2022 at 5:11 AM <tylee@khu.ac.kr> wrote:

Thanks Matt but I couldn't solve the problem I wasn't asking properly I think yt is reading the data but not the way I want it to be PartType0 ElementAbundance Hydrogen (total 8 elements) ... ElementAbundanceHypernova (total 32 elements) I'm using multiple datasets for elements When I check the fields such as ds.particle_fields_by_type['PartType0'] or ds.field_list I could find this ('PartType0', 'Hydrogen') ... however, it only has 8 elements not 32 elements I added More, 8 elements(ElementAbundance) are also in 32 elements(ElementAbundanceHypernova) so reading as it does will be confusing for me ElementAbundance : Carbon <-> ElementAbundanceHypernova : carbon ('PartType0', 'Carbon') <-> ('PartType0', 'Carbon') I am hoping to know the way to read ElementAbundaceHypernova like h5py with yt f = h5pr.File(snapshot.hdf5, 'r') HN_hydrogen = f['/PartType0/ElementAbundanceHypernova/Hydrogen'] Pop3_hydrogen = f['/PartType0/ElementAbundancePop3/Hydrogen'] - TY
participants (2)
-
Matthew Turk
-
tylee@khu.ac.kr