Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Boonton 4240 RF power meter driver #50

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions lightlab/equipment/lab_instruments/Boonton_4240_PM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import time
from . import VISAInstrumentDriver

class Boonton_4240_PM(VISAInstrumentDriver):
""" Boonton 4240 (4242) Two-Channel RF Power Meter

`Manual: <https://boonton.com/portals/0/products/rf%20power%20meters/4240/4240_instructionmanual.pdf>`__
"""

def __init__(self, name="Booton 4240 PM", address=None, **kwargs):
VISAInstrumentDriver.__init__(self, name=name, address=address, **kwargs)

def reset(self):
return self.write("*RST")

def getID(self):
return self.query("*IDN?")

def getFilterTime(self, channel=1):
return float(self.query(f"SENS{channel}:FILT:TIM?"))

def setFilterTime(self, time=0.05, channel=1):
self.write(f"SENS{channel}:FILT:TIM {time}")

# 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?")
break
except:
pass

splitted = response.split(",")
if len(splitted) == 2:
channel = int(splitted[0])
power = float(splitted[1])
return power
return -99.99


Loading