def open() -> PPS: siglent = find_instrument_by_id(SPD3303X.REGEX_ID) if siglent is not None: # we've found a connected instrument so open and return it rm = pyvisa.ResourceManager() # open_resource could raise visa.VisaIOError? driver = SPD3303X(rm.open_resource(siglent.address)) fixate.drivers.log_instrument_open(driver) return driver bk_precision = find_instrument_by_id(BK178X.REGEX_ID) if bk_precision is not None: driver = BK178X(bk_precision.address) driver.baud_rate = bk_precision.parameters["baud_rate"] fixate.drivers.log_instrument_open(driver) return driver raise fixate.drivers.InstrumentNotFoundError
def open() -> DMM: instrument = find_instrument_by_id(Fluke8846A.REGEX_ID) if instrument is not None: # we've found a connected instrument so open and return it rm = pyvisa.ResourceManager() # open_resource could raise visa.VisaIOError? driver = Fluke8846A(rm.open_resource(instrument.address)) fixate.drivers.log_instrument_open(driver) return driver raise fixate.drivers.InstrumentNotFoundError
def open() -> FuncGen: """Open is the public api for the dmm driver for discovering and opening a connection to a valid Digital Multimeter :return: A instantiated class connected to a valid funcgen """ for driver_class in (Keysight33500B, RigolDG1022): instrument = find_instrument_by_id(driver_class.REGEX_ID) if instrument is not None: # we've found a connected instrument so open and return it rm = pyvisa.ResourceManager() # open_resource could raise visa.VisaIOError? driver = driver_class(rm.open_resource(instrument.address)) fixate.drivers.log_instrument_open(driver) return driver raise fixate.drivers.InstrumentNotFoundError