braindecode 0.1.5.2__tar.gz → 0.1.5.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/PKG-INFO +1 -1
  2. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/SOURCES.txt +1 -2
  3. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/PKG-INFO +1 -1
  4. Braindecode-0.1.5.4/braindecode/datasets/bcic_iv_2a.py +79 -0
  5. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/signalproc.py +2 -2
  6. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.datasets.rst +8 -0
  7. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/setup.py +1 -1
  8. Braindecode-0.1.5.2/docs/notebooks/BBCI_Comparison.ipynb +0 -827
  9. Braindecode-0.1.5.2/docs/notebooks/BBCI_Data_Common_Average?.ipynb +0 -1372
  10. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/dependency_links.txt +0 -0
  11. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/not-zip-safe +0 -0
  12. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/requires.txt +0 -0
  13. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/Braindecode.egg-info/top_level.txt +0 -0
  14. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/LICENSE.txt +0 -0
  15. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/MANIFEST.in +0 -0
  16. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/README.rst +0 -0
  17. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/__init__.py +0 -0
  18. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datasets/__init__.py +0 -0
  19. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datasets/bbci.py +0 -0
  20. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datasets/multiple.py +0 -0
  21. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/__init__.py +0 -0
  22. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/iterators.py +0 -0
  23. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/signal_target.py +0 -0
  24. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/splitters.py +0 -0
  25. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/trial_segment.py +0 -0
  26. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/datautil/util.py +0 -0
  27. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/experiments/__init__.py +0 -0
  28. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/experiments/experiment.py +0 -0
  29. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/experiments/monitors.py +0 -0
  30. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/experiments/stopcriteria.py +0 -0
  31. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/mne_ext/__init__.py +0 -0
  32. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/mne_ext/signalproc.py +0 -0
  33. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/models/__init__.py +0 -0
  34. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/models/deep4.py +0 -0
  35. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/models/eegnet.py +0 -0
  36. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/models/shallow_fbcsp.py +0 -0
  37. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/models/util.py +0 -0
  38. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/__init__.py +0 -0
  39. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/constraints.py +0 -0
  40. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/functions.py +0 -0
  41. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/init.py +0 -0
  42. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/losses.py +0 -0
  43. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/modules.py +0 -0
  44. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/torch_ext/util.py +0 -0
  45. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/braindecode/util.py +0 -0
  46. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/Makefile +0 -0
  47. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/conf.py +0 -0
  48. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/index.rst +0 -0
  49. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/BBCI_Data.ipynb +0 -0
  50. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/BBCI_Data_Start_Stop.ipynb +0 -0
  51. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/BBCI_Data_Trialwise.ipynb +0 -0
  52. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/Cropped_Decoding.ipynb +0 -0
  53. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/Experiment_Class.ipynb +0 -0
  54. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/notebooks/TrialWise_Decoding.ipynb +0 -0
  55. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.datautil.rst +0 -0
  56. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.experiments.rst +0 -0
  57. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.mne_ext.rst +0 -0
  58. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.models.rst +0 -0
  59. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.rst +0 -0
  60. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/braindecode.torch_ext.rst +0 -0
  61. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/docs/source/modules.rst +0 -0
  62. {Braindecode-0.1.5.2 → Braindecode-0.1.5.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.1.5.2
3
+ Version: 0.1.5.4
4
4
  Summary: A deep learning toolbox to decode raw time-domain EEG.
5
5
  Home-page: https://github.com/robintibor/braindecode
6
6
  Author: Robin Tibor Schirrmeister
@@ -12,6 +12,7 @@ braindecode/__init__.py
12
12
  braindecode/util.py
13
13
  braindecode/datasets/__init__.py
14
14
  braindecode/datasets/bbci.py
15
+ braindecode/datasets/bcic_iv_2a.py
15
16
  braindecode/datasets/multiple.py
16
17
  braindecode/datautil/__init__.py
17
18
  braindecode/datautil/iterators.py
@@ -41,9 +42,7 @@ braindecode/torch_ext/util.py
41
42
  docs/Makefile
42
43
  docs/conf.py
43
44
  docs/index.rst
44
- docs/notebooks/BBCI_Comparison.ipynb
45
45
  docs/notebooks/BBCI_Data.ipynb
46
- docs/notebooks/BBCI_Data_Common_Average?.ipynb
47
46
  docs/notebooks/BBCI_Data_Start_Stop.ipynb
48
47
  docs/notebooks/BBCI_Data_Trialwise.ipynb
49
48
  docs/notebooks/Cropped_Decoding.ipynb
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Braindecode
3
- Version: 0.1.5.2
3
+ Version: 0.1.5.4
4
4
  Summary: A deep learning toolbox to decode raw time-domain EEG.
5
5
  Home-page: https://github.com/robintibor/braindecode
6
6
  Author: Robin Tibor Schirrmeister
@@ -0,0 +1,79 @@
1
+ import numpy as np
2
+ import mne
3
+ from scipy.io import loadmat
4
+
5
+ class BCICompetition4Set2A(object):
6
+ def __init__(self, filename, load_sensor_names=None,
7
+ labels_filename=None):
8
+ assert load_sensor_names is None
9
+ self.__dict__.update(locals())
10
+ del self.self
11
+
12
+ def load(self):
13
+ cnt = self.extract_data()
14
+ events, artifact_trial_mask = self.extract_events(cnt)
15
+ cnt.info['events'] = events
16
+ cnt.info['artifact_trial_mask'] = artifact_trial_mask
17
+ return cnt
18
+
19
+ def extract_data(self):
20
+ raw_edf = mne.io.read_raw_edf(self.filename, stim_channel='auto')
21
+ raw_edf.load_data()
22
+ # correct nan values
23
+
24
+ data = raw_edf.get_data()
25
+
26
+ # do not correct stimulus channel
27
+ assert raw_edf.ch_names[-1] == 'STI 014'
28
+ for i_chan in range(data.shape[0] - 1):
29
+ # first set to nan, than replace nans by nanmean.
30
+ this_chan = data[i_chan]
31
+ data[i_chan] = np.where(this_chan == np.min(this_chan),
32
+ np.nan, this_chan)
33
+ mask = np.isnan(data[i_chan])
34
+ chan_mean = np.nanmean(data[i_chan])
35
+ data[i_chan, mask] = chan_mean
36
+ gdf_events = raw_edf.get_edf_events()
37
+ raw_edf = mne.io.RawArray(data, raw_edf.info, verbose='WARNING')
38
+ # remember gdf events
39
+ raw_edf.info['gdf_events'] = gdf_events
40
+ return raw_edf
41
+
42
+ def extract_events(self, raw_edf):
43
+ # all events
44
+ events = np.array(list(zip(
45
+ raw_edf.info['gdf_events'][1],
46
+ raw_edf.info['gdf_events'][2])))
47
+
48
+ # only trial onset events
49
+ trial_mask = [ev_code in [769, 770, 771, 772, 783]
50
+ for ev_code in events[:,1]]
51
+ trial_events = events[trial_mask]
52
+ assert (len(trial_events) == 288), (
53
+ "Got {:d} markers".format(len(trial_events)))
54
+ # event markers 769,770 -> 1,2
55
+ trial_events[:, 1] = trial_events[:, 1] - 768
56
+ # possibly overwrite with markers from labels file
57
+ if self.labels_filename is not None:
58
+ classes = loadmat(self.labels_filename)['classlabel'].squeeze()
59
+ trial_events[:, 1] = classes
60
+ unique_classes = np.unique(trial_events[:, 1])
61
+ assert np.array_equal([1, 2, 3 ,4], unique_classes), (
62
+ "Expect 1,2,3,4 as class labels, got {:s}".format(
63
+ str(unique_classes))
64
+ )
65
+ # now also create 0-1 vector for rejected trials
66
+ trial_start_events = events[events[:, 1] == 768]
67
+ assert len(trial_start_events) == len(trial_events)
68
+ artifact_trial_mask = np.zeros(len(trial_events), dtype=np.uint8)
69
+ artifact_events = events[events[:, 1] == 1023]
70
+ for artifact_time in artifact_events[:, 0]:
71
+ i_trial = trial_start_events[:, 0].tolist().index(artifact_time)
72
+ artifact_trial_mask[i_trial] = 1
73
+
74
+ # mne expects events with 3 ints each:
75
+ events = np.zeros((len(trial_events), 3), dtype=np.int32)
76
+ events[:,0] = trial_events[:,0]
77
+ events[:,2] = trial_events[:,1]
78
+
79
+ return events, artifact_trial_mask
@@ -179,9 +179,9 @@ def bandpass_cnt(data, low_cut_hz, high_cut_hz, fs, filt_order=3, axis=0):
179
179
  nyq_freq = 0.5 * fs
180
180
  low = low_cut_hz / nyq_freq
181
181
  high = high_cut_hz / nyq_freq
182
- b, a = scipy.signal.butter(filt_order, [low, high], btype='bandpass', axis=axis)
182
+ b, a = scipy.signal.butter(filt_order, [low, high], btype='bandpass')
183
183
  assert filter_is_stable(a), "Filter should be stable..."
184
- data_bandpassed = scipy.signal.lfilter(b, a, data, axis=0)
184
+ data_bandpassed = scipy.signal.lfilter(b, a, data, axis=axis)
185
185
  return data_bandpassed
186
186
 
187
187
 
@@ -17,6 +17,14 @@ braindecode\.datasets\.bbci module
17
17
  :undoc-members:
18
18
  :show-inheritance:
19
19
 
20
+ braindecode\.datasets\.bcic\_iv\_2a module
21
+ ------------------------------------------
22
+
23
+ .. automodule:: braindecode.datasets.bcic_iv_2a
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
20
28
  braindecode\.datasets\.multiple module
21
29
  --------------------------------------
22
30
 
@@ -15,7 +15,7 @@ setup(
15
15
  # Versions should comply with PEP440. For a discussion on single-sourcing
16
16
  # the version across setup.py and the project code, see
17
17
  # http://packaging.python.org/en/latest/tutorial.html#version
18
- version='0.1.5.2', # TODO: read from __init__.py?
18
+ version='0.1.5.4', # TODO: read from __init__.py?
19
19
 
20
20
  description='A deep learning toolbox to decode raw time-domain EEG.',
21
21
  long_description=long_description,