physioex.data.ZScore#

class physioex.data.ZScore(ddof=0, eps=0.0)[source]#

Bases: PreprocessingStep

Whole-signal z-score with a tunable ddof and a std floor.

y = (x - mean) / max(std, eps) where the mean and standard deviation (with the given ddof) are computed over the whole signal. Used by the wav2sleep reference preprocessing, which z-scores each 10 h recording with ddof=1, eps=1e-6 over the full grid including the zero padding (the padding is therefore part of the statistics – keep FixedLength before this step in that pipeline).

If std == 0 and eps == 0 the step returns x - mean (a constant signal is degenerate for a ratio).

Parameters#

ddofint

Delta degrees of freedom for the standard deviation (default 0).

epsfloat

Floor for the standard deviation (default 0.0).

__init__(ddof=0, eps=0.0)[source]#
Parameters:

Methods

__init__([ddof, eps])

compile(fs_in[, header])

Precompute any expensive state and return a callable specialized for fs_in.

spec()

Return canonical, hashable text repr.

compile(fs_in, header=None)[source]#

Precompute any expensive state and return a callable specialized for fs_in.

header is an optional per-channel metadata dict (physical dimension, physical min/max, …) forwarded to steps that declare they need it (needs_header attribute, e.g. PhysicalScale). Steps that ignore it simply do not read it; the signature default keeps every existing compile(fs) call site working.

Parameters:
Return type:

CompiledStep

spec()[source]#

Return canonical, hashable text repr.

Format: ClassName(key1=val1,key2=val2,…) with sorted keys, floats normalized via f’{float(v):.10g}’.

Return type:

str

Parameters: