sample.beatsdrop.decision module¶
Decision models for discriminating beating trajectories
- class sample.beatsdrop.decision.AlmostNotABeatDecisor(th: float = 1, intermediate: Optional[OptionalStorage] = None, **kwargs)¶
Bases:
BeatDecisor
Decide if a trajectory is a beat or not based on the fact that the two amplitudes are not almost zero and the two frequencies are not almost the same.
- Parameters:
th (float) – Inexact equality threshold, as a multiplier of floating point epsilon.
intermediate (OptionalStorage) – Optionally-activatable storage
- decide_beat(i: int, t: ndarray, track: dict, beatsdrop: BeatRegression, params: Tuple[float, float, float]) bool ¶
Decision function based on normalized power square difference
- Parameters:
i (int) – Track index
t (array) – Time axis
track (dict) – Track
beatsdrop (BeatRegression) – Beat regression model
params (triplet of floats) – Frequency, decay, and amplitude
- Returns:
True
iff the correlation is not significant or is below the threshold- Return type:
bool
- class sample.beatsdrop.decision.BeatDecisor(intermediate: Optional[OptionalStorage] = None, **kwargs)¶
Bases:
BaseEstimator
Model responsible for deciding wether the trajectory is a beat or not
- decide_beat(i: int, t: ndarray, track: dict, beatsdrop: BeatRegression, params: Tuple[float, float, float]) bool ¶
Decision function. Should be overwritten by child classes. This method always decides for the single-partial parameters (
False
) and never for the beats (True
)- Parameters:
i (int) – Track index
t (array) – Time axis
track (dict) – Track
beatsdrop (BeatRegression) – Beat regression model
params (triplet of floats) – Frequency, decay, and amplitude
- Returns:
Decision
- Return type:
bool
- property intermediate¶
Optionally-activatable storage
- output_beat_params(beat_params: Tuple[float, float, float, float, float, float, float, float]) Sequence[Tuple[float, float, float, float]] ¶
Format beat parameters as output for the
sample.sample.SAMPLE._fit_track()
method and phases- Parameters:
beat_params (octuplet of floats) – a0, a1, f0, f1, d0, d1, p0, p1
- Returns:
Parameters for
sample.sample.SAMPLE._fit_track()
and phase
- output_params(params: Tuple[float, float, float]) Sequence[Tuple[float, float, float, float]] ¶
Format single-partial parameters as output for the
sample.sample.SAMPLE._fit_track()
method and phases- Parameters:
params (triplet of floats) – Frequency, decay, and amplitude
- Returns:
Parameters for
sample.sample.SAMPLE._fit_track()
and phase
- track_params(i: int, t: ndarray, track: dict, beatsdrop: BeatRegression, params: Tuple[float, float, float], fit: bool = False) Sequence[Tuple[float, float, float, float]] ¶
Returns linear or beat parameters depending on the decision
- Parameters:
i (int) – Track index
t (array) – Time axis
track (dict) – Track
beatsdrop (BeatRegression) – Beat regression model
params (triplet of floats) – Frequency, decay, and amplitude
fit (bool) – If
True
, then fit thebeatsdrop
model
- Returns:
Parameters for the
sample.sample.SAMPLE._fit_track()
method