Spaces:
Sleeping
Sleeping
Yann Bouteiller
commited on
Commit
·
c20b8b2
1
Parent(s):
1a609ad
added new lsl marker for stimulation and fixed small bug
Browse files- portiloop/capture.py +2 -3
- portiloop/stimulation.py +10 -0
portiloop/capture.py
CHANGED
@@ -1323,8 +1323,7 @@ class Capture:
|
|
1323 |
|
1324 |
buffer = []
|
1325 |
|
1326 |
-
if not self.spindle_detection_mode == 'Fast':
|
1327 |
-
print('here')
|
1328 |
stimulation_delayer = UpStateDelayer(self.frequency, self.spindle_freq, self.spindle_detection_mode == 'Peak')
|
1329 |
stimulator.add_delayer(stimulation_delayer)
|
1330 |
else:
|
@@ -1370,7 +1369,7 @@ class Capture:
|
|
1370 |
|
1371 |
if stimulation_delayer is not None:
|
1372 |
stimulation_delayer.add_point(point[channel-1])
|
1373 |
-
|
1374 |
with self._pause_detect_lock:
|
1375 |
pause = self._pause_detect
|
1376 |
if detector is not None and not pause:
|
|
|
1323 |
|
1324 |
buffer = []
|
1325 |
|
1326 |
+
if not self.spindle_detection_mode == 'Fast' and stimulator is not None:
|
|
|
1327 |
stimulation_delayer = UpStateDelayer(self.frequency, self.spindle_freq, self.spindle_detection_mode == 'Peak')
|
1328 |
stimulator.add_delayer(stimulation_delayer)
|
1329 |
else:
|
|
|
1369 |
|
1370 |
if stimulation_delayer is not None:
|
1371 |
stimulation_delayer.add_point(point[channel-1])
|
1372 |
+
|
1373 |
with self._pause_detect_lock:
|
1374 |
pause = self._pause_detect
|
1375 |
if detector is not None and not pause:
|
portiloop/stimulation.py
CHANGED
@@ -46,7 +46,16 @@ class SleepSpindleRealTimeStimulator(Stimulator):
|
|
46 |
channel_count=1,
|
47 |
channel_format='string',
|
48 |
source_id='portiloop1') # TODO: replace this by unique device identifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
self.lsl_outlet_markers = pylsl.StreamOutlet(lsl_markers_info)
|
|
|
|
|
50 |
self.delayer = None
|
51 |
|
52 |
# Initialize Alsa stuff
|
@@ -102,6 +111,7 @@ class SleepSpindleRealTimeStimulator(Stimulator):
|
|
102 |
# We detect a stimulation
|
103 |
elif sig:
|
104 |
# Record time of stimulation
|
|
|
105 |
ts = time.time()
|
106 |
|
107 |
# Prompt delayer to try and get a stimulation
|
|
|
46 |
channel_count=1,
|
47 |
channel_format='string',
|
48 |
source_id='portiloop1') # TODO: replace this by unique device identifier
|
49 |
+
|
50 |
+
lsl_markers_info_fast = pylsl.StreamInfo(name='Portiloop_stimuli_fast',
|
51 |
+
type='Markers',
|
52 |
+
channel_count=1,
|
53 |
+
channel_format='string',
|
54 |
+
source_id='portiloop1') # TODO: replace this by unique device identifier
|
55 |
+
|
56 |
self.lsl_outlet_markers = pylsl.StreamOutlet(lsl_markers_info)
|
57 |
+
self.lsl_outlet_markers_fast = pylsl.StreamOutlet(lsl_markers_info_fast)
|
58 |
+
|
59 |
self.delayer = None
|
60 |
|
61 |
# Initialize Alsa stuff
|
|
|
111 |
# We detect a stimulation
|
112 |
elif sig:
|
113 |
# Record time of stimulation
|
114 |
+
self.lsl_outlet_markers_fast.push_sample(['FASTSTIM'])
|
115 |
ts = time.time()
|
116 |
|
117 |
# Prompt delayer to try and get a stimulation
|