From 8595b80d59cb3250c103af2669024e8a2d6dd6ea Mon Sep 17 00:00:00 2001 From: A-D-Fuchs <88835934+A-D-Fuchs@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:53:41 +0200 Subject: [PATCH] Fixed bug in reboot method The reboot method gives us an error when executed, as it receives multiple lines but only expected one. If we add the `multiline=True` argument it runs without crashing. We are not sure if this is laser specific behavior as we only have one iBeam smart 515nm laser and can't test it on others. The error: ``` --------------------------------------------------------------------------- TopticaError Traceback (most recent call last) Cell In[2], line 1 ----> 1 laser.reboot() File c:\Users\fulapuser\NOMAD-CAMELS\.desertenv\Lib\site-packages\pylablib\devices\Toptica\ibeam.py:100, in TopticaIBeam.reboot(self) 98 def reboot(self): 99 """Reboot the laser system""" --> 100 self.query("reset system",reply=False,) File c:\Users\fulapuser\NOMAD-CAMELS\.desertenv\Lib\site-packages\pylablib\devices\Toptica\ibeam.py:92, in TopticaIBeam.query(self, comm, multiline, keep_whitespace, check_error, reply) 90 for i in range(ntries): 91 try: ---> 92 return self._do_query(comm,multiline=multiline,keep_whitespace=keep_whitespace,check_error=check_error,reply=reply) 93 except TopticaError: 94 if i==ntries-1: File c:\Users\fulapuser\NOMAD-CAMELS\.desertenv\Lib\site-packages\pylablib\devices\Toptica\ibeam.py:85, in TopticaIBeam._do_query(self, comm, multiline, keep_whitespace, check_error, reply) 83 return lines 84 elif len(lines)>1: ---> 85 raise TopticaError("expected single line, but got response {} with {} lines".format("\n".join(lines),len(lines))) 86 return lines[-1] if lines else None TopticaError: expected single line, but got response SAVE:FSP iBEAMsmart pulse option - Ultra Compact Diode Laser (C)2009, TOPTICA Photonics AG SerialN: iBEAM-SMART-515-S-A3-17694 PowerUP: 00357h LaserON: 00062h LDDinit: PASS TECloop: LOOP TECpass: WAITUSER LaserON: USER Channel: USER RFoscON: USER PWRloop: USER PDreset: USER ExtModu: USER SysBoot: DONE with 16 lines ``` --- pylablib/devices/Toptica/ibeam.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylablib/devices/Toptica/ibeam.py b/pylablib/devices/Toptica/ibeam.py index 5729f35..2077564 100644 --- a/pylablib/devices/Toptica/ibeam.py +++ b/pylablib/devices/Toptica/ibeam.py @@ -97,7 +97,7 @@ def query(self, comm, multiline=False, keep_whitespace=False, check_error="FEW", def reboot(self): """Reboot the laser system""" - self.query("reset system",reply=False) + self.query("reset system",reply=False, multiline=True) def get_device_info(self): """Get the device info of the laser system: ``(serial, version)``""" @@ -197,4 +197,4 @@ def get_temperatures(self): temperatures.append(float(m[1])) else: raise TopticaError("can not parse reply '{}' to query '{}'".format(reply,q)) - return TTemperatures(*temperatures) \ No newline at end of file + return TTemperatures(*temperatures)