romanimpreprocess.utils.fpaplot

Script to make a plot of properties of the focal plane from a bunch of calibration files.

Functions

read_sca_image

Function to read an SCA image (in some format, and of some quantity).

write_text

Writes text on an image.

make_big_image

Makes an RGB image of the full focal plane (all 18 SCAs).

multi_image

Makes multi-panel plot of the focal plane.

Attributes

nside_base

ctrs

bbox

lfile

letters

arr

Functions

read_sca_image(infile_format, n1, ptype, scanum[, mask])

Makes a (possibly binned) image of the given SCA.

write_text(image, origin, size, val, string)

Utility to write text on an image.

make_big_image(infile_format, n1, ptype[, vmin, vmax, ...])

Makes an RGB image of the focal plane.

multi_image(infile_format, n1, masktype)

Makes a multi-panel image of the focal plane.

Module Contents

nside_base = 4096[source]
ctrs[source]
bbox[source]
read_sca_image(infile_format, n1, ptype, scanum, mask=None)[source]

Makes a (possibly binned) image of the given SCA.

Parameters:
  • infile_format (str) – Format string: input file should be infile_format.format(filestring, scanum).

  • n1 (int) – Output size that we want to bin to (must be a power of 2).

  • ptype (str) – The data type to read.

  • scanum (int) – The SCA number (1..18).

  • mask (variable) – Builds a mask based on the indicated class.

Returns:

arr – 2D image of the requested quantity on the SCA, binned to (n1, n1).

Return type:

np.array

Notes

The legal ptypes are: * 'gain' : gain (e/DN) * 'alphaH', 'alphaV', 'alphaD' : IPC * 'lin2', 'lin3' : linearity coefficients * 'pflatnorm' : normalized pixel-level flat * 'read' : read noise (DN)

lfile = ''[source]
letters[source]
write_text(image, origin, size, val, string)[source]

Utility to write text on an image.

Parameters:
  • image (np.array of int) – 2D image to write on

  • origin ((int, int)) – location to start writing (upper left).

  • size (int) – Amount to scale up text; each letter occupies shape (12*size, 6*size).

  • val (int) – The brightness to set the text (normally between 0 and 255 inclusive).

  • string (str) – The text to write.

Return type:

None

make_big_image(infile_format, n1, ptype, vmin=0.0, vmax=1.0, mask=None, cmap='viridis', scale=None)[source]

Makes an RGB image of the focal plane.

Parameters:
  • infile_format (str) – Format string: input file should be infile_format.format(filestring, scanum).

  • n1 (int) – Output size that we want to bin to (must be a power of 2).

  • ptype (str) – The data to read (see below).

  • vmin (float) – Minimum of the color scale.

  • vmax (float) – Maximum of the color scale.

  • mask (variable) – Builds a mask based on the indicated class.

  • cmap (str, optional) – Display color scale.

  • scale (str, optional) – Format string for the color bar.

Returns:

arr – 3D RGB numpy array (RGB is axis=-1).

Return type:

np.array of uint8

See also

read_sca_image

The routine that is wrapped to read the data from the calibration file.

Notes

The legal values of ptype are as described in read_sca_image.

multi_image(infile_format, n1, masktype)[source]

Makes a multi-panel image of the focal plane.

Parameters:
  • infile_format (str) – Format string: input file should be infile_format.format(filestring, scanum).

  • n1 (int) – Output size that we want to bin to (must be a power of 2).

  • masktype (variable) – Builds a mask based on the indicated class.

Returns:

3D RGB numpy array (RGB is axis=-1).

Return type:

np.array of uint8

arr[source]