cwi_scale_var

cwitools.scripts.scale_var.scale_var(data, var, snr_min=2, n_min=100, wrange=None, plot=False, out=None, log=None, silent=True)

Scale a variance estimate to match the noise properties of the associated data.

Parameters:
  • data (str) – Path to the 3D data FITS we are estimating variance for
  • var (str) – Path to the FITS containing the initial 3D variance estimate
  • snr_min (float) – Signal-to-noise ratio (SNR) threshold to use for iterative scaling method. Contiguous regions of size n_min above a SNR of snr_min will be rejected as systematics or emission regions, and the scaling will be based only on remaining background regions.
  • n_min (int) – Minimum size of a contiguous region with SNR > snr_min to count as a systematic and be excluded from the variance scaling.
  • wrange (float tuple) – The range of wavelengths to use when scaling the variance estimate, in units of Angstrom.
  • plot (bool) – Set to TRUE to show diagnostic plots.
  • snr_range (float tuple) – The range of SNR values to use when finding scaling factor. Default is -5 to +5.
  • snr_bins (int) – The number of SNR bins across snr_range to use for generating histograms. Scaling factors are determined by best-fit Gaussian models to SNR histograms, assuming background (i.e. shot-noise) limited observations. Default: 100
Returns:

The rescaled variance estimate float: The final rescaling factor, f, such that var_out = f * var_in

Return type:

numpy.ndarray