I was running the following code, 7 times in a row (for 7 redshifts and respective subhalo ids), in for a loop:
params = {'stars':'Coordinates,GFM_Metallicity'}
scale_factor = 1.0 / (1+redshift)
print ('scale factor', scale_factor)
little_h = 0.704
url = "http://www.tng-project.org/api/Illustris-1/snapshots/z=" + str(redshift) + "/subhalos/" + str(subhalo_id)
sub = get(url) # get json response of subhalo properties
saved_filename = get(url + "/cutout.hdf5",params) # get and save HDF5 cutout file
all_rr = []
with h5py.File(f'path/to/{saved_filename}') as f:
# NOTE! If the subhalo is near the edge of the box, you must take the periodic boundary into account! (we ignore it here)
dx = f['PartType4']['Coordinates'][:,0] - sub['pos_x']
dy = f['PartType4']['Coordinates'][:,1] - sub['pos_y']
dz = f['PartType4']['Coordinates'][:,2] - sub['pos_z']
rr = np.sqrt(dx**2 + dy**2 + dz**2)
rr *= scale_factor/little_h # ckpc/h -> physical kpc
all_rr.append(rr)
when my CPU complained and the computer restarted. Since then, I can't seem to get results and get always the following error:
I was running the following code, 7 times in a row (for 7 redshifts and respective subhalo ids), in for a loop:
when my CPU complained and the computer restarted. Since then, I can't seem to get results and get always the following error:
HTTPError Traceback (most recent call last)
/var/folders/dx/dfb8h2h925l7vmm7y971clpw0000gn/T/ipykernel_69363/1605062721.py in
17 {'redshift_9':{'simulation_id':35, 'subhalo_id':265,'redshift':9}}]
18
---> 19 dx, dy, dz, ll = sample_stars_distances(sim_id=100, subhalo_id=99, redshift=0.57)
20
21
/var/folders/dx/dfb8h2h925l7vmm7y971clpw0000gn/T/ipykernel_69363/960352854.py in sample_stars_distances(sim_id, subhalo_id, redshift)
16 url = "http://www.tng-project.org/api/Illustris-1/snapshots/z=" + str(redshift) + "/subhalos/" + str(subhalo_id)
17 sub = get(url) # get json response of subhalo properties
---> 18 saved_filename = get(url + "/cutout.hdf5",params) # get and save HDF5 cutout file
19
20 all_rr = []
/var/folders/dx/dfb8h2h925l7vmm7y971clpw0000gn/T/ipykernel_69363/1325306943.py in get(path, params)
10
11 # raise exception if response code is not HTTP SUCCESS (200)
---> 12 r.raise_for_status()
13
14 if r.headers['content-type'] == 'application/json':
~/anaconda2/envs/ia/lib/python3.7/site-packages/requests/models.py in raise_for_status(self)
951
952 if http_error_msg:
--> 953 raise HTTPError(http_error_msg, response=self)
954
955 def close(self):
HTTPError: 500 Server Error: Internal Server Error for url: https://data-eu.tng-project.org/cutout/subhalo/L75n1820FP/100/99/0.0.0.0.5.0/?token=904c624adb97917b79ab
Can anyone help me troubleshooting this error?
This should be all fixed now, let me know if not.
(Cutouts and other advanced functionality was broken yesterday (April 14 2022).