Skip to content

Commit 78f46e5

Browse files
committed
imported code from base biosig repo
1 parent 21713ed commit 78f46e5

14 files changed

Lines changed: 183 additions & 85 deletions

File tree

‎.flake8‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exclude =
77
docs/sphinxext/
88
docs/tools/
99
docs/conf.py
10-
fileformats/CHANGEME/_version.py
10+
fileformats/vendor/ctf/_version.py
1111
docs/source/conf.py
1212
max-line-length = 88
1313
select = C,E,F,W,B,B950

‎.github/workflows/ci-cd.yml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ jobs:
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v6
31-
- name: Unset header
32-
# checkout@v6 adds a header that makes branch protection report errors
33-
# because the Github action bot is not a collaborator on the repo
34-
run: git config --local --unset http.https://github.com/.extraheader
3531
- name: Fetch tags
3632
run: git fetch --prune --unshallow
3733
- name: Disable etelemetry
@@ -67,10 +63,6 @@ jobs:
6763
with:
6864
submodules: recursive
6965
fetch-depth: 0
70-
- name: Unset header
71-
# checkout@v6 adds a header that makes branch protection report errors
72-
# because the Github action bot is not a collaborator on the repo
73-
run: git config --local --unset http.https://github.com/.extraheader
7466
- name: Set up Python
7567
uses: actions/setup-python@v6
7668
with:

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ repos:
1212
rev: 22.3.0
1313
hooks:
1414
- id: black
15-
exclude: ^(fileformats/CHANGEME/_version\.py)$
15+
exclude: ^(fileformats/vendor/ctf/_version\.py)$
1616
args:
1717
- -l 88
1818
- repo: https://github.com/codespell-project/codespell
1919
rev: v2.1.0
2020
hooks:
2121
- id: codespell
22-
exclude: ^(fileformats/CHANGEME/_version\.py)$
22+
exclude: ^(fileformats/vendor/ctf/_version\.py)$
2323
args:
2424
- --ignore-words=.codespell-ignorewords
2525
- repo: https://github.com/PyCQA/flake8

‎README.rst‎

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
How to customise this template
2-
==============================
3-
4-
#. Name your repository with the name fileformats-<SUBPACKAGE-TO-ADD-EXTRAS-TO>
5-
#. Rename the `fileformats/CHANGEME` directory to the name of the fileformats subpackage the extras are for
6-
#. Search and replace "CHANGEME" with the name of the fileformats subpackage the extras are to be added
7-
#. Replace name + email placeholders in `pyproject.toml` for developers and maintainers
8-
#. Add the extension file-format classes
9-
#. Ensure that all the extension file-format classes are imported into the extras package root, i.e. `fileformats/CHANGEME`
10-
#. Delete these instructions
11-
12-
...
13-
14-
FileFormats Extension - CHANGEME
15-
====================================
16-
.. image:: https://github.com/arcanaframework/fileformats-CHANGEME/actions/workflows/tests.yml/badge.svg
17-
:target: https://github.com/arcanaframework/fileformats-CHANGEME/actions/workflows/tests.yml
18-
.. image:: https://codecov.io/gh/arcanaframework/fileformats-CHANGEME/branch/main/graph/badge.svg?token=UIS0OGPST7
19-
:target: https://codecov.io/gh/arcanaframework/fileformats-CHANGEME
20-
.. image:: https://img.shields.io/github/stars/ArcanaFramework/fileformats-CHANGEME.svg
1+
FileFormats Extension - CTF
2+
===========================
3+
.. image:: https://github.com/arcanaframework/fileformats-vendor-ctf/actions/workflows/tests.yml/badge.svg
4+
:target: https://github.com/arcanaframework/fileformats-vendor-ctf/actions/workflows/tests.yml
5+
.. image:: https://codecov.io/gh/arcanaframework/fileformats-vendor-ctf/branch/main/graph/badge.svg?token=UIS0OGPST7
6+
:target: https://codecov.io/gh/arcanaframework/fileformats-vendor-ctf
7+
.. image:: https://img.shields.io/github/stars/ArcanaFramework/fileformats-vendor-ctf.svg
218
:alt: GitHub stars
22-
:target: https://github.com/ArcanaFramework/fileformats-CHANGEME
9+
:target: https://github.com/ArcanaFramework/fileformats-vendor-ctf
2310
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
2411
:target: https://arcanaframework.github.io/fileformats/
2512
:alt: Documentation Status
2613

27-
This is the "CHANGEME" extension module for the
14+
This is the "CTF" extension module for the
2815
`fileformats <https://github.com/ArcanaFramework/fileformats-core>`__ package
2916

3017

@@ -33,7 +20,7 @@ Quick Installation
3320

3421
This extension can be installed for Python 3 using *pip*::
3522

36-
$ pip3 install fileformats-CHANGEME
23+
$ pip3 install fileformats-vendor-ctf
3724

3825
This will install the core package and any other dependencies
3926

‎conftest.py‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import logging
33
from pathlib import Path
44
import typing as ty
5-
import tempfile
65
import pytest
76

7+
import mne.datasets
8+
89
# Set DEBUG logging for unittests
910

1011
log_level = logging.WARNING
@@ -33,7 +34,21 @@ def pytest_internalerror(excinfo: pytest.ExceptionInfo[BaseException]) -> None:
3334
raise excinfo.value
3435

3536

36-
@pytest.fixture
37-
def work_dir() -> Path:
38-
work_dir = tempfile.mkdtemp()
39-
return Path(work_dir)
37+
# ------------------------------
38+
# Session-scoped fixtures
39+
# ------------------------------
40+
41+
42+
@pytest.fixture(scope="session")
43+
def sample_data_path() -> Path:
44+
return Path(mne.datasets.sample.data_path())
45+
46+
47+
@pytest.fixture(scope="session")
48+
def testing_data_path() -> Path:
49+
return Path(mne.datasets.testing.data_path())
50+
51+
52+
@pytest.fixture(scope="session")
53+
def ctf_ds_path(testing_data_path: Path) -> Path:
54+
return testing_data_path / "CTF" / "testdata_ctf.ds"

‎extras/README.rst‎

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
How to customise this template
2-
==============================
3-
4-
#. Name your repository with the name fileformats-<SUBPACKAGE-TO-ADD-EXTRAS-TO>-extras
5-
#. Rename the `fileformats/extras/CHANGEME` directory to the name of the fileformats subpackage the extras are for
6-
#. Search and replace "CHANGEME" with the name of the fileformats subpackage the extras are to be added
7-
#. Replace name + email placeholders in `pyproject.toml` for developers and maintainers
8-
#. Implement selected "extras" by implementing functions decorated by one of the ``*_extra`` hooks defined in the target fileformats class
9-
#. Ensure that the decorated are imported into the extras package root, i.e. `fileformats/extra/CHANGEME`
10-
#. Delete these instructions
11-
12-
...
13-
14-
FileFormats-CHANGEME Extras
1+
FileFormats-vendor-ctf Extras
152
===========================
16-
.. image:: https://github.com/arcanaframework/fileformats-CHANGEME-extras/actions/workflows/tests.yml/badge.svg
17-
:target: https://github.com/arcanaframework/fileformats-CHANGEME-extras/actions/workflows/tests.yml
18-
.. image:: https://codecov.io/gh/arcanaframework/fileformats-CHANGEME-extras/branch/main/graph/badge.svg?token=UIS0OGPST7
19-
:target: https://codecov.io/gh/arcanaframework/fileformats-CHANGEME-extras
20-
.. image:: https://img.shields.io/github/stars/ArcanaFramework/fileformats-CHANGEME-extras.svg
3+
.. image:: https://github.com/arcanaframework/fileformats-vendor-ctf-extras/actions/workflows/tests.yml/badge.svg
4+
:target: https://github.com/arcanaframework/fileformats-vendor-ctf-extras/actions/workflows/tests.yml
5+
.. image:: https://codecov.io/gh/arcanaframework/fileformats-vendor-ctf-extras/branch/main/graph/badge.svg?token=UIS0OGPST7
6+
:target: https://codecov.io/gh/arcanaframework/fileformats-vendor-ctf-extras
7+
.. image:: https://img.shields.io/github/stars/ArcanaFramework/fileformats-vendor-ctf-extras.svg
218
:alt: GitHub stars
22-
:target: https://github.com/ArcanaFramework/fileformats-CHANGEME
9+
:target: https://github.com/ArcanaFramework/fileformats-vendor-ctf
2310
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
2411
:target: https://arcanaframework.github.io/fileformats/
2512
:alt: Documentation Status
2613

2714

2815
This is a extras module for the
29-
`fileformats-CHANGEME <https://github.com/ArcanaFramework/fileformats-CHANGEME>`__ package, which provides
16+
`fileformats-vendor-ctf <https://github.com/ArcanaFramework/fileformats-vendor-ctf>`__ package, which provides
3017
additional functionality to format classes (i.e. aside from basic identification and validation), such as
3118
conversion tools, metadata parsers, test data generators, etc...
3219

@@ -36,7 +23,7 @@ Quick Installation
3623

3724
This extension can be installed for Python 3 using *pip*::
3825

39-
$ pip3 install fileformats-CHANGEME-extras
26+
$ pip3 install fileformats-vendor-ctf-extras
4027

4128
This will install the core package and any other dependencies
4229

File renamed without changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import typing as ty
2+
3+
import mne.io
4+
5+
from fileformats.core import extra_implementation, FileSet
6+
from fileformats.vendor.ctf.biosig import Ctf
7+
8+
9+
@extra_implementation(FileSet.read_metadata)
10+
def ctf_read_metadata(ctf: Ctf, **kwargs: ty.Any) -> ty.Mapping[str, ty.Any]:
11+
return mne.io.read_raw_ctf(ctf, preload=False, verbose=False).info.to_json_dict() # type: ignore[no-any-return]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Pytest tests for EEG/MEG file format validation and metadata reading.
3+
4+
Test data is downloaded via MNE's dataset utilities and cached for the session.
5+
6+
Authors:
7+
- Miao Cao
8+
9+
Email:
10+
- miaocao@swin.edu.au
11+
"""
12+
13+
from fileformats.biosig import Ctf
14+
15+
# ------------------------------
16+
# MEG: CTF
17+
# ------------------------------
18+
19+
20+
def test_ctf_read_metadata(ctf_ds_path):
21+
metadata = Ctf(ctf_ds_path).metadata
22+
assert isinstance(metadata, dict)
23+
assert metadata["sfreq"] is not None

‎extras/pyproject.toml‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
6-
name = "fileformats-CHANGEME-extras"
7-
description = "Extra methods for accessing and manipulating the underlying data referenced by fileformats-CHANGEME classes"
6+
name = "fileformats-vendor-ctf-extras"
7+
description = "Extra methods for accessing and manipulating the underlying data referenced by fileformats-vendor-ctf classes"
88
readme = "README.rst"
9-
requires-python = ">=3.8"
9+
requires-python = ">=3.11"
1010
dependencies = [
11-
"fileformats >= 0.10",
12-
"pydra >= 0.22.0"
11+
"fileformats >= 0.17.5",
12+
"pydra >= 1.0a9",
13+
"fileformats-biosig >= 0.1.0",
14+
"fileformats-vendor-ctf >= 0.1.0",
1315
]
1416
license = {file = "LICENSE"}
1517
authors = [
16-
{name = "<YOUR-NAME>", email = "<YOUR-EMAIL>"},
18+
{name = "Thomas G. Close", email = "tom.g.close@gmail.com"},
1719
]
1820
maintainers = [
19-
{name = "<YOUR-NAME>", email = "<YOUR-EMAIL>"},
21+
{name = "Thomas G. Close", email = "tom.g.close@gmail.com"},
2022
]
2123
keywords = [
2224
"file formats",
@@ -30,10 +32,10 @@ classifiers = [
3032
"Operating System :: MacOS :: MacOS X",
3133
"Operating System :: Microsoft :: Windows",
3234
"Operating System :: POSIX :: Linux",
33-
"Programming Language :: Python :: 3.8",
34-
"Programming Language :: Python :: 3.9",
35-
"Programming Language :: Python :: 3.10",
3635
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: 3.13",
38+
"Programming Language :: Python :: 3.14",
3739
"Topic :: Scientific/Engineering",
3840
]
3941
dynamic = ["version"]
@@ -57,21 +59,21 @@ converters = [
5759
]
5860

5961
[project.urls]
60-
repository = "https://github.com/ArcanaFramework/fileformats-CHANGEME"
62+
repository = "https://github.com/ArcanaFramework/fileformats-vendor-ctf"
6163

6264
[tool.hatch.version]
6365
source = "vcs"
6466
raw-options = {root = ".."}
6567

6668
[tool.hatch.build.hooks.vcs]
67-
version-file = "fileformats/extras/CHANGEME/_version.py"
69+
version-file = "fileformats/extras/vendor/ctf/_version.py"
6870

6971
[tool.hatch.build.targets.wheel]
7072
packages = ["fileformats"]
7173

7274
[tool.black]
7375
target-version = ['py38']
74-
exclude = "fileformats/extras/CHANGEME/_version.py"
76+
exclude = "fileformats/extras/vendor/ctf/_version.py"
7577

7678
[tool.codespell]
7779
ignore-words = ".codespell-ignorewords"

0 commit comments

Comments
 (0)