mkflat

sofia_redux.instruments.flitecam.mkflat.mkflat(infiles, method='median', weighted=True, robust=True, sigma=5, maxiters=None, psf_fwhm=6.0, obj_sigma=2.0)[source]

Make a flat from dithered sky images.

The process is:

  • Directly combine all images into a draft flat.

  • Divide input images by the draft flat.

  • Use the resulting gain-corrected images to identify and mask any sources.

  • Scale all images to the median value of all the masked data.

  • Combine scaled, masked images into a final flat, propagating errors.

Parameters:
infileslist of fits.HDUList

Input data. Should have FLUX, ERROR, and BADMASK extensions.

method{‘mean’, ‘median’, ‘sum’}, optional

Combination function to use.

weightedbool, optional

If True and method is ‘mean’, the input variance will be used to weight the mean combination. Ignored if variance is not provided.

robustbool, optional

If True, the threshold and maxiters parameters will be used to reject outliers before combination. Outlier rejection is performed via astropy.stats.sigma_clip.

sigmafloat, optional

The number of standard deviations for clipping; passed to sigma_clip.

maxitersint or None, optional

The maximum number of clipping iterations to perform; passed to sigma_clip

psf_fwhmfloat, optional

Expected FWHM of sources for masking. Used to smooth the image before detecting objects.

obj_sigmafloat, optional
The number of standard deviations above the background, used

in detecting sources.

Returns:
fits.HDUList

Normalized flat field correction image, with FLAT, FLAT_ERROR, and FLAT_BADMASK extensions. Array dimensions match input.