Hello, I downloaded a cutout (a subhalo) using the Group Catalog Search (TNG 300-1). When I open with h5py in python, I can look at the keys in the groups 'PartTypeX', but when I try to look at the keys in the 'Header' group, I get an empty result [ ]. This is also true for the 'Parameters' and 'Config' groups. I thought maybe it was because I didn't download the entire snapshot, so I tried to download one of 15 files in the z = 0 snapshot from TNG 300-3 to see if it changed, but the results is still empty. Is there something wrong with what I'm doing? This is what I do:
d = h5py.File('filename.hdf5')
header = d['Header']
If someone can help with this, that would be appreciated. I really need this information to proceed with my work. Thanks so much!
The information there is going to be in attributes (instead of datasets).
Hi Dylan, thanks for the response. However when I use f.attrs('Header'), where f is what I called my file, as in f h5py.File('cutout_83280.hdf5'), and I'm getting an error TypeError: 'AttributeManager' object is not callable.
Am I using it incorrectly? In the link you sent above, it looks like the example says you can essentially set a value for some specified attribute, but I'm not looking to do that; I want to look into the values inside the Header group (which includes the Redshift I'm looking at; this is one of the things I need). Am I misunderstanding something about the attribute function? Am I supposed to use it to tell python what redshift I want it to be? I just find this a bit strange since Illustris lists the Redshift as one of the keys available under the Header group, so I must just be misunderstanding how to use it. Thanks again.
More like f['Header'].attrs or header = dict(f['Header'].attrs).
header = dict(f['Header'].attrs)
Thanks, this worked. However, I'm still not seeing the Redshift attribute in Header, which according to the website, should be there. Instead, I'm getting the following:
'BoxSize': 75000.0, 'Omega0': 0.3089, 'OmegaLambda': 0.6911, 'OmegaBaryon': 0.0486, 'HubbleParam': 0.6774, 'Git_commit': b'd203ec8b07c7e2bdda5f608aa0babea46d603699', 'Git_date': b'Thu Apr 7 14:14:27 2016 +0200', 'UnitLength_in_cm': 3.085678e+21, 'UnitMass_in_g': 1.989e+43, 'UnitVelocity_in_cm_per_s': 100000.0
Looks to me like, according to the Illustris site, the Redshift attribute should be located right after OmegaLambda. Has this changed, or is it just the file I have? Do you find Redshift in any of your files?? Thanks.
I'm not sure what file you are looking at exactly? You will find both Redshift and Time (scalefactor) in every group catalog and snapshot file.
I've also added these two fields to "snapshot cutouts" (of particle data), in case you would like to get them from there.
Oh I think I understand, you mean it's located in the halo catalog? Can you help me find that for the cutouts?? That's the next thing I'll need for my work. Is it included as an option to download in the cutouts section (the one where I specify which particle data I want to download)?
If you download a cutout (where you can pick which particle types/fields to include) from TNG, it will now include Redshift in the Header attributes.
If you download any files of the group catalogs or snapshots, these will also include the same information.
Just to clarify: if I download a cutout (particle data) from the group catalog search, does it come with the group catalog?
Actually, I think I understand how to get the group catalog and all the info (the GET command). However, how can I use it and give my key? It would require a key, correct? As doing simply
curl -X GET www.tng-project.org/api/TNG300-1/snapshots/99/subhalos/120494/
gives a failed session authorization error. How do I let it know my authorization key? By the way thanks a lot for bearing with me!I think I should be okay once I get this part.
Actually I think I figured it out!! Thanks a bunch.