indMstarClose = np.sum(S['m'][Sclose][Shalo][SVclose]) theheader = [Mstar, indMstar, indMstarClose] print 'header ',theheader header_string = SF.line_to_string(theheader, newline='n') np.savetxt(foutname, thetable, fmt='%1.6e', header=header_string) print 'Stellar Metallicity, ISM Metallicity, CGMMetallicity, MetalMassISM',StellarMetallicity, ISMMetallicity, CGMMetallicity, "{0:.3e}".format(MetalMassISM) print 'Cold ISM Metallicity, cold metal mass',coldISMMetallicity, "{0:.3e}".format(ISMMetalMassCold) if (do_graphics): import graphics_library as GL sendCuts = np.copy(Gclose) sendCuts[sendCuts] *= Ghalo sendCuts[sendCuts] *= TempCutCold foutname1 = str(today)+'coldgas'+Nsnapstring+'N'+str(halo_to_do)+'.pdf' GL.pluscuts_2d_desnity_hist(G, Rvir, haloX, haloY, haloZ, foutname1, Cuts=sendCuts, dolabel=False) sendCuts = np.copy(Gclose) sendCuts[sendCuts] *= Ghalo sendCuts[sendCuts] *= TempCutHot foutname1 = str(today)+'hotgas'+Nsnapstring+'N'+str(halo_to_do)+'.pdf' GL.pluscuts_2d_desnity_hist(G, Rvir, haloX, haloY, haloZ, foutname1, Cuts=sendCuts, dolabel=False) sendCuts = np.copy(Gclose) sendCuts[sendCuts] *= Ghalo sendCuts[sendCuts] *= TempCutO6 foutname1 = str(today)+'O6gas'+Nsnapstring+'N'+str(halo_to_do)+'.pdf' GL.pluscuts_2d_desnity_hist(G, Rvir, haloX, haloY, haloZ, foutname1, Cuts=sendCuts, dolabel=False) sendCuts = np.copy(Gclose) sendCuts[sendCuts] *= Ghalo
plt.savefig('./' + str(today) + 'thenewddxyzN'+str(haloN)+'.pdf') plt.clf() if doplots: count = 0 while (count < TheLen and not fake): theN = Ns[count] print 'reading particle type 4 for ',theN if (theN < 10): Nsnapstring = '00'+str(theN) elif (theN < 100): Nsnapstring = '0'+str(theN) else: Nsnapstring = str(theN) the_snapdir = './hdf5/' if (multifile): the_snapdir = './snapdir_'+Nsnapstring+'/' the_prefix ='snapshot' the_suffix = '.hdf5' foutname1a = str(today)+'image_stars'+Nsnapstring+'N'+str(haloN)+'.pdf' foutname1b = str(today)+'image_DM'+Nsnapstring+'N'+str(haloN)+'.pdf' S = readsnap(the_snapdir, Nsnapstring, 4, snapshot_name=the_prefix, extension=the_suffix) Rstars = 15.0 GL.pluscuts_2d_desnity_hist(S, Rstars, finalx[count], finaly[count], finalz[count], foutname1a, dolabel=True, extrapoints = [[finalx[count], finaly[count], finalz[count]], [x[count], y[count], z[count]], [ShalX[count], ShalY[count], ShalZ[count]]], thevmax=1e2) D = readsnap(the_snapdir, Nsnapstring, 1, snapshot_name=the_prefix, extension=the_suffix) GL.pluscuts_2d_desnity_hist(D, Rstars, finalx[count], finaly[count], finalz[count], foutname1b, dolabel=True, extrapoints = [[finalx[count], finaly[count], finalz[count]], [x[count], y[count], z[count]], [ShalX[count], ShalY[count], ShalZ[count]]], thevmax=1e2) count += 1 del(S) del(D)
haloN) + '.pdf' foutname1b = str(today) + 'image_DM' + Nsnapstring + 'N' + str( haloN) + '.pdf' S = readsnap(the_snapdir, Nsnapstring, 4, snapshot_name=the_prefix, extension=the_suffix) Rstars = 15.0 GL.pluscuts_2d_desnity_hist( S, Rstars, finalx[count], finaly[count], finalz[count], foutname1a, dolabel=True, extrapoints=[[finalx[count], finaly[count], finalz[count]], [x[count], y[count], z[count]], [ShalX[count], ShalY[count], ShalZ[count]]], thevmax=1e2) D = readsnap(the_snapdir, Nsnapstring, 1, snapshot_name=the_prefix, extension=the_suffix) GL.pluscuts_2d_desnity_hist( D, Rstars, finalx[count], finaly[count],
count_ar = [] frac_ar = [] cellmass*=1e10/h totalfrac = 0 vesc_cge_ar = potter.calculate_escape_velocity([haloX, haloY, haloZ], [x_cells, y_cells, z_cells], G, S, D, where_do_we_go*h/a) * np.sqrt(2.0) print 'halo is here ',haloX, haloY, haloZ while (count < len(x_cells)): totalfrac+=cellmass[count]/Mnewstars #vesc_cge_beta = potter2.calculate_escape_velocity([haloX, haloY, haloZ], [x_cells[count], y_cells[count], z_cells[count]], G, S, D, where_do_we_go*h/a)*np.sqrt(2.0) print count, x_cells[count], y_cells[count], z_cells[count], vesc_cge_ar[count], cellmass[count], cellmass[count]/Mnewstars, totalfrac frac_ar.append(cellmass[count]/Mnewstars) count_ar.append(count) count +=1 vesc_cge_ar = np.array(vesc_cge_ar) count_ar = np.array(count_ar) frac_ar = np.array(frac_ar) vhist_header = [Nsnap, redshift, where_do_we_go , Rstars*a/h, Mnewstars, SFR_time_range, Nnewstars, the_surface_frac, haloX, haloY, haloZ] vhist_header_string = SF.line_to_string(vhist_header, newline='n') outtable = np.column_stack([count_ar, cellmass, vesc_cge_ar, x_cells, y_cells, z_cells, frac_ar ]) foutname = str(today)+'Xsurface_list'+Nsnapstring+'N'+str(halo_to_do[workcount])+'.txt' np.savetxt(foutname, outtable, fmt='%1.6e', header=vhist_header_string) if (do_graphs): foutname1a = str(today)+'image_stars'+Nsnapstring+'N'+str(halo_to_do[workcount])+'.pdf' foutnameDM = str(today)+'image_DM'+Nsnapstring+'N'+str(halo_to_do[workcount])+'.pdf' GL.pluscuts_2d_desnity_hist(S, Rstars, haloX, haloY, haloZ, foutname1a, dolabel=True, extrapoints = [[x_cells[0], y_cells[0], z_cells[0]]], extrars=[-1]) GL.pluscuts_2d_desnity_hist(D, Rstars, haloX, haloY, haloZ, foutnameDM, dolabel=True) workcount+=1