imutil.ccdops.imslice

imutil.ccdops.imslice(
    ccd,
    trimsec,
    fill_value=None,
    order_xyz=True,
    update_header=True,
    verbose=False,
)

Slice the ~astropy.nddata.CCDData using one of trimsec, bezels, or slices.

Parameters

ccd : ~astropy.nddata.CCDData, ~numpy.ndarray

The ccd to be sliced. If ~numpy.ndarray, it will be converted to ~astropy.nddata.CCDData with dummy unit (“ADU”).

trimsec : str, int, list of int, list of slice, None

It can have several forms::

  • str: The FITS convention section to trim (e.g., IRAF TRIMSEC).
  • [list of] int: The number of pixels to trim from the edge of the image (bezel). If list, it must be [bezel_lower, bezel_upper].
  • [list of] slice: The slice of each axis (slice(start, stop, step))

If a single int/slice is given, it will be applied to all the axes.

order_xyz : bool = True

Whether the order of trimsec is in xyz order. Works only if the trimsec is bezel-like (int or list of int). If it is slice-like, trimsec must be in the pythonic order (i.e., [slice_for_axis0, slice_for_axis1, ...]). Default: True.

fill_value : None or float-like, optional. = None

If None, it removes the pixels outside of it. If given as float-like (including np.nan), the bezel pixels will be replaced with this value. Default: None.

Notes

Similar to ccdproc.trim_image or imcopy. Compared to ccdproc, it has flexibility, and can add LTV/LTM to header.