open#

msfc_ccd.fits.open(path, camera=None, axis_x='detector_x', axis_y='detector_y')[source]#

Load the given FITS images into memory.

This is a convenience function for msfc_ccd.SensorData.from_fits().

Parameters:
  • path (str | Path | AbstractScalarArray) – Either a single path or an array of paths pointing to the FITS files to open.

  • camera (None | AbstractCamera) – A model of the camera used to capture the images being loaded. If None (the default), the msfc_ccd.Camera will be used.

  • axis_x (str) – The name of the logical axis representing the horizontal dimension of the images.

  • axis_y (str) – The name of the logical axis representing the vertical dimension of the images.

Return type:

SensorData

Examples

Load and display a single FITS file.

import matplotlib.pyplot as plt
import named_arrays as na
import msfc_ccd

# Load the sample image
image = msfc_ccd.fits.open(msfc_ccd.samples.path_fe55_esis1)

# Display the sample image
fig, ax = plt.subplots(
    constrained_layout=True,
)
im = na.plt.imshow(
    image.outputs.value,
    axis_x=image.axis_x,
    axis_y=image.axis_y,
    ax=ax,
);
../_images/msfc_ccd.fits.open_0_0.png

Load and display an array of two FITS files.

import numpy as np
import named_arrays as na
import msfc_ccd

# Define the name of the time axis.
axis_time = "time"

# Define the array of two sample FITS files
path = na.ScalarArray(
    ndarray=np.array([
        msfc_ccd.samples.path_fe55_esis1,
        msfc_ccd.samples.path_fe55_esis3,
    ]),
    axes=axis_time,
)

# Load the sample images
image = msfc_ccd.fits.open(path)

# Display the sample images
fig, axs = na.plt.subplots(
    axis_rows=axis_time,
    nrows=image.outputs.shape[axis_time],
    sharex=True,
    constrained_layout=True,
)
im = na.plt.imshow(
    image.outputs.value,
    axis_x=image.axis_x,
    axis_y=image.axis_y,
    ax=axs,
);
../_images/msfc_ccd.fits.open_1_0.png