Skip to content

Commit ec2be63

Browse files
committed
Thread locks
typos
1 parent 7f2d613 commit ec2be63

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

obci/interfaces/bci/p300_MD/p300_classm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import scipy.stats
88
import scipy.signal as ss
99
from sklearn.externals import joblib
10-
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
10+
try:
11+
from sklearn.lda import LDA as LinearDiscriminantAnalysis
12+
except ImportError:
13+
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
14+
1115
from collections import deque
1216
from obci.interfaces.bci.abstract_classifier import AbstractClassifier
1317
import pickle

obci/interfaces/bci/p300_MD/tests/synthetic_generator.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def send_isi(self):
156156

157157
def send_target(self):
158158
self.logger.info('Sending target, focus: {}'.format(self.focus))
159-
self.sent_targets+=1
159+
with self.lock:
160+
self.sent_targets+=1
160161
length_window = int(self.window*self.sampling_rate)
161162
length_packet_aligned = length_window - length_window % self.samples_per_packet
162163
gauss_w = gaussian(length_packet_aligned, length_packet_aligned/10)
@@ -200,10 +201,8 @@ def run(self):
200201
for i in xrange(self.test_trials_n):
201202
for k in xrange(len(self.fields)-1):
202203
#handle_message can wait a while
203-
with self.lock:
204-
self.send_isi()
205-
with self.lock:
206-
self.send_target()
204+
self.send_isi()
205+
self.send_target()
207206
with self.lock:
208207
self.save_statistics()
209208
sys.exit(0)
@@ -226,7 +225,7 @@ def save_statistics(self):
226225
self.logger.info(
227226
'''Basic statistics:
228227
correct classifications: {:.2f}\% {} out of {}
229-
mean targets required {:.2f}'''.format(channel_names, correct, N, mean_targets)
228+
mean targets required {:.2f}'''.format(correctperc, correct, N, mean_targets)
230229
)
231230

232231

0 commit comments

Comments
 (0)