Repository navigation
4.4.0 — reject types, boundary masking and corrected cycles
Lacourse2018 output changes with this release: re-detect existing Lacourse2018 rows in neural_events.db rather than pooling them with new ones.
Detection now excludes Move time by default, and the reject set is recorded as a first-class reject_types parameter on every run, denominator and density row instead of two booleans that could only ever name Artefact and Arousal.
Annotation import also changes independently of that default: on an annotation file with integer-sample latencies, add_artefacts_from_events used to floor every event duration to whole seconds, so a 0.39 s arousal became zero-length (and rejected nothing) and a 3.7 s arousal was truncated to 3.0 s. Re-importing EEGLAB events under this release masks a different — generally larger — amount of time than 4.3 did, independent of the Move default change above.
Added
reject_typesparameter ondetect_spindles,detect_slow_waves,detect_kcomplexesandanalyze_pac, naming the annotation event types excluded from detection and from the density denominator.DEFAULT_REJECT_TYPES,KNOWN_REJECT_TYPES,resolve_reject_typesandreject_keyinturtlewave_hdEEG.analysed_time.reject_typesanddetection_runs.reject_typescolumns;v_event_densityandevent_densityexpose and group on them.db_meta['turtlewave_version'], recording which version last opened the database for writing.--reject-typesonexamples/rerun_detection.pyand both_GADI.pydrivers.add_artefacts_from_eventswrites anArtefactannotation +/-2 s around every EEGLABboundary(splice) event, so no detected event or PAC phase estimate spans a signal discontinuity.
Changed
- The default reject set is now
Artefact,Arousal,Movefor all four detectors;RespandSnoreremain opt-in. - GUI: the per-tab Artefact/Arousal reject checkboxes on the spindle, slow-wave and K-complex tabs are replaced by one shared "Excluded event types" group on the Setup tab, echoed read-only on every detection tab including PAC.
analysed_timeis keyed on(subject, stage, reject_types), so runs with different reject sets no longer overwrite each other's denominator.reject_artifacts/reject_arousalsare deprecated shims that add or remove their one type; they never define the whole set.--reject_artifacts/--reject_arousalsin both_GADI.pydrivers are deprecated no-ops that warn; they could never disable rejection.--durationinhdEEG_spindle_detector_GADI.pydefaults to the method's published bound instead of 0.5-3 s.- Lacourse2018's default spindle
durationis now 0.3-2.5 s, the published A7 bound (previously 0.5-3 s); overriding it logs a warning. - GUI: the Lacourse2018 absolute-power threshold accepts negative values, selecting the adaptive mean + |value| x SD threshold.
- Densities on recordings with EEGLAB boundary events shift by roughly the newly masked fraction (about 1.6% of analysable time on one heavily spliced subject).
store_cycles_to_databasenow raisesValueError, instead of warning and continuing, when nothing names thesleep_cyclesrows to replace (an empty cycles list withmethod=None, or a cycle dict carryingmethod=None).examples/backfill_cycles.pytreats a plot-only failure as a PASS with aWARN: database written, plot skippedline instead of counting it as a failure.- Re-detecting a scope under a different reject set is refused unless
replace_channelsis given, because the scope would otherwise become the union of two searches. - Docs: Lacourse2018 is no longer described as a permissive method.
- Docs: new reference page for the detector extension classes.
- Docs: the
'1979'cycle method is now described as it behaves (REM-closed with forward merging of unpaired NREM periods, no adjacency test) rather than as the Feinberg & Floyd definition; the artefact-as-wake note and the "no cycles under '1979' only" troubleshooting bullet were corrected. - Docs: the sleep-cycle how-to documents that cycle-marker writing rewrites the annotation XML (and its
modifiedtimestamp) even on a zero-cycle night.
Fixed
Lacourse2018forced the 10-90 percentile z-score trim toNoneon every construction, so the relative-power and covariance criteria ran against an inflated SD.Lacourse2018let Wonambi's in-place mutation oftoleranceandabs_pow_threshleak across calls, so every segment after the first ran at drifted thresholds.Lacourse2018replaced whole dict parameters when given a partial one, droppingstepand making Wonambi evaluate every sample.Lacourse2018no longer crashes whenabs_pow_thresh=Noneis passed.- GUI: switching spindle method after a failed detector construction leaked the previous method's parameter widgets into the next run.
- GUI: the spindle duration boxes now follow the selected method's default instead of a fixed 0.5-3 s, so default GUI runs of Ferrarelli2007, Wamsley2012, Nir2011 and Ray2015 change accordingly.
analyze_pacnever passed its reject set tofetch, so every PAC result on continuous data was computed over artefact and arousal time.add_artefacts_from_eventsno longer floors event durations to whole seconds on an annotation file with integer-sample latencies (a 0.39 s event no longer becomes zero-length and rejects nothing; a 3.7 s event no longer truncates to 3.0 s).add_artefacts_from_eventsnow saves an annotation file holding onlyResp/Move/Snore(or only boundary) events; the save gate previously counted onlyArtefact+Arousaladditions and left such a file unsaved.- Opening a 4.3 database under this release aborted at connection time with a
v_event_densityview error. examples/rerun_detection.pyused the CLI default reject set instead of the original run's recorded set, so re-detected channels could be searched over different time than the untouched channels.- A mixed-method spindle run with
durationunset recorded only the first method's duration bound; the scalar is now recorded only when every method agrees, and the per-method map is always recorded. pac_coupling.mi_rawand the per-channel CSV reported the surrogate-normalised modulation index under both names;mi_rawnow holds the unnormalised Tort MI.
Upgrading
- PAC rows written before this release were computed without artefact or arousal rejection, and their
mi_rawvalues are z-scores rather than raw modulation indices; re-run PAC rather than pooling them with new rows. - Spindle, slow-wave and K-complex densities written before this release used
Artefact,Arousalonly. Existinganalysed_timerows are migrated to that key on first open, and a re-run under the new default adds a row instead of replacing them. - Densities computed from annotation files re-imported under this release will not match archived densities computed under 4.3, even at the same
reject_types— the duration-flooring fix changes how much time eachArtefact/Arousal/Resp/Move/Snoreannotation actually masks. Re-import and re-run rather than comparing old and new numbers directly. - Re-detecting an existing scope after upgrading applies the new default reject set (
Artefact,Arousal,Move) unless you passreject_types=yourself; passreplace_channels=<the channels you're re-detecting>to clear the stale event rows first. That leaves the old reject set'sanalysed_timedenominator row in place, so passreject_types=when reading density back.