end_time = time.time() delta_t = end_time - start_time print "processing subhalo " + str( this_sub_num) + " out of " + str( n_subs) + " on task" + str( this_task) + " (avg t = " + str( delta_t / count) + " secs)" start_time = time.time() count = 1 if sfr[this_sub_num] > 0: count += 1 gas_particle_masses = readhaloHDF5.readhalo(dir, 'snap', snap[0], 'MASS', 0, -1, this_sub_num, run=run) gas_particle_densities = readhaloHDF5.readhalo(dir, 'snap', snap[0], 'RHO ', 0, -1, this_sub_num, run=run) gas_particle_sfr = readhaloHDF5.readhalo(dir, 'snap', snap[0], 'SFR ',
inte = f['PartType0']['InternalEnergy'][:] elec = f['PartType0']['ElectronAbundance'][:] #x_e = n_e/n_H except KeyError: gas = False else: readhaloHDF5.reset() try: # Gas coords = readhaloHDF5.readhalo( args.local, "snap", snapnum, "POS ", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32") dens = readhaloHDF5.readhalo(args.local, "snap", snapnum, "RHO ", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32") mass = readhaloHDF5.readhalo(args.local, "snap",
readhaloHDF5.reset() # dm_coords = readhaloHDF5.readhalo(args.local, "snap", snapnum, # "POS ", 1, -1, sub_id, long_ids=True, # double_output=False).astype("float32") # dm_mass = readhaloHDF5.readhalo(args.local, "snap", snapnum, # "MASS", 1, -1, sub_id, long_ids=True, # double_output=False).astype("float32") try: # Gas coords = readhaloHDF5.readhalo( args.local, "snap", snapnum, "POS ", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32") vel = readhaloHDF5.readhalo(args.local, "snap", snapnum, "VEL ", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32")
file = folder+"stellar_cutouts/cutout_{}.hdf5".format(sub_id) try: with h5py.File(file) as f: coords = f['PartType4']['Coordinates'][:,:] a = f['PartType4']['GFM_StellarFormationTime'][:] # as scale factor init_mass = f['PartType4']['GFM_InitialMass'][:] metals = f['PartType4']['GFM_Metallicity'][:] except KeyError: # PartType4 doesn't exist for some reason print("No PartType4 for subhalo", sub_id) # Otherwise get this information from the local snapshot else: readhaloHDF5.reset() coords = readhaloHDF5.readhalo(args.local, "snap", snapnum, "POS ", 4, -1, sub_id, long_ids=True, double_output=False).astype("float32") a = readhaloHDF5.readhalo(args.local, "snap", snapnum, "GAGE", 4, -1, sub_id, long_ids=True, double_output=False).astype("float32") init_mass = readhaloHDF5.readhalo(args.local, "snap", snapnum, "GIMA", 4, -1, sub_id, long_ids=True, double_output=False).astype("float32") metals = readhaloHDF5.readhalo(args.local, "snap", snapnum, "GZ ", 4, -1, sub_id, long_ids=True, double_output=False).astype("float32") stars = a > 0
for sub_id in my_subs[good_ids]: # Get half mass radius sub = get(url_sbhalos + str(sub_id)) gas = True readhaloHDF5.reset() try: # Gas coords = readhaloHDF5.readhalo(args.local, "snap", snapnum, "POS ", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32") mass = readhaloHDF5.readhalo(args.local, "snap", snapnum, "MASS", 0, -1, sub_id, long_ids=True, double_output=False).astype("float32") dens = readhaloHDF5.readhalo(args.local, "snap",