mass-weighted Sobolev/HSML column values
Ken suggested I revisit the particles per grid-cell comparison - i.e.
Grid vs. Sob, Sob vs. HSML, and Grid vs. HSML. In order to do this so
that each grid corresponds to one value, I have to take the
mass-weighted average of the Sobolev/HSML values within a given
grid-cell:
\begin{equation*}
<\Sigma_{\rm{Sob}}>_{\rm{MW}} = \Sigma_\rm{((Sob,or,HSML)}\times \rm{mass})/\Sigma_\rm{mass}
\end{equation*}
I then have a single \(\Sigma\) value per grid-cell and can make a direct comparison:
In an ideal situation, each line would lie on the one-to-one dotted black line. Unfortunately both Sobolev and HSML values under estimate the grid values. The good news is that there isn’t much difference due to the resolution. We might have to examine more galaxies within our sims in a similar fashion to see if this under prediction takes place at the same surface densities; if that is the case we can easily incorporate some sort of correction factor. But that leads to the question - how many galaxies do we have to look at?
In making this plot I learned how to stick the legend outside of the
plot. It’s as simple as passing bbox_to_anchor to the legend() call:
legend(bbox_to_anchor=(0.1,1.05),loc=3,shadow=True,fancybox=True)
this is a tiny bit tricky in that the anchor is attached to the loc.
So if loc=3 then the anchor for the box is attached to the bottom left
corner of the legend box. Also the x,y coordinates are in absolute
figure positions. This is thanks to
matplotlib and
stack
overflow.
Next up was Ken’s concern about the histograms I was sending him.
Further inspection showed that simply passing ‘bins=50’ is not
necessarily the best idea to properly represent the data. By default
hist() takes the min & max of the data then splits it into N bins. The
problem here is that if you’re comparing two different datasets then
if they span a different range then the binsizes will differ. To
circumvent this issues I simply specified the binsize manually via
altering my histo() function call a tiny bit:
def histoit(values,COLOR,LABEL,HLS,BINSIZE=0.1):
indexes = where(values>0)[0] ##prevents -inf
vals = log10(values[indexes])
binner = arange(min(vals),max(vals),BINSIZE)
hist(vals,color=COLOR,log=True,
bins=binner,
label=LABEL,histtype='step',lw=1.5,ls=HLS)
With this quick fix the data looks much more comparable, here’s the
before and after:
[table] Before,After [/table] better right? hello?