coronalyze.core.statistics#
Statistical functions for masked arrays and small-sample corrections.
Implements JAX-native masked statistics and the Mawet et al. (2014) small-sample penalty for high-contrast imaging SNR calculations.
Functions#
|
Compute the mean of masked values. |
|
Compute the standard deviation of masked values. |
Compute the Mawet et al. (2014) small-sample statistics correction. |
Module Contents#
- coronalyze.core.statistics.masked_mean(values, mask)[source]#
Compute the mean of masked values.
- Args:
values: 1D array of values. mask: Boolean mask (True for valid values).
- Returns:
Mean of valid values, or 0 if no valid values.
- Parameters:
values (jax.numpy.ndarray)
mask (jax.numpy.ndarray)
- Return type:
float
- coronalyze.core.statistics.masked_std(values, mask, mean=None)[source]#
Compute the standard deviation of masked values.
Uses Bessel’s correction (N-1 denominator) for unbiased estimation.
- Args:
values: 1D array of values. mask: Boolean mask (True for valid values). mean: Pre-computed mean. If None, computed from masked values.
- Returns:
Standard deviation of valid values.
- Parameters:
values (jax.numpy.ndarray)
mask (jax.numpy.ndarray)
mean (float | None)
- Return type:
float
- coronalyze.core.statistics.small_sample_penalty(n)[source]#
Compute the Mawet et al. (2014) small-sample statistics correction.
At small angular separations, fewer reference apertures are available, which inflates the noise estimate. This penalty factor accounts for the additional uncertainty.
- Reference: Mawet et al. (2014) ApJ
Equation 9: sigma_corrected = sigma * sqrt(1 + 1/n)
- Args:
n: Number of reference apertures.
- Returns:
Correction factor sqrt(1 + 1/n).
- Parameters:
n (int | jax.numpy.ndarray)
- Return type:
float