def close(self): ''' Closes all connections to the USB and, if not inherited, to the LabJacks. In addition to closing the LabJacks, this will use the LabJackPython.Close() function to allow another Python kernel to open these LabJacks. ''' try: self.close_usb() except: sys.stderr.write(tb.format_exc()) if not self.u3_passed: try: self.u3_handle.close() print("U3 closed.") except: sys.stderr.write(tb.format_exc()) if not self.u6_passed: try: self.u6_handle.close() print("U6 closed.") except: sys.stderr.write(tb.format_exc()) if not (self.u3_passed or self.u6_passed): try: LabJackPython.Close() print("LabJacks freed for use in other kernels.") except: sys.stderr.write(tb.format_exc())
def close(self): ''' Close connections to all cavities as well as connections to the LabJacks. This does not turn off any of the cavities. ''' # Close all quenches. try: self.close_quenches(self.quench_info.index) except: sys.stderr.write(tb.format_exc()) # Close both LabJacks try: self.quench_u3.close() print("U3 closed.") except: sys.stderr.write(tb.format_exc()) try: self.quench_u6.close() print("U6 closed.") except: sys.stderr.write(tb.format_exc()) # Free LabJacks from this kernel/thread try: LabJackPython.Close() print("All LabJacks freed for use in other threads.") except: sys.stderr.write(tb.format_exc())
def off_and_close(self): ''' Turn off all SynthUSBs, change all DAC voltages to 0, and close all connections to everything. ''' # Turn off all power in all quenches. self.cavities_off(self.quench_info.index) # Close all quenches. self.close_quenches(self.quench_info.index) # Close both LabJacks. self.quench_u3.close() print("U3 closed.") self.quench_u6.close() print("U6 closed.") # Free LabJacks from this kernel/thread. LabJackPython.Close() print("All LabJacks freed for use in other threads.")
def close(self): if self.is_open: self.device.close() LabJackPython.Close() self.is_open = False