import gadget as gd import numpy as np import sys sn = gd.Snapshot( sys.argv[1]) # le ponemos el primer alrgumento de bash, la cual es la ruta Gas = [] Dark = [] Gas.append(sn.part0.pos[:, 0]) Gas.append(sn.part0.pos[:, 1]) Gas.append(sn.part0.pos[:, 2]) Gas.append(sn.part0.vel[:, 0]) Gas.append(sn.part0.vel[:, 1]) Gas.append(sn.part0.vel[:, 2]) Gas.append(sn.part0.mass) Dark.append(sn.part1.pos[:, 0]) Dark.append(sn.part1.pos[:, 1]) Dark.append(sn.part1.pos[:, 2]) Dark.append(np.ones(np.shape(Dark)[1]) * sn.masses[1]) Gas = np.array(Gas).T Dark = np.array(Dark).T np.savetxt(str('SNAPSHOT' + sys.argv[2]) + 'Gas.csv', Gas, delimiter=',', fmt='%s') np.savetxt(str('SNAPSHOT' + sys.argv[2]) + 'Dark.csv', Dark, delimiter=',', fmt='%s')
#=============================================================== """ *********************************** --> Lectura snapshots *********************************** """ print("-----------------------------------\n") print("Inicia asignacion de los snapshots\n") Sn_bh = gadget.Snapshot('/home/dmontenegro/Data/Sims512/cosmobh01/snapdir_015/snap_015.0.hdf5', parttype=[5], combineFiles=True, verbose=True) #Sn_bh = gadget.Snapshot('../../Data/snap_015.0.hdf5', parttype=[5]) #====> Asignacion de datos Spin_bh=Sn_bh.BH_SpinOrientation #Spin de los black hole r_bh = Sn_bh.Coordinates # cordanada en x,y,z Mass_bh = Sn_bh.BH_Mass*1e10/0.7 vel_disp_bh = Sn_bh.SubfindVelDisp ##km/s vel_bh = Sn_bh.Velocities ##km*sqrt(a)/s print("-----------------------------------\n")
print(":::::::::::::::::::::::::::::::::::::\n") print("Termina graficas de control halos\n") #=============================================================== """ *********************************** --> Lectura snapshots *********************************** """ print("-----------------------------------\n") print("Inicia asignacion de los snapshots\n") #Sn_bh = gadget.Snapshot('../../Data/snap_015.0.hdf5', parttype=[5], combineFiles=True, verbose=True) Sn_bh = gadget.Snapshot('../../Data/snap_015.0.hdf5', parttype=[5]) #====> Asignacion de datos Spin_bh = Sn_bh.BH_SpinOrientation #Spin de los black hole r_bh = Sn_bh.Coordinates # cordanada en x,y,z Mass_bh = Sn_bh.BH_Mass * 10e10 / 0.7 vel_disp_bh = Sn_bh.SubfindVelDisp ##km/s vel_bh = Sn_bh.Velocities ##km*sqrt(a)/s print("-----------------------------------\n") print("Termina asignacion de los snapshots\n") print(":::::::::::::::::::::::::::::::::::::\n") print("Inicia graficas de control BH\n") """