from yt.mods import *
from yt.analysis_modules.star_analysis.api import *
import pylab
pf=load('HD1200/HD1200')
dd=pf.h.all_data()
sfr = StarFormationRate(pf, data_source=dd, bins=10)
sfr.write_out(name="StarFormationRate.out")
time, lookback, z, Msolyr, MsolyrMpc3, Msol, cumMsol=na.loadtxt('StarFormationRate.out',usecols=(0,1,2,3,4,5,6),skiprows=2,unpack=True)
cMpc3,=pylab.plot(z,Msolyr/(pf['CosmologyComovingBoxSize']/pf['CosmologyHubbleConstantNow'])**3)
currentz,=pylab.plot(z,MsolyrMpc3/(1+pf.current_redshift)**3+1e-5)
Expect,=pylab.plot(z,MsolyrMpc3/(1+z)**3)
pylab.legend([cMpc3,currentz,Expect],
['[s$^{-1}$cMpc$^{-3}$]',
'use only current z to fit',
'Expected to fit'])
pylab.savefig('SFRD.eps')
The vol is a fixed number instead of varying by the redshift, even though the numerator in solar masses per year is from different redshifts.
Then instead of dividing by the constant vol, divide by vol[i] corresponding to the right redshift.
G.S.