Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
kaare-mikkelsen authored Jun 11, 2024
2 parents a92016a + af7c246 commit 7fe3834
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 55 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Upload a Python Package using Twine when a release is created

name: build
on: # yamllint disable-line rule:truthy
release:
types: [published]
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- run: python -m build --sdist --wheel
- run: twine check --strict dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist

pypi-upload:
needs: package
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
id-token: write # for trusted publishing
environment:
name: pypi
url: https://pypi.org/p/mne
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release'
31 changes: 31 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ concurrency:
on:
push:
branches: ['**']
tags: ['**']
pull_request:
branches: ['**']
schedule:
Expand Down Expand Up @@ -289,3 +290,33 @@ jobs:
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml

build_docs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: build_docs-0-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
python -m pip install -e .[test,doc]
- name: Build the documentation
run: |
make build-doc
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/_build/html
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.4.8
hooks:
- id: ruff
name: ruff mne_bids/
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018-2023, mne-bids developers
Copyright (c) 2018, mne-bids developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
9 changes: 7 additions & 2 deletions doc/_static/versions.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
[
{
"name": "0.15 (devel)",
"name": "0.16 (devel)",
"version": "dev",
"url": "https://mne.tools/mne-bids/dev/"
},
{
"name": "0.14 (stable)",
"name": "0.15 (stable)",
"version": "stable",
"url": "https://mne.tools/mne-bids/v0.15/"
},
{
"name": "0.14",
"version": "0.14",
"url": "https://mne.tools/mne-bids/v0.14/"
},
{
Expand Down
47 changes: 8 additions & 39 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,20 @@
What's new?
===========

.. _changes_0_15:
.. _changes_0_16:

Version 0.15 (unreleased)
Version 0.16 (unreleased)
-------------------------

👩🏽‍💻 Authors
~~~~~~~~~~~~~~~

The following authors contributed for the first time. Thank you so much! 🤩

* `Daniel McCloy`_
* `Mara Wolter`_
* `Julius Welzel`_
* nobody yet

The following authors had contributed before. Thank you for sticking around! 🤘

* `Alex Rockhill`_
* `Eric Larson`_
* `Laetitia Fesselier`_
* `Richard Höchenberger`_
* `Stefan Appelhoff`_

Detailed list of changes
Expand All @@ -35,52 +29,27 @@ Detailed list of changes
🚀 Enhancements
^^^^^^^^^^^^^^^

- Including a description for ``onset`` and ``duration`` in the ``events.json`` file, by `Julius Welzel`_ (:gh:`1255`)
- nothing yet

🧐 API and behavior changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- The experimental support for running MNE-BIDS examples from your browser using Binder has
been removed, by `Stefan Appelhoff`_ (:gh:`1202`)
- MNE-BIDS will no longer zero-pad ("zfill") entity indices passed to :class:`~mne_bids.BIDSPath`.
For example, If ``run=1`` is passed to MNE-BIDS, it will no longer be silently auto-converted to ``run-01``, by `Alex Rockhill`_ (:gh:`1215`)
- MNE-BIDS will no longer warn about missing leading punctuation marks for extensions passed :class:`~mne_bids.BIDSPath`.
For example, MNE-BIDS will now silently auto-convert ``edf`` to ```.edf``, by `Alex Rockhill`_ (:gh:`1215`)
- nothing yet

🛠 Requirements
^^^^^^^^^^^^^^^

- MNE-BIDS now requires Python 3.9 or higher.
- MNE-BIDS now requires MNE-Python 1.5.0 or higher.
- ``edfio`` replaces ``EDFlib-Python`` for export to EDF with MNE-Python >= 1.7.0.
- Installing ``mne-bids[full]`` will now also install ``defusedxml`` on all platforms.
- Version requirements for optional dependency packages have been bumped up, see installation instructions.
- nothing yet

🪲 Bug fixes
^^^^^^^^^^^^

- The datatype in the dataframe returned by :func:`mne_bids.stats.count_events` is now
``pandas.Int64Dtype`` instead of ``float64``, by `Eric Larson`_ (:gh:`1227`)
- The :func:`mne_bids.copyfiles.copyfile_ctf` now accounts for files with ``.{integer}_meg4`` extension, instead of only .meg4,
when renaming the files of a .ds folder, by `Mara Wolter`_ (:gh:`1230`)
- We fixed handling of time zones when reading ``*_scans.tsv`` files; specifically, non-UTC timestamps are now processed correctly,
by `Stefan Appelhoff`_ and `Richard Höchenberger`_ (:gh:`1240`)
- nothing yet

⚕️ Code health
^^^^^^^^^^^^^^

- The configuration of MNE-BIDS has been consolidated from several files (e.g., ``setup.cfg``,
``setup.py``, ``requirements.txt``) and is now specified in a standard ``pyproject.toml``
file, by `Stefan Appelhoff`_ (:gh:`1202`)
- Linting and code formatting is now done entirely using ``ruff``. Previously used tools
(e.g., ``flake8``, ``black``) have been fully replaced, by `Stefan Appelhoff`_ (:gh:`1203`)
- The package build backend has been switched from ``setuptools`` to ``hatchling``. This
only affects users who build and install MNE-BIDS from source, and should not lead to
changed runtime behavior, by `Richard Höchenberger`_ (:gh:`1204`)
- Display of the version number on the website is now truncated for over-long version strings,
by `Daniel McCloy`_ (:gh:`1206`)
- The long deprecated ``events_data`` parameter has been fully removed from
:func:`~mne_bids.write_raw_bids` in favor of ``events``, by `Stefan Appelhoff`_ (:gh:`1229`)
- nothing yet

:doc:`Find out what was new in previous releases <whats_new_previous_releases>`

Expand Down
78 changes: 78 additions & 0 deletions doc/whats_new_previous_releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,84 @@
What was new in previous releases?
==================================

.. _changes_0_15:

Version 0.15 (2024-06-04)
-------------------------

👩🏽‍💻 Authors
~~~~~~~~~~~~~~~

The following authors contributed for the first time. Thank you so much! 🤩

* `Mara Wolter`_
* `Julius Welzel`_

The following authors had contributed before. Thank you for sticking around! 🤘

* `Alex Rockhill`_
* `Daniel McCloy`_
* `Eric Larson`_
* `Laetitia Fesselier`_
* `Mathieu Scheltienne`_
* `Richard Höchenberger`_
* `Stefan Appelhoff`_

Detailed list of changes
~~~~~~~~~~~~~~~~~~~~~~~~

🚀 Enhancements
^^^^^^^^^^^^^^^

- Including a description for ``onset`` and ``duration`` in the ``events.json`` file, by `Julius Welzel`_ (:gh:`1255`)

🧐 API and behavior changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- The experimental support for running MNE-BIDS examples from your browser using Binder has
been removed, by `Stefan Appelhoff`_ (:gh:`1202`)
- MNE-BIDS will no longer zero-pad ("zfill") entity indices passed to :class:`~mne_bids.BIDSPath`.
For example, If ``run=1`` is passed to MNE-BIDS, it will no longer be silently auto-converted to ``run-01``, by `Alex Rockhill`_ (:gh:`1215`)
- MNE-BIDS will no longer warn about missing leading punctuation marks for extensions passed :class:`~mne_bids.BIDSPath`.
For example, MNE-BIDS will now silently auto-convert ``edf`` to ```.edf``, by `Alex Rockhill`_ (:gh:`1215`)
- MNE-BIDS will no longer error during `~mne_bids.write_raw_bids` if there are ``BAD_ACQ_SKIP`` annotations in the raw file and no corresponding key in ``event_id``.
Instead, it will automatically add the necessary key and assign an unused integer event code to it. By `Daniel McCloy`_ (:gh:`1258`)

🛠 Requirements
^^^^^^^^^^^^^^^

- MNE-BIDS now requires Python 3.9 or higher.
- MNE-BIDS now requires MNE-Python 1.5.0 or higher.
- ``edfio`` replaces ``EDFlib-Python`` for export to EDF with MNE-Python >= 1.7.0.
- Installing ``mne-bids[full]`` will now also install ``defusedxml`` on all platforms.
- Version requirements for optional dependency packages have been bumped up, see installation instructions.

🪲 Bug fixes
^^^^^^^^^^^^

- The datatype in the dataframe returned by :func:`mne_bids.stats.count_events` is now
``pandas.Int64Dtype`` instead of ``float64``, by `Eric Larson`_ (:gh:`1227`)
- The :func:`mne_bids.copyfiles.copyfile_ctf` now accounts for files with ``.{integer}_meg4`` extension, instead of only .meg4,
when renaming the files of a .ds folder, by `Mara Wolter`_ (:gh:`1230`)
- We fixed handling of time zones when reading ``*_scans.tsv`` files; specifically, non-UTC timestamps are now processed correctly,
by `Stefan Appelhoff`_ and `Richard Höchenberger`_ (:gh:`1240`)

⚕️ Code health
^^^^^^^^^^^^^^

- The configuration of MNE-BIDS has been consolidated from several files (e.g., ``setup.cfg``,
``setup.py``, ``requirements.txt``) and is now specified in a standard ``pyproject.toml``
file, by `Stefan Appelhoff`_ (:gh:`1202`)
- Linting and code formatting is now done entirely using ``ruff``. Previously used tools
(e.g., ``flake8``, ``black``) have been fully replaced, by `Stefan Appelhoff`_ (:gh:`1203`)
- The package build backend has been switched from ``setuptools`` to ``hatchling``. This
only affects users who build and install MNE-BIDS from source, and should not lead to
changed runtime behavior, by `Richard Höchenberger`_ (:gh:`1204`)
- Display of the version number on the website is now truncated for over-long version strings,
by `Daniel McCloy`_ (:gh:`1206`)
- The long deprecated ``events_data`` parameter has been fully removed from
:func:`~mne_bids.write_raw_bids` in favor of ``events``, by `Stefan Appelhoff`_ (:gh:`1229`)

.. _changes_0_14:

Version 0.14 (2023-11-16)
Expand Down
9 changes: 9 additions & 0 deletions mne_bids/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,18 @@ def _read_events(events, event_id, raw, bids_path=None):
'To specify custom event codes, please pass "event_id".'
)
else:
special_annots = {"BAD_ACQ_SKIP"}
desc_without_id = sorted(
set(raw.annotations.description) - set(event_id.keys())
)
# auto-add entries to `event_id` for "special" annotation values
# (but only if they're needed)
if set(desc_without_id) & special_annots:
for annot in special_annots:
# use a value guaranteed to not be in use
event_id = {annot: max(event_id.values()) + 90000} | event_id
# remove the "special" annots from the list of problematic annots
desc_without_id = sorted(set(desc_without_id) - special_annots)
if desc_without_id:
raise ValueError(
f"The provided raw data contains annotations, but "
Expand Down
Loading

0 comments on commit 7fe3834

Please sign in to comment.