- ccdproc.trim_image(ccd, fits_section=None)¶
Trim the image to the dimensions indicated.
CCD image to be trimmed, sliced if desired.
- fits_sectionstr or None, optional
ccdfrom which the overscan is extracted; see
subtract_overscanfor details. Default is
Keywordor dict-like, optional
Item(s) to add to metadata of result. Set to False or None to completely disable logging. Default is to add a dictionary with a single item: The key is the name of this function and the value is a string containing the arguments the function was called with, except the value of this argument.
Given an array that is 100x100,
>>> import numpy as np >>> from astropy import units as u >>> arr1 = CCDData(np.ones([100, 100]), unit=u.adu)
the syntax for trimming this to keep all of the first index but only the first 90 rows of the second index is
>>> trimmed = trim_image(arr1[:, :90]) >>> trimmed.shape (100, 90) >>> trimmed.data[0, 0] = 2 >>> arr1.data[0, 0] 1.0
This both trims and makes a copy of the image.
Indexing the image directly does not do the same thing, quite:
>>> not_really_trimmed = arr1[:, :90] >>> not_really_trimmed.data[0, 0] = 2 >>> arr1.data[0, 0] 2.0
In this case,
not_really_trimmedis a view of the underlying array
arr1, not a copy.