scaleimgs

sofia_redux.spectroscopy.scaleimgs.scaleimgs(images, variances=None, axis=0, nan=True)[source]

Scales a set of images to the median flux level of all images

Determines the median signal of each image in the cube M_i. Then it computes the median of these values M and then determines scale factors to scale M_i ti M. It then applied these scale factors to the images in the cubes.

Parameters:
imagesarray_like of float (shape)

Images of arbitrary shape

variancesarray_like of float (shape), optional

Variances to update in parallel with images

axisint, optional

The axis determining separate images.

nanbool, optional

If True, ignore NaNs when determining median values.

Returns:
scaled_images, [scaled_variances]numpy.ndarray, [numpy.ndarray]

Images and optionally variances (if variances were supplied) scaled to the same median level. Both arrays are of float type and (shape).