mixle.stats.univariate.continuous.rician module¶
Rician (Rice) distribution – the envelope of a sinusoid in additive Gaussian noise.
The amplitude X = sqrt((nu + sigma Z1)^2 + (sigma Z2)^2) of a 2-D Gaussian offset from the origin
by nu (the line-of-sight / signal component), Z1, Z2 ~ N(0, 1). Models fading envelopes with a
dominant path (wireless/radar/sonar), MRI magnitude noise, and wind speed. With nu >= 0 and scale
sigma > 0,
f(x; nu, sigma) = (x / sigma^2) exp(-(x^2 + nu^2) / (2 sigma^2)) I0(x nu / sigma^2), x > 0,
where I0 is the modified Bessel function (evaluated stably via the exponentially scaled ive).
At nu = 0 it reduces to the Rayleigh; for large nu/sigma it approaches a Gaussian. It samples
exactly from the 2-D Gaussian envelope and has a closed-form method-of-moments fit from the second and
fourth moments: sigma^2 = (m2 - sqrt(2 m2^2 - m4))/2 and nu^2 = m2 - 2 sigma^2.
Reference: Rice, “Mathematical analysis of random noise”, Bell System Tech. J. (1944/1945).
- class RicianDistribution(nu, sigma, name=None, keys=None)[source]
Bases:
SequenceEncodableProbabilityDistributionRician distribution with non-centrality
nu >= 0and scalesigma > 0.- log_density(x)[source]
Return the log-density at
x(-inf for x <= 0).
- seq_log_density(x)[source]
Return vectorized log-density for a sequence-encoded array of observations.
- classmethod compute_capabilities()[source]
Describe backend support for generated Rician kernels.
- classmethod compute_declaration()[source]
Return the structured compute declaration for Rician distributions.
- static backend_legacy_sufficient_statistics(x, params, engine)[source]
Per-row Rician power sums in accumulator order
(count, sum x^2, sum x^4).
- static backend_log_density_from_params(x, nu, sigma, engine)[source]
Engine-neutral Rician log-density (
-infforx <= 0).
- backend_seq_log_density(x, engine)[source]
Engine-neutral vectorized log-density for encoded data.
- classmethod backend_stacked_params(dists, engine)[source]
Stacked Rician parameters for a homogeneous mixture kernel.
- classmethod backend_stacked_log_density(x, params, engine)[source]
Return an
(n, k)matrix of Rician log densities.
- classmethod backend_stacked_sufficient_statistics(x, weights, params, engine)[source]
Stacked Rician power sums
(count, sum x^2, sum x^4)using engine-resident arrays.
- cdf(x)[source]
Cumulative distribution function P(X <= x) (Marcum-Q, via scipy rice).
- quantile(q)[source]
Inverse CDF F^{-1}(q) (via scipy rice).
- mean()[source]
Mean sigma sqrt(pi/2) L_{1/2}(-nu^2/(2 sigma^2)) (stable via the scaled Bessel ive).
- Return type:
- sampler(seed=None)[source]
Return a sampler (the envelope of a 2-D Gaussian offset by
nu).- Parameters:
seed (int | None)
- Return type:
RicianSampler
- estimator(pseudo_count=None)[source]
Return a closed-form method-of-moments estimator.
- Parameters:
pseudo_count (float | None)
- Return type:
RicianEstimator
- dist_to_encoder()[source]
Return the data encoder used by this distribution (the raw value).
- Return type:
RicianDataEncoder
- class RicianSampler(dist, seed=None)[source]
Bases:
DistributionSamplerDraw
X = sqrt((nu + sigma Z1)^2 + (sigma Z2)^2)forZ1, Z2 ~ N(0, 1).- Parameters:
dist (RicianDistribution)
seed (int | None)
- class RicianAccumulator(name=None, keys=None)[source]
Bases:
SequenceEncodableStatisticAccumulatorAccumulate the weighted power sums
(count, sum x^2, sum x^4)for the moment fit.- update(x, weight, estimate)[source]
Accumulate weighted second and fourth power sums for one observation.
- initialize(x, weight, rng)[source]
Initialize statistics from one observation.
- Parameters:
x (float)
weight (float)
rng (RandomState | None)
- Return type:
None
- seq_update(x, weights, estimate)[source]
Accumulate weighted second and fourth power sums from encoded data.
- seq_initialize(x, weights, rng)[source]
Initialize statistics from encoded observations.
- Parameters:
x (ndarray)
weights (ndarray)
rng (RandomState | None)
- Return type:
None
- combine(suff_stat)[source]
Merge another Rician sufficient-statistic tuple.
- value()[source]
Return count, second power sum, and fourth power sum.
- from_value(x)[source]
Replace accumulator contents from a sufficient-statistic tuple.
- key_merge(stats_dict)[source]
Merge keyed statistics into
stats_dictwhen keys are configured.
- key_replace(stats_dict)[source]
Replace this accumulator from keyed statistics when available.
- acc_to_encoder()[source]
Return the encoder used by this accumulator.
- Return type:
RicianDataEncoder
- class RicianAccumulatorFactory(name=None, keys=None)[source]
Bases:
StatisticAccumulatorFactoryFactory for RicianAccumulator.
- make()[source]
Create a fresh Rician accumulator.
- Return type:
RicianAccumulator