StcalVariance

class spizzle.StcalVariance(out_shape, n_var=3, rnoise=0, weight_type='ivm', pixel_scale_ratio=1.0, fillval=nan)

Bases: object

Variance planes and error of a mosaic as stcal resamples them, for imaging.

For each exposure and variance plane q, the resampled error is e_q = iscale * (W @ sqrt(var_q)) / (W @ 1), drizzle’s weighted mean of sqrt(var_q), and each output pixel’s weight for the exposure is w = 1 / e_r**2 for the read-noise plane r (“ivm”, 0 where e_r is 0 or not finite) or the exposure time (“exptime”). Then

var_q = sum(e_q**2 * w**2) / sum(w)**2 / pixel_scale_ratio**2

over the exposures where e_q is finite and w > 0: stcal’s resample_variance_arrays and finalize_resample_variance, the same since stcal 1.18 (jwst 2.0) up to the order of the final division, which stcal 1.20 changed to avoid overflow. ERR is sqrt of the sum of the planes.

Parameters:
out_shapetuple of int

(ny_out, nx_out).

n_varint

Number of variance planes given with each exposure.

rnoiseint

Index of the read-noise plane, for “ivm” weights; 0 in stcal’s order of var_rnoise, var_flat, var_poisson.

weight_type{“ivm”, “exptime”}

stcal’s weighting of the exposures.

pixel_scale_ratiofloat

Output over input pixel scale; the variance is divided by its square.

fillvalfloat

Value of output pixels where no exposure adds to a plane.

Attributes Summary

out_err

ndarray, shape out_shape: sqrt of the sum of the finite planes, NaN where none is, as stcal's ERR.

out_var

list of ndarray, shape out_shape: each variance plane, fillval where no exposure adds to it.

Methods Summary

add(W, variances[, iscale, exposure_time])

Add one exposure.

Attributes Documentation

out_err

ndarray, shape out_shape: sqrt of the sum of the finite planes, NaN where none is, as stcal’s ERR.

out_var

list of ndarray, shape out_shape: each variance plane, fillval where no exposure adds to it.

Methods Documentation

add(W, variances, iscale=1.0, exposure_time=None)

Add one exposure.

Parameters:
WOperator or scipy.sparse array

The exposure’s operator, as for Coadd.add.

variancessequence of ndarray

One variance plane per n_var, each of shape (ny, nx). For “ivm” weights the read-noise plane is needed; other planes may be None, which adds nothing to them, as stcal skips missing planes.

iscalefloat

Factor applied to the resampled errors.

exposure_timefloat, optional

The exposure’s weight for “exptime”: stcal’s measurement time, or the exposure time.