<div dir="ltr">Hi Geoffrey,<div><br></div><div>I'm not very familiar with the star formation rate calculator, but if you think there is a bug I'd encourage you to submit a pull request with a fix.</div><div><br></div>

<div>-Nathan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 6:37 PM, Geoffrey So <span dir="ltr"><<a href="mailto:gsiisg@gmail.com" target="_blank">gsiisg@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There seems to be a bug in the star formation rate density calculation routine.  The volume is only the real 'proper volume' at the current redshift and not at any other redshifts, because it uses the current redshift in the calculation of proper volume in all redshifts.<div>


<br></div><div>#---------------------------------</div><div><div>from yt.mods import *</div><div>from yt.analysis_modules.star_analysis.api import *</div><div>import pylab</div><div><br></div><div>pf=load('HD1200/HD1200')</div>


<div>dd=pf.h.all_data()</div><div>sfr = StarFormationRate(pf, data_source=dd, bins=10)</div><div>sfr.write_out(name="StarFormationRate.out")</div><div>time, lookback, z, Msolyr, MsolyrMpc3, Msol, cumMsol=na.loadtxt('StarFormationRate.out',usecols=(0,1,2,3,4,5,6),skiprows=2,unpack=True)</div>


<div><br></div><div>cMpc3,=pylab.plot(z,Msolyr/(pf['CosmologyComovingBoxSize']/pf['CosmologyHubbleConstantNow'])**3)</div><div>currentz,=pylab.plot(z,MsolyrMpc3/(1+pf.current_redshift)**3+1e-5)</div><div>

Expect,=pylab.plot(z,MsolyrMpc3/(1+z)**3)</div>
<div><br></div><div>pylab.legend([cMpc3,currentz,Expect],</div><div>             ['[s$^{-1}$cMpc$^{-3}$]',</div><div>              'use only current z to fit',</div><div>              'Expected to fit'])</div>


<div><br></div><div>pylab.savefig('SFRD.eps')</div></div><div>#---------------------------------</div><div><br></div><div><br></div><div>in the file:</div><div>yt/analysis_modules/star_analysis/sfr_spectrum.py<br>


<div>line 151:</div><div><div>            self.Msol_yr_vol.append(self.mass_bins[i] / \</div><div>                (self.time_bins_dt[i] * tc / YEAR) / vol)</div></div></div><div><br></div><div>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.</div>


<div><br></div><div>So I think a couple lines above it should create an empty array of vol</div><div>vol = []</div><div>In the loop</div><div>for i, time…</div><div>calculate the right volume vol[i]</div><div>Then instead of dividing by the constant vol, divide by vol[i] corresponding to the right redshift.</div>


<div><div>            self.Msol_yr_vol.append(self.mass_bins[i] / \</div><div>                (self.time_bins_dt[i] * tc / YEAR) / vol[i])</div></div><div><br></div><div>From</div><span class="HOEnZb"><font color="#888888"><div>

G.S.</div><div><br></div><div><br></div>
</font></span></div>
<br>_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
<br></blockquote></div><br></div>