def __init__(self, indatfile , name = None , TKFile = None ) : if name == None: self.name = "" else: self.name = name haccdict = ioutils.builddict(indatfile , dictdelim = " " ) #set cosmo: from interfaces import FCPL H0 , Omega_m , Omega_nu , Omega_b, w0, wa, sigma8 , ns = _hacccosmo(indatfile) h = H0/ 100. sigma_mnu = Omega_nu*94.0 *h *h #print sigma_mnu #sys.exit() print "From indat " , Omega_nu self.cosmo = FCPL ( H0 = H0 , Om0 = Omega_m , Ob0 = Omega_b , sigmamnu = sigma_mnu , w0 = w0, wa = wa, sigma8 = sigma8 , ns = ns) print "From cosmo " , self.cosmo.On0 #set sim properties haccsimdict = simdict (haccdict ) #set massresolution Omegacb0 = self.cosmo.Ob0 + self.cosmo.Oc0 self._boxsize = haccsimdict ['RL'] self._numparticlescuberoot = haccsimdict['NP'] self._particlemass = particlemass(Omega = Omegacb0 , lengthcuberoot = self._boxsize, numparticlescuberoot = self._numparticlescuberoot , h = self.cosmo.h ) #set time stepping info self._zin = haccsimdict["Z_IN"] self._zf = haccsimdict["Z_FIN"] self._numtimesteps = haccsimdict["N_STEPS"]
class haccsim (object ) : """ BUG FIX: sigmamnu calculation from Omega_nu corrected for factor of h^2 : R. Biswas, Wed Apr 23 00:50:38 CDT 2014 """ def __init__(self, indatfile , name = None , TKFile = None ) : if name == None: self.name = "" else: self.name = name haccdict = ioutils.builddict(indatfile , dictdelim = " " ) #set cosmo: from interfaces import FCPL H0 , Omega_m , Omega_nu , Omega_b, w0, wa, sigma8 , ns = _hacccosmo(indatfile) h = H0/ 100. sigma_mnu = Omega_nu*94.0 *h *h #print sigma_mnu #sys.exit() print "From indat " , Omega_nu self.cosmo = FCPL ( H0 = H0 , Om0 = Omega_m , Ob0 = Omega_b , sigmamnu = sigma_mnu , w0 = w0, wa = wa, sigma8 = sigma8 , ns = ns) print "From cosmo " , self.cosmo.On0 #set sim properties haccsimdict = simdict (haccdict ) #set massresolution Omegacb0 = self.cosmo.Ob0 + self.cosmo.Oc0 self._boxsize = haccsimdict ['RL'] self._numparticlescuberoot = haccsimdict['NP'] self._particlemass = particlemass(Omega = Omegacb0 , lengthcuberoot = self._boxsize, numparticlescuberoot = self._numparticlescuberoot , h = self.cosmo.h ) #set time stepping info self._zin = haccsimdict["Z_IN"] self._zf = haccsimdict["Z_FIN"] self._numtimesteps = haccsimdict["N_STEPS"] @property def numparticles (self) : npcuberoot = self._numparticlescuberoot return npcuberoot * npcuberoot * npcuberoot @property def particlemass (self) : return self._particlemass @property def boxsize (self) : return self._boxsize @property def simvolume (self) : l = self._boxsize return l*l*l @property def initialredshift (self ) : return self._zin @property def numtimesteps (self ) : return self._numtimesteps @property def finalredshift (self ) : return self._zf #Methods def steptoredshift(self , step ) : zin = self.initialredshift #print zin zf = self.finalredshift #print zf numsteps = self.numtimesteps return haccredshiftsforstep(step , zin = zin , zfinal = zf , numsteps = numsteps) def summary (self , logfilename = None) : s = "SUMMARY OF simulation, name = "+ self.name s += "\n\n========================================\n\n" s += "Cosmology\n====================\n" s += self.cosmo.summary() #s += "massive neutrino energy density " + str(self.cosmo.On0) + "\n" s += "Simulation Properties\n=====================\n\n" s += "Simulation Volume ("+ "{:.2e}".format(self._boxsize) +r'$)^3 h^{-3} Mpc^3$'+" \n" s += "Particle Mass = "+ "{:.2e}".format(self.particlemass)+"r'$h^{-1} M_\odot'$\n" if logfilename != None: f = open(logfilename, "w") f.write(s) f.close() return s