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?