imutil.ccdops.imcut

imutil.ccdops.imcut(
    data,
    position,
    size,
    mode='trim',
    fill_value=np.nan,
    copy=True,
)

Return a fast 2-D rectangular image cutout without metadata handling.

Parameters

data : ~numpy.ndarray or ~astropy.nddata.CCDData

Input image. If ~astropy.nddata.CCDData, only data.data is used.

position : 2-element sequence

Cutout center in (x, y) pixel order, matching ~astropy.nddata.Cutout2D.

size : scalar or 2-element sequence

Cutout size. A scalar makes a square cutout. A 2-element sequence is in NumPy shape order (ny, nx).

mode : (trim, partial, strict) = 'trim'

'trim' returns only the overlapping region. 'partial' returns the requested shape and fills non-overlapping pixels with fill_value. 'strict' requires the full requested box to lie inside the input image.

fill_value : number = np.nan

Fill value used only for mode='partial'.

copy : bool = True

Whether to copy the returned cutout for 'trim' and 'strict'. 'partial' always allocates a new array.