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

Update srsdg645.py #219

Merged
merged 4 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions instruments/srs/srsdg645.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,24 @@ def level_amplitude(self, newval):
newval = assume_units(newval, 'V').magnitude
self._parent.sendcmd("LAMP {},{}".format(self._idx, newval))

@property
def level_offset(self):
"""
Amplitude offset (in voltage) of the output level for this output.

:type: `float` or :class:`~quantities.Quantity`
:units: As specified, or :math:`\\text{V}` by default.
"""
return pq.Quantity(
float(self._parent.query('LOFF? {}'.format(self._idx))),
'V'
)

@level_offset.setter
def level_offset(self, newval):
newval = assume_units(newval, 'V').magnitude
self._parent.sendcmd("LOFF {},{}".format(self._idx, newval))

# PROPERTIES #

@property
Expand Down
20 changes: 19 additions & 1 deletion instruments/tests/test_srs/test_srsdg645.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def test_srsdg645_output_level():
"""
SRSDG645: Checks getting/setting unitful ouput level.
SRSDG645: Checks getting/setting unitful output level.
"""
with expected_protocol(
ik.srs.SRSDG645,
Expand All @@ -36,6 +36,24 @@ def test_srsdg645_output_level():
ddg.output['AB'].level_amplitude = 4.0


def test_srsdg645_output_offset():
"""
SRSDG645: Checks getting/setting unitful output offset.
"""
with expected_protocol(
ik.srs.SRSDG645,
[
"LOFF? 1",
"LOFF 1,2.0",
],
[
"1.2"
]
) as ddg:
unit_eq(ddg.output['AB'].level_offset, pq.Quantity(1.2, "V"))
ddg.output['AB'].level_offset = 2.0


def test_srsdg645_output_polarity():
"""
SRSDG645: Checks getting/setting
Expand Down