[yt-users] Projection disagrees with original data.
Hansheng Chen
jasonhs1221 at gmail.com
Mon Jun 27 09:59:08 PDT 2016
Hello yt users,
I have a question about projection. I used ds.proj() and to_frb() to get an
image array of the projected 'Electron_Density' of an entire dataset. I
multiplied the mean of projected 'Electron_Density' by the entire area of
x-y plane and got a sum of total mass of electrons. Then, I used
ds.all_data() and mean() to get the mean of 'Electron_Density' in
3-dimensional. I multiplied the mean by the volume of the entire box of the
dataset and got another sum of total mass of electrons. However, this sum
did not match the sum I got from the projected 'Electron_Density'
previously. Here are the codes I used:
import yt
import numpy as np
ds = yt.load("redshift0100/redshift0100")
print("Redshift =", ds.current_redshift)
p = yt.ProjectionPlot(ds, 2, 'Electron_Density')
density_image = p.frb['Electron_Density']
ed = density_image['Electron_Density'].convert_to_cgs()
ed_ndarr = ed.to_ndarray()
sum1 = ed_ndarr.mean() * ((105.82 * 3.085677581e+24)**2)
print(sum1)
dd = ds.all_data()
ed_3d = dd['Electron_Density'].convert_to_cgs()
sum2 = ed_3d.mean() * ((105.82 * 3.085677581e+24)**3)
print(sum2)
(105.82 * 3.085677581e+24) is the width of entire box in cm. I think sum1
and sum2 should be close to each other, but the result was that the two
values did not match with each other. Is there any problem in the codes I
used to get the values of sum1 and sum2? Could some one give me some help?
Thank you very much!
Sincerely,
Hansheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160627/99718a76/attachment.htm>
More information about the yt-users
mailing list