Moku model: Moku:GO
Operating system: Windows 10 and 11
Software version: Moku firmware v601, Moku Python package v3.3.3, Moku CLI v2.3.0
Hi,
I am trying to perform successive measurments with the datalogger using the get_stream_data method. The goal is to perform a measurment, get the data, process it, change the experimental parameters and then repeat. However, the code fails when trying to perform successive measurments, raising a BrokenPipeError, usually after 3 or 4 measurments.
Exmple of code :
from moku.instruments import Datalogger
import time
class Trace :
def __init__(self,adress,sampling_rate,impedance = ['1MOhm','1MOhm'],coupling = ['AC','AC'],mrange=['10Vpp','10Vpp']):
self.log = Datalogger(adress,force_connect=True)
self.log.set_frontend(1,impedance[0],coupling[0],mrange[0])
#self.log.set_frontend(2,impedance[1],coupling[1],mrange[1])
self.log.enable_input(2,False)
self.log.set_acquisition_mode('Precision')
self.log.set_samplerate(sampling_rate)
print('Moku setup done')
def stream(self,T):
self.log.start_streaming(T)
complete = False
while not complete :
time.sleep(0.1)
progress = self.log.logging_progress()
complete = progress['complete']
data = self.log.get_stream_data()
self.log.stop_streaming()
return(data)
if __name__ == "__main__":
tracer = Trace('[myIPadress]',1e6)
for i in range(100):
test = tracer.stream(1)
print(i)
Error message :
runfile('C:/Users/h.marot/Documents/CodesPythonHugo/mwe.py', wdir='C:/Users/h.marot/Documents/CodesPythonHugo')
Moku setup done
0
1
2
Exception in thread Thread-101:
Traceback (most recent call last):
File "C:\tools\Anaconda3\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Users\h.marot\AppData\Roaming\Python\Python312\site-packages\moku\instruments\_stream.py", line 44, in run
raise StreamException(error)
moku.exceptions.StreamException: Exception in thread mokucli-get-logsink0:
Traceback (most recent call last):
File "threading.py", line 1038, in _bootstrap_inner
File "threading.py", line 975, in run
File "mokucli\converter\targets.py", line 85, in _get_chunk_recursive
BrokenPipeError: [Errno 32] Broken pipe
3
Traceback (most recent call last):
File C:\tools\Anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)
File c:\users\h.marot\documents\codespythonhugo\mwe.py:45
test = tracer.stream(1)
File c:\users\h.marot\documents\codespythonhugo\mwe.py:38 in stream
data = self.log.get_stream_data()
File ~\AppData\Roaming\Python\Python312\site-packages\moku\instruments\_stream.py:163 in get_stream_data
raise Exception
Exception
This error was observed on two different computers (one on windows 10, and one on windows 11), and was observed when the moku was connected to the computer by an USB cable or an ethernet cable.