[yt-dev] Issues with 3D convolution and reshaping data?
Rasmi Elasmar
re2300 at columbia.edu
Mon Aug 8 12:49:07 PDT 2016
Hi all,
I'm trying to gaussian smooth a 3D field of gas. I'm convolving the field
with a gaussian kernel, but my results look odd. I think this might be
because of how I'm reshaping my data. You can see my scripts here
<https://github.com/rasmi/deviant-cosmology/blob/master/scripts/convolve.py>
and here
<https://github.com/rasmi/deviant-cosmology/blob/4f6b4886c01c92cfe3987d4a66e25ba84ecebf86/scripts/convolve.py>,
and a more detailed explanation with plots here
<https://github.com/astropy/astropy/issues/5169#issuecomment-238304706>.
My suspicion (and someone from astropy's) is that I'm reshaping data
improperly. I access the fields like this:
ad = ds.all_data()
density = ad[fields['density']]
Which gives me a 1D array of length (1024^3) = 1073741824. To convolve this
with a 3D gaussian kernel, I attempt to reshape the 1D array into its
original 3D shape:
density = density.reshape(ds.domain_dimensions)
Which gives me a 3D 1024^3 matrix, but I'm not sure if this is correct.
Does this correctly transform the 1D data from ds.all_data()[field] back
into its 3D grid, or are things being misaligned somehow? Is there a better
way to access a certain field's data in 3D without getting it in 1D first
and reshaping?
Thanks,
Rasmi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20160808/4af4ece7/attachment.htm>
More information about the yt-dev
mailing list