RearrangingΒΆ
The crop
method can be used to reduce the size of a
Cube, Image or Spectrum to the smallest sub-array that retains all unmasked
pixels. In the following example, the pixels outside of an elliptical region of
an image are first masked, and then the crop method is used to select the
sub-image that just contains the unmasked elliptical region:
In [1]: import numpy as np
In [2]: import matplotlib.pyplot as plt
In [3]: from mpdaf.obj import Image
In [4]: ima = Image('obj/a370II.fits')
In [5]: center=[-1.5642, 39.9620]
In [6]: ima.mask_ellipse(center=center, radius=(80, 110), posangle=ima.get_rot(), inside=False)
In [7]: ima.shape
Out[7]: (1797, 1909)
In [8]: plt.figure()