I think there is a bigger problem here.
When you do a profile of a field (with some weight field), the values you get out are the weight-average of the field such that:
profile (field, weight_field) = Sum (field * weight_field) / Sum(weight_field)

You are comparing
profile(H2_Density) / profile(Density)
with
profile(H2_Density / Density)

Mathematically, these are not the same.

Or, in other words:
mean(x * y) != mean(x) * mean(y)

On Mon, Jan 27, 2014 at 5:24 PM, Stefano Bovino wrote:
ah... I'm binning, it also depends on the number of bins I'm using, but the discrepancy (slight) is still there):

prof3 = BinnedProfile1D(sph3, 64, "Radiuspc", 1.0e-6, 1.0e6)

In my initial setup I'm using a box of 300 pc.

Stefano

On Mon, Jan 27, 2014 at 6:20 PM, Stefano Bovino wrote:
Hi Matt,
I'm using simple data from the enzo Collapse Test (27).
It seems is mainly related to the size of the sphere I'm taking... but I don't know.

Here following a piece of my script:

c3= pf3.h.find_max("Density")[1]
sph3 = pf3.h.sphere(c3, (100, 'pc'))

...
...

lw=1.5, linestyle='--', color='r')
lw=1.5, linestyle=':', color='y')

Stefano

On Mon, Jan 27, 2014 at 6:11 PM, Matthew Turk wrote:
On Mon, Jan 27, 2014 at 12:14 PM, poetaste@gmail.com <poetaste@gmail.com> wrote:
> Hi Guys,
> I did a simple test with enzo and I tried to plot a radial profile of the
> chemical species fractions with YT.
>
> The problem is that if I use the YT function which intrinsically plot the
> fraction for a species, let's say H2I_Fraction (as usual), and compare this
> with a direct evaluation of the mass fraction:
>
> data['H2I_Density']/data['Density']
>
> I obtain some slightly different results, mostly at large radii.
>
> Anyone might explain this discrepancy!? This happens with all the species.

Without knowing what "data" here is, or how you generated it, it's tough to say.

-Matt

>
> Stefano_______________________________________________
> yt-users mailing list
> yt-users@lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org