eloy.calibration#

Calibration routines for astronomical images.

This module provides functions to compute master bias, dark, and flat frames, as well as to calibrate raw image data using these frames.

Functions#

divisors(n)

Find all divisors of an integer.

easy_median(images[, m])

Compute the median of images in chunks to avoid memory errors.

default_fun_load(file)

The default function to load image data from a file.

default_fun_exp(file)

The default function to extract exposure time from a file.

master_dark([bias, files, fun_load, fun_exp])

Create a master dark frame from a list of dark files.

master_flat([bias, dark, files, fun_load, fun_exp])

Create a master flat frame from a list of flat files.

master_bias([files, fun_load])

Create a master bias frame from a list of bias files.

calibrate(data, exposure, dark, flat, bias)

Calibrate raw image data using master calibration frames.

Module Contents#

eloy.calibration.divisors(n)[source]#

Find all divisors of an integer.

Parameters:

n (int) – The integer to find divisors for.

Returns:

Array of divisors of n.

Return type:

np.ndarray

eloy.calibration.easy_median(images, m=50)[source]#

Compute the median of images in chunks to avoid memory errors.

Parameters:
  • images (array-like) – List or array of images.

  • m (int, optional) – Chunk size for splitting the computation.

Returns:

Concatenated median of the images.

Return type:

np.ndarray

eloy.calibration.default_fun_load(file)[source]#

The default function to load image data from a file.

Parameters:

file (str or Path) – Path to the file to load.

Returns:

Loaded image data.

Return type:

np.ndarray

eloy.calibration.default_fun_exp(file)[source]#

The default function to extract exposure time from a file.

Parameters:

file (str or Path) – Path to the file to extract exposure time from.

Returns:

Exposure time extracted from the file header.

Return type:

float

eloy.calibration.master_dark(bias=None, files=None, fun_load=None, fun_exp=None)[source]#

Create a master dark frame from a list of dark files.

Parameters:
  • bias (np.ndarray or None) – Master bias frame to subtract.

  • files (list or None) – List of file paths to dark frames.

  • fun_load (callable or None) – Function to load image data from file.

  • fun_exp (callable or None) – Function to extract exposure time from file. Default is default_fun_exp()

Returns:

Master dark frame.

Return type:

np.ndarray

eloy.calibration.master_flat(bias=None, dark=None, files=None, fun_load=None, fun_exp=None)[source]#

Create a master flat frame from a list of flat files.

Parameters:
  • bias (np.ndarray or None) – Master bias frame to subtract.

  • dark (np.ndarray or None) – Master dark frame to subtract.

  • files (list or None) – List of file paths to flat frames.

  • fun_load (callable or None) – Function to load image data from file. Default is default_fun_load()

  • fun_exp (callable or None) – Function to extract exposure time from file. Default is default_fun_exp()

Returns:

Master flat frame.

Return type:

np.ndarray

eloy.calibration.master_bias(files=None, fun_load=None)[source]#

Create a master bias frame from a list of bias files.

Parameters:
  • files (list or None) – List of file paths to bias frames.

  • fun_load (callable or None) – Function to load image data from file. Default is default_fun_load()

Returns:

Master bias frame.

Return type:

np.ndarray

eloy.calibration.calibrate(data, exposure, dark, flat, bias)[source]#

Calibrate raw image data using master calibration frames.

Parameters:
  • data (np.ndarray) – Raw image data.

  • exposure (float) – Exposure time of the image.

  • dark (np.ndarray) – Master dark frame.

  • flat (np.ndarray) – Master flat frame.

  • bias (np.ndarray) – Master bias frame.

Returns:

Calibrated image data.

Return type:

np.ndarray