I'm working with fits images and trying to translate IDL code to python but I'm having trouble understanding how to translate the IDL median()
and rot()
functions. I have an array im_darksub
that is (ny, nx, n_im)
where nx,ny
is the shape of each image and n_im
is the number of images (working with 12 images total). I trying to translate the IDL code im_median = median(im_darksub,dimension=1)
and im_medrot = rot(im_median,85,cubic=-0.5)
. I thought that I could just translate this to np.median()
and spicy.misc.imrotate
, but I keep getting an error when I use imrotate
:
Traceback (innermost last):
File "<console>", line 1, in <module>
File "/Users/courtneywatson1/Ureka/python/lib/python2.7/site-packages/scipy/misc/pilutil.py", line 345, in imrotate
im = toimage(arr)
File "/Users/courtneywatson1/Ureka/python/lib/python2.7/site-packages/scipy/misc/pilutil.py", line 234, in toimage
raise ValueError("'arr' does not have a suitable array shape for "
ValueError: 'arr' does not have a suitable array shape for any mode.
Which I'm guessing is because my image array is more than 2 or 3D? Is there a python equivalent for the IDL median()
and rot()
functions the way I am using them?