I recently downloaded a subset of the snapshot data, including the following fields for Gas particles: Coordinates, Density, ElectronAbundance, Masses, NeutralHydrogenAbundance, and Volume.
The subset-hdf5 files downloaded do not have the regular header information that is present in the complete files. I was wondering if I need to add specific commands in my API request such that it keeps the header information in the files (the code I used is posted below). I did not find a mention of this in the API access help page.
# make HTTP GET request to path
headers = {"api-key":}
r = requests.get(path, params=params, headers=headers)
# raise exception if response code is not HTTP SUCCESS (200)
r.raise_for_status()
if r.headers['content-type'] == 'application/json':
return r.json() # parse json responses automatically
if 'content-disposition' in r.headers:
filename = r.headers['content-disposition'].split("filename=")[1]
with open(filename, 'wb') as f:
f.write(r.content)
return filename # return the filename string
return r
Particle cutouts currently include a header which has the following fields
header.attrs["SimulationName"] = sim_name
header.attrs["SnapshotNumber"] = number
header.attrs["CutoutType"] = type
header.attrs["CutoutID"] = id
header.attrs["CutoutRequest"] = reqString
Do you see this?
Is there something else you need in particular?
Nihan Pol
9 Nov '17
My data only has the following information in the header, which I believe is the cutout request I made.
I need the information listed in table "Header" at this URL . I don't seem to have that in my data.
But I'm trying to compute the evolution of properties over different snapshots. I believe the number of particles (gas) will stay constant, but surely other quantities such as the redshift and box size will change with respect to redshift?
Is there an easy way to obtain just the header information for all snapshots, like for example, through the API?
Dylan Nelson
9 Nov '17
Hi Nihan,
Here in the API you have a list of every snapshot and their redshifts (for one simulation):
If you want some additional details for every snapshot (e.g. the number of gas particles, which changes), then you can loop over them and save the result, something like
snaps = get('http://www.illustris-project.org/api/Illustris-1/snapshots/')
for snap in snaps:
snap_info = get(snap['url'])
print(snap_info['number'], snap_info['num_gas'])
Nihan Pol
9 Nov '17
Hi Dylan,
Thanks for this piece of code. I think this should give me what I need. Let me try this out, and I will get back to you when I finish running it.
Cheers,
Nihan
Nihan Pol
9 Nov '17
Hi Dylan,
Your suggestion gives me exactly what I want! Thanks a lot!
I recently downloaded a subset of the snapshot data, including the following fields for Gas particles: Coordinates, Density, ElectronAbundance, Masses, NeutralHydrogenAbundance, and Volume.
The subset-hdf5 files downloaded do not have the regular header information that is present in the complete files. I was wondering if I need to add specific commands in my API request such that it keeps the header information in the files (the code I used is posted below). I did not find a mention of this in the API access help page.
[Updated question to remove my API key]
'''''''''''''''''''Code'''''''''''''''''''''''''''''''''
import requests, numpy as np
baseUrl = 'http://www.illustris-project.org/api/Illustris-3/'
headers = {"api-key":}
def get(path, params = None):
sim_metadata = get(baseUrl) params = {'gas': 'Coordinates,Density,ElectronAbundance,Masses,NeutralHydrogenAbundance,Volume'}
for ii in np.arange(0, 135, 1)[:: -1]:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Hi,
Particle cutouts currently include a header which has the following fields
Do you see this?
Is there something else you need in particular?
My data only has the following information in the header, which I believe is the cutout request I made.
I need the information listed in table "Header" at this URL . I don't seem to have that in my data.
[(u'CutoutRequest', 'PartType0=Coordinates,Density,ElectronAbundance,Masses,NeutralHydrogenAbundance,Volume')]
Hi Nihan,
All those
Header
fields will be constant for an entire snapshot or simulation, so I would recommend you just grab them from e.g. (for Illustris-1)But I'm trying to compute the evolution of properties over different snapshots. I believe the number of particles (gas) will stay constant, but surely other quantities such as the redshift and box size will change with respect to redshift?
Is there an easy way to obtain just the header information for all snapshots, like for example, through the API?
Hi Nihan,
Here in the API you have a list of every snapshot and their redshifts (for one simulation):
If you want some additional details for every snapshot (e.g. the number of gas particles, which changes), then you can loop over them and save the result, something like
Hi Dylan,
Thanks for this piece of code. I think this should give me what I need. Let me try this out, and I will get back to you when I finish running it.
Cheers,
Nihan
Hi Dylan,
Your suggestion gives me exactly what I want! Thanks a lot!
Cheers,
Nihan