I'm trying to use the stream switch box to break the incoming stream up and record the control segments separately from the trial segments. I'm getting very strange behaviour out of the stream switch box using these python-generated stimulations.
Viewing the output of the stream switch with a signal display box, the display remains blank until the target stimulation arrives, and then the scrolling area is instantly filled, the cursor moves a short distance, and then stops, and no additional signal is viewable. Behaviour is similar when viewing the recorded output of the stream switch. (I would like to be able to examine the stream in some more direct fashion than by watching the signal display, but I'm not sure the best way to do this).
The stream switch behaves normally when I tested with the keyboard stimulator box.
Curiously, the python-generated stimulations also seem to do odd things to the stimulation multiplexer box. If I connect a clock stimulator, keyboard stimulator, and the stimulations from my stream matrix all to a stim multiplexer box (which is then connected to a stim listener box), none of the keyboard or clock stimulations are sent to the log, except when there is also a stimulation from the stream. It is as though the clock and keyboard stims are buffered by the multiplexer, and then sent all at once when the recorded stim arrives (I thought this might be the default behaviour of the multiplexer box, but after testing with clock and keyboard stims it seems this is not the case.)
Any idea why this might be occuring? The stimulations do appear in the signal display, and they do show up in the log manager. The python code is modified from the clock stimulator example script. Is it possible that the stimulations are malformed in some way that would cause this behavior (ie, stimulation headers being set erroneously)? My hacking of the python clock stimulator may have left behind something problematic, since I don't really understand the OpenViBE python API clearly at all. Any other clues as to the cause?
Here is the python code that generates the stimulations:
Code: Select all
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
self.stimLabel = None
self.stimCode = None
'''
self.sequence = {
'10': 'OVTK_StimulationId_ExperimentStart',
'30': 'OVTK_StimulationId_SegmentStop',
'330': 'OVTK_StimulationId_SegmentStart',
'630': 'OVTK_StimulationId_SegmentStop',
'930': 'OVTK_StimulationId_SegmentStart',
'1230': 'OVTK_StimulationId_ExperimentStop',
}
'''
self.sequence = {
'1': 'OVTK_StimulationId_ExperimentStart',
'10': 'OVTK_StimulationId_SegmentStart',
'20': 'OVTK_StimulationId_SegmentStop',
'30': 'OVTK_StimulationId_SegmentStart',
'40': 'OVTK_StimulationId_SegmentStop',
}
def initialize(self):
self.output[0].append(OVStimulationHeader(0., 0.))
print "Sequence controller initialized"
def process(self):
currentTimeString = str(int(self.getCurrentTime()))
if currentTimeString in self.sequence:
currentStimLabel = self.sequence[currentTimeString]
currentStimCode = OpenViBE_stimulation[currentStimLabel]
stimSet = OVStimulationSet(self.getCurrentTime(), self.getCurrentTime()+1./self.getClock())
stimSet.append(OVStimulation(currentStimCode, self.getCurrentTime(), 0.))
self.output[0].append(stimSet)
print "Sending stimulation"
def uninitialize(self):
end = self.getCurrentTime()
self.output[0].append(OVStimulationEnd(end, end))
box = MyOVBox()
Thanks very much for your help!
Adam