pypeit.core.pixels module

Routines related to mapping pixels to physical positions

pypeit.core.pixels.phys_to_pix(array, pixlocn, axis)[source]

Generate an array of physical pixel coordinates

Parameters:
  • array (numpy.ndarray) – An array of physical pixel locations

  • pixlocn (numpy.ndarray) – A 3D array containing the x center, y center, x width and y width of each pixel.

  • axis (int) – The axis that the input array probes

Returns:

pixarr – The pixel locations of the input array (as seen on a computer screen)

Return type:

numpy.ndarray

pypeit.core.pixels.ximg_and_edgemask(lord_in, rord_in, slitpix, trim_edg=(3, 3), xshift=0.0)[source]

Generate the ximg and edgemask frames

Parameters:
  • lord_in (numpy.ndarray) – Array containing the left trace. This can either be a 2-d array with shape (nspec, nTrace) for multiple traces, or simply a 1-d array with shape (nspec) for a single trace.

  • rord_in (numpy.ndarray) – Array containing the right trace. This can either be a 2-d array with shape (nspec, nTrace) for multiple traces, or simply a 1-d array with shape (nspec) for a single trace.

  • slitpix (numpy.ndarray) – Image with shape (nspec, nspat) specifying pixel locations. This is created by core_slit_pixels above.

  • trim_edg (tuple) – How much to trim off each edge of each slit in pixels. integer or floats

  • xshift (float, optional) – Future implementation may need to shift the edges

Returns:

  • ximg (numpy.ndarray) – Specifies spatial location of pixel in its own slit Scaled from 0 to 1

  • edgemask (ndarray, bool) – True = Masked because it is too close to the edge