Example #1
0
 def read_gas_file(self,filename):
     p=read_set_from_file(filename,'amuse')
     mass=p.mass.number
     hsml=p.smoothing_length.number
     x=p.x.number
     y=p.y.number
     z=p.z.number
     rho=p.rho.number
     u=p.internal_energy.number
     xe=numpy.zeros_like(x)
     return create_particle_set(mass=mass | (10**10*units.MSun), h_smooth=hsml | (units.kpc), 
         x=x | (units.kpc), y=y| (units.kpc), z=z| (units.kpc), rho=rho | ((10**10*units.MSun) /(units.kpc)**3),
         xion=xe, u=u| (10**5 * units.cm/units.s)**2)
Example #2
0
 def read_src_file(self,filename):
     f=open(filename)
     lines=f.readlines()
     f.close()
     L=[]
     x=[]
     y=[]
     z=[]
     spctype=[]
     for line in lines:
       l=line.split()
       if len(l) == 9:
         L.append(float(l[6]))
         x.append(float(l[0]))
         y.append(float(l[1]))
         z.append(float(l[2]))
         spctype.append(float(l[7]))
     return create_particle_set( luminosity=numpy.array(L) | (10**48 * units.s**-1), 
         x=numpy.array(x) | (units.kpc), y=numpy.array(y)| (units.kpc), 
               z=numpy.array(z)| (units.kpc), SpcType=numpy.array(spctype))
Example #3
0
 def read_src_file(self,filename):
     f=open(filename)
     lines=f.readlines()
     f.close()
     L=[]
     x=[]
     y=[]
     z=[]
     spctype=[]
     for line in lines:
       l=line.split()
       if len(l) == 9:
         L.append(float(l[6]))
         x.append(float(l[0]))
         y.append(float(l[1]))
         z.append(float(l[2]))
         spctype.append(float(l[7]))
     return create_particle_set( luminosity=numpy.array(L) | (10**48 * units.s**-1), 
         x=numpy.array(x) | (units.kpc), y=numpy.array(y)| (units.kpc), 
               z=numpy.array(z)| (units.kpc), SpcType=numpy.array(spctype))