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 some queries for the bandwidth and scale #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
24 changes: 22 additions & 2 deletions spectrum_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
### BEGIN NODE INFO
[info]
name = Spectrum Analyzer Server
version = 2.2
version = 2.3
description =

[startup]
Expand All @@ -39,7 +39,7 @@
from struct import unpack
from twisted.internet.defer import inlineCallbacks, returnValue
from labrad import util
from labrad.units import MHz
from labrad.units import MHz, kHz, dBm

__QUERY__ = """\
:FORM INT,32
Expand Down Expand Up @@ -178,6 +178,20 @@ def set_videobandwidth(self,c,f):
dev = self.selectedDevice(c)
dev.write(':BAND:VID %gkHz' % f['kHz'])

@setting(525, 'Get Resolution Bandwidth', returns='v[MHz]')
def get_resolutionbandwidth(self, c):
"""Query the resolution bandwidth"""
dev = self.selectedDevice(c)
result = yield dev.query(":BAND:RES?")
returnValue(float(result) * 1e-6 * MHz)

@setting(526, 'Get Video Bandwidth', returns='v[kHz]')
def get_videobandwidth(self, c):
"""Query the video bandwidth"""
dev = self.selectedDevice(c)
result = yield dev.query(":BAND:VID?")
returnValue(float(result) * 1e-3 * kHz)

@setting(600, 'Y Scale',setting='s', returns='')
def set_yscale(self,c,setting):
"""This sets the Y scale to either LINear or LOGarithmic"""
Expand Down Expand Up @@ -208,6 +222,12 @@ def set_detector(self, c, setting='POS'):
dev = self.selectedDevice(c)
dev.write(':DET %s' % setting)

@setting(605, "Get Reference Level", returns='v[dBm]')
def get_referencelevel(self, c):
dev = self.selectedDevice(c)
result = yield dev.query('DISP:WIND:TRAC:Y:RLEV?')
returnValue(float(result) * dBm)

@setting(700, 'Trigger Source', setting='s', returns='')
def set_trigsource(self, c, setting='IMM'):
"""This sets the triger source to Free Run, Video, Power Line, or External"""
Expand Down