-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Digitization is a list-like object of Digpoints with comparison functionalities.
- Loading branch information
Showing
10 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,7 @@ File I/O | |
io.read_info | ||
io.show_fiff | ||
digitization.DigPoint | ||
digitization.Digitization | ||
|
||
Base class: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .base import DigPoint | ||
from .base import DigPoint, Digitization | ||
|
||
__all__ = [ | ||
'DigPoint', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
# Authors: Alexandre Gramfort <[email protected]> | ||
# Joan Massich <[email protected]> | ||
# | ||
# License: BSD (3-clause) | ||
import pytest | ||
import numpy as np | ||
from mne.digitization import Digitization | ||
from mne.digitization.base import _format_dig_points | ||
|
||
dig_dict_list = [ | ||
dict(kind=_, ident=_, r=np.empty((3,)), coord_frame=_) | ||
for _ in [1, 2, 42] | ||
] | ||
|
||
digpoints_list = _format_dig_points(dig_dict_list) | ||
|
||
|
||
@pytest.mark.parametrize('data', [ | ||
pytest.param(digpoints_list, id='list of digpoints'), | ||
pytest.param(dig_dict_list, id='list of digpoint dicts', | ||
marks=pytest.mark.xfail(raises=ValueError)), | ||
pytest.param(['foo', 'bar'], id='list of strings', | ||
marks=pytest.mark.xfail(raises=ValueError)), | ||
]) | ||
def test_digitization_constructor(data): | ||
"""Test Digitization constructor.""" | ||
dig = Digitization(data) | ||
assert dig == data | ||
|
||
dig[0]['kind'] = data[0]['kind'] - 1 # modify something in dig | ||
assert dig != data | ||
|
||
|
||
def test_delete_elements(): | ||
"""Test deleting some Digitization elements.""" | ||
dig = Digitization(digpoints_list) | ||
original_length = len(dig) | ||
del dig[0] | ||
assert len(dig) == original_length - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"""Bunch-related classes.""" | ||
# Authors: Alexandre Gramfort <[email protected]> | ||
# Eric Larson <[email protected]> | ||
# Joan Massich <[email protected]> | ||
# | ||
# License: BSD (3-clause) | ||
|
||
|
@@ -94,10 +95,10 @@ def _named_subclass(klass): | |
class NamedInt(_Named, int): | ||
"""Int with a name in __repr__.""" | ||
|
||
pass | ||
pass # noqa | ||
|
||
|
||
class NamedFloat(_Named, float): | ||
"""Float with a name in __repr__.""" | ||
|
||
pass | ||
pass # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters