Repository navigation
v0.5.0
MNEXTEND 0.5.0 reworks XDF import and line-noise removal:
- XDF import:
read_raw()now takes astreamsargument to choose which streams to load and how: as continuous channels, discrete channels (such as trigger codes, which are never filtered), or notations.stream_idsandmarker_idsstill work but are deprecated and will be removed in 0.6.0. - Line-noise removal:
remove_line_noise()now tracks small deviations of the mains frequency, so lines slightly off 50/60 Hz are removed properly. It also cleans around annotated gaps such as AD_ACQ_SKIP` instead of spreading NaN. - Breaking: the second positional argument of
read_raw()is nowstreams(it used to bestream_ids). It loads only the listed streams, so marker streams are no longer automatically converted to annotations unless you list them. All other arguments afterstreamsare keyword-only.
Here are the detailed changes:
✨ Added
- Add
streamsparameter toread_raw_xdf(), which selects the XDF streams to load (all streams containing samples by default) and the mode for each stream ("continuous","discrete", or"annotations"), andstream_modes()(viamnextend.io.xdf) to list the possible modes of a stream (#15 by Clemens Brunner) - Annotate time spans in which XDF data channels contain NaN (for example, because another stream ends a few samples later) as "BAD_ACQ_SKIP" (#18 by Clemens Brunner)
- Track deviations of the line frequency from its nominal value in
remove_line_noise()with the newfreq_toleranceparameter (±0.1 Hz by default) (#19 by Clemens Brunner) - Add
skip_by_annotationparameter toremove_line_noise(), which cleans data segments separated by annotated spans independently and leaves these spans unchanged (#19 by Clemens Brunner) - Add support for Python 3.15 (#20 by Clemens Brunner)
🔧 Fixed
- Fix resampling of XDF trigger streams, which are now loaded as discrete stim channels (resampled without filtering by holding the previous value) instead of being filtered like signals (#15 by Clemens Brunner)
- Fix resampling of XDF streams dropping the last sample, which also lost the last value of irregular streams loaded as discrete channels (the resampled data can therefore be one sample longer than before) (#17 by Clemens Brunner)
- Fix
remove_line_noise()subtracting incorrect fits when the window or recording does not contain a whole number of cycles of every line frequency (#19 by Clemens Brunner)
🌀 Changed
- Deprecate
stream_idsandmarker_idsinread_raw_xdf()in favor ofstreams(they will be removed in MNEXTEND 0.6.0) (#15 by Clemens Brunner) - Convert numeric XDF streams with a nominal sampling frequency of 0 Hz to annotations by default, or load them as discrete channels (instead of continuous channels) (#15 by Clemens Brunner)
- Make all parameters of
read_raw_xdf()exceptfnameandstreamskeyword-only (#15 by Clemens Brunner) - Load only the listed streams when passing stream IDs as the second positional argument of
read_raw_xdf()(previouslystream_ids), so string marker streams are no longer converted to annotations unless they are listed instreams(#15 by Clemens Brunner) - Order channels from XDF streams by stream ID (instead of the order in which the streams are specified) (#15 by Clemens Brunner)
- Raise a
ValueErrorfor XDF stream IDs that do not exist in the file (instead of aKeyError) (#15 by Clemens Brunner)