Skip to content

v0.5.0

Choose a tag to compare

@cbrnr cbrnr released this 14 Oct 06:54
· 4 commits to main since this release

MNEXTEND 0.5.0 reworks XDF import and line-noise removal:

  • XDF import: read_raw() now takes a streams argument to choose which streams to load and how: as continuous channels, discrete channels (such as trigger codes, which are never filtered), or notations. stream_ids and marker_ids still 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 now streams (it used to be stream_ids). It loads only the listed streams, so marker streams are no longer automatically converted to annotations unless you list them. All other arguments after streams are keyword-only.

Here are the detailed changes:

✨ Added

  • Add streams parameter to read_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"), and stream_modes() (via mnextend.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 new freq_tolerance parameter (±0.1 Hz by default) (#19 by Clemens Brunner)
  • Add skip_by_annotation parameter to remove_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_ids and marker_ids in read_raw_xdf() in favor of streams (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() except fname and streams keyword-only (#15 by Clemens Brunner)
  • Load only the listed streams when passing stream IDs as the second positional argument of read_raw_xdf() (previously stream_ids), so string marker streams are no longer converted to annotations unless they are listed in streams (#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 ValueError for XDF stream IDs that do not exist in the file (instead of a KeyError) (#15 by Clemens Brunner)