get_pinpos¶
- sofia_redux.instruments.forcast.undistort.get_pinpos(header, pinpos=None, rotate=False)[source]¶
Get the pinhole model and coefficients and update header.
The majority of this code sanity checks pin positions and model positions. If the user has not supplied the pinpos dict, one will be retrieved from the drip configuration or from a default set defined in this file (not recommended). Note that if the header contains the PIN_MOD keyword it will override ‘dx’, ‘dy’, ‘angle’, and ‘order’ from any other source.
The user may optionally rotate the image by NODANGLE in the header. If the angle is non-zero, the model will be rotated around the center of the image and be rescaled by a factor of two. Note that we are not interested in scaling or offsets at this point as only the relative warping between points is important. Offsets and scalings will be determined during the WCS correction and re-binning steps.
The PIN_MOD keyword in the header will be updated to contain values as a string in the format ‘[dx,dy,angle,order]’ where all values are described under the pinpos parameter.
- Parameters:
- headerastropy.io.fits.header.Header
FITS header that will may be used to determine pinhole model coefficients or will be updated with them
- pinposdict or str or None
if pinpos == ‘default’ then the output pin positions will be retried from default_pinpos(). If pinpos is None, the pin positions will be retrieved according to the drip configuration. Otherwise, the user should explicitly define pinpos as a dict with the following keys and values:
- model -> numpy.ndarray
N(x, y) model reference positions of shape (N, 2)
- pins -> numpy.ndarray
N(x, y) pin positions of shape (N, 2)
- nx, ny -> int
define number of pixels for both pins and image in x and y
- dx, dy -> float
model x, y spacing
- angle -> float
clockwise rotation of the model about the center in degrees. This is not required for anything but the PIN_MID keyword in the header will be updated with this value.
- order -> int
order to be used if using the “polynomial” method in sofia_redux.instruments.forcast.undistort based upon this model.
- rotatebool, optional
rotate the model by ‘NODANGLE’ in the header
- Returns:
- dict or None
pinpos if validated else None. If rotation occurred then pinpos[‘model’] will be updated. Keys and values are described above under the
pinpos
parameter.