pylsl
pylsl copied to clipboard
Sample Pushed when Streaming is closing
Dear all,
I'm writing you to ask about an issue that I have when I'm closing my stream. I'm pushing one sample with a marker stream type and when I stop the execution of my script Labrecorder saves a marker equal to 0 or another number randomly if the sent markers are more than 100. I also used and not used the command "del" to destroy the outlet object but in both cases the randomic marker is saved on Labrecorder... Can you help me? Can you give me some information about this last marker automatically generated?
Have nice day!
This is pretty interesting, though I'm not certain that I understand the problem exactly.
Can you please provide minimal scripts to reproduce the problem (one for the inlet, one for the outlet)?
If you record this outlet with labrecorder app you can see that at the end of pushing a sample equal to 0 or a int32 value choosed in the range of the pushed sample values is sent to LSL env. Idem if you receive with the inlet this markers streaming a sample is printed on console after having destroyed the outlet.
In my code outlet and inlet run in 2 different processes (2 different spyder routines), to simplify the procedure the outlet is a for loop but for while loop of inlet must be stopped manually.
Thank you for the support!!! Have nice day
Outlet:
info = StreamInfo(name='phase', type='Markers', channel_count=1,
channel_format='int32', source_id='example_stream_001')
outlet = StreamOutlet(info) # Broadcast the stream.
time.sleep(10)
lista_stim=[]
num_mark = 200
for i in range(0,num_mark):
last_time = local_clock()
#Send the calculated time stamp to LSL
ph_2stim = [random.randint(10,100)]
outlet.push_sample(ph_2stim, last_time)
print(ph_2stim)
lista_stim.append(ph_2stim)
time.sleep(2)
del outlet
################################################################### Inlet:
from pylsl import resolve_stream,StreamInlet, local_clock
streams = resolve_stream('source_id','example_stream_001') # make connection
inlet0 = StreamInlet(streams[0])
inlet0.open_stream()
while True:
sample,timestamp = inlet0.pull_sample()
print(sample)
What version of pylsl and liblsl are you using on which operating system?
I use a Window 10 sys and pylsl 1.16.1 ( I work on anaconda env with Spyder but from terminal I don't see liblsl package version with conda list command).