F2b: No evaluable carries the reason ported from the tea library
Study level: Validation.reasons, built from the three gates that decide validity (triage-not-analyzable, few-clean-minutes, few-electrodes; the library's run_study reasons plus its usable-electrode gate) and invalid-file for an unreadable file. Analysis.reasons sits next to valid, level and clean_fraction. Window level: the spike detector's 2 s gate now records every reason a window is rejected (gap, state, mixed-states, muscle, frozen) and the minutes rejected by each, kept in Spikes.rejected. A window can count under more than one reason, as in the library. The platform has no transient rejection, so there is no transient reason. Metric level: biomarkers.measure returns a Measured result with the reason per unmeasured metric: few-wake-windows and no-dominant-peak (posterior rhythm), no-n2 and no-n3 (under one minute of the stage or no events), no-sleep and few-electrodes (gradient, spikes). A study that is not valid now returns its five metrics with no value, each carrying invalid-eeg. Curve scoring returns a reason next to z: no-age, age-out-of-range and no-exposure, because only scoring knows the baseline's age coverage. The reasons and the rejected minutes travel in the features JSON under metric-reasons and rejected-minutes, outside the scenario keys so the reference tables and curve training do not see them.
This commit is contained in:
@@ -19,6 +19,8 @@ def test_centile_interpolation_preserves_scoring():
|
||||
{"p5": 2, "p25": 3, "median": 4, "p75": 6, "p95": 8}
|
||||
)
|
||||
for value, z, outside in ((0, -3.29, -1), (3, -0.8225, 0), (6, 0.8225, 0), (10, 2.4675, 1)):
|
||||
assert curves.score(baseline, value, 24) == pytest.approx(
|
||||
scored = curves.score(baseline, value, 24)
|
||||
assert scored.pop("reason") is None
|
||||
assert scored == pytest.approx(
|
||||
{"z": z, "outside": outside, "p5": 2, "median": 4, "p95": 8}, rel=1e-9
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user