Variogram#

class pypillometry.signal.Variogram(lags, gamma, npairs, variance)[source]#

Bases: NamedTuple

Result of semivariogram().

Attributes:
lagsnp.ndarray

lags in ms (1, 2, … samples)

gammanp.ndarray

semivariance at each lag (signal units squared); NaN where there are no pairs of valid samples

npairsnp.ndarray

number of pairs of valid samples at each lag

variancefloat

variance of the valid samples (the sill of a stationary signal)

Methods

at_log_lags

The variogram at about log-spaced lags.

count

Return number of occurrences of value.

index

Return first index of value.

Details

at_log_lags(per_decade=12, min_pairs=200)[source]#

The variogram at about log-spaced lags.

Picks per_decade of the lags per factor of 10 (all lags where they are further apart than that), so that fits and plots are not dominated by the many long lags.

Parameters:
  • per_decade (int, optional) – number of lags per decade (default 12)

  • min_pairs (int, optional) – lags with fewer pairs of valid samples are left out (default 200)

Return type:

Variogram

Examples

>>> x = np.random.default_rng(0).normal(size=5000)
>>> vg = semivariogram(x, fs=1000, max_lag=1000).at_log_lags(per_decade=4)
>>> vg.lags
array([   1.,    2.,    3.,    6.,   10.,   18.,   32.,   56.,  100.,
        178.,  316.,  562., 1000.])
count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=sys.maxsize, /)#

Return first index of value.

Raises ValueError if the value is not present.

gamma: ndarray#

Alias for field number 1

lags: ndarray#

Alias for field number 0

npairs: ndarray#

Alias for field number 2

variance: float#

Alias for field number 3