From aba883388232415483bfc48f9c9747169e26036f Mon Sep 17 00:00:00 2001 From: Josh Lederman Date: Wed, 13 Nov 2024 13:01:40 -0500 Subject: [PATCH] Tested Boonton 4240 RF PM driver --- .../lab_instruments/Boonton_4240_PM.py | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lightlab/equipment/lab_instruments/Boonton_4240_PM.py b/lightlab/equipment/lab_instruments/Boonton_4240_PM.py index 317c4c0..079359b 100644 --- a/lightlab/equipment/lab_instruments/Boonton_4240_PM.py +++ b/lightlab/equipment/lab_instruments/Boonton_4240_PM.py @@ -1,9 +1,11 @@ import time from . import VISAInstrumentDriver -# TODO: Need to ensure the wait time matches the filter time properly, and implement waiting here - class Boonton_4240_PM(VISAInstrumentDriver): + """ Boonton 4240 (4242) Two-Channel RF Power Meter + + `Manual: `__ + """ def __init__(self, name="Booton 4240 PM", address=None, **kwargs): VISAInstrumentDriver.__init__(self, name=name, address=address, **kwargs) @@ -11,27 +13,29 @@ def __init__(self, name="Booton 4240 PM", address=None, **kwargs): def reset(self): return self.write("*RST") - def get_id(self): + def getID(self): return self.query("*IDN?") - def get_filter_time(self, channel=1): + def getFilterTime(self, channel=1): return float(self.query(f"SENS{channel}:FILT:TIM?")) - def set_filter_time(self, time=0.05, channel=1): - self.time + def setFilterTime(self, time=0.05, channel=1): self.write(f"SENS{channel}:FILT:TIM {time}") - def read(self, channel=1, wait_time=5): - for i in range(10): + # Note: this function fails for filter times beyond 1. More investigation required + def read(self, channel=1): + for i in range(3): try: - response = self.query(f"READ{channel}:CW:POW?", wait_time=wait_time) # Averaging time + response = self.query(f"READ{channel}:CW:POW?") break except: pass splitted = response.split(",") - channel = int(splitted[0]) - power = float(splitted[1]) - return power + if len(splitted) == 2: + channel = int(splitted[0]) + power = float(splitted[1]) + return power + return -99.99 \ No newline at end of file