Here’s what I think is happening. A weighted projection is the line integral of a field times a weight field over the line integral of the weight field.

When using “ones” as your weight field you might expect that the denominator should be the same for both of your projections: the total length you’re projecting along. But, that’s not what yt is doing here. Since you’re only including zones above some threshold, the denominator for the cut region is projection is smaller systematically (it varies depending on how many zones along the line of sight are discarded), yielding systematically higher values in the final result.

What you want is an unweighted projection, which is independent of the path length. That’s the reason yt returns unweighted projections as surface densities, it really is independent of the path length and we don’t try to make a possibly ambiguous choice about what the “right” path length is.

If you really want the units to be of a volume density instead of a surface density, you could get the image array as I referred to in my original reply and then multiply the image by a path length, e.g.:


    from yt.units import kpc
    image *= 300*kpc

And then plot the image manually with matplotlib.

I think it might be useful to add an option for yt to compute unweighted projections in this way so you could continue using ProjectionPlot directly, but that’s not the way ProjectionPlot works right now.

On Thu, Jul 11, 2019 at 1:47 PM Andrew Wu <andrewmw@princeton.edu> wrote:
Yeah, I'm not sure if using the weight_field 'ones' is the best method. Is there a better way to find the average of the projected value of density? Basically projecting and dividing by the depth of projection. I would prefer to have a plot with 3-dimensional density units (e.g. g/cm^3).
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org