Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
HPIB
Commits
7caaa6e7
Commit
7caaa6e7
authored
Apr 13, 2018
by
Tammo Jan Dijkema
Browse files
Throw error if device is off
parent
abe68804
Changes
1
Hide whitespace changes
Inline
Side-by-side
camrasdevices.py
View file @
7caaa6e7
...
@@ -11,12 +11,16 @@ class CamrasHpibDevice(HpibDevice):
...
@@ -11,12 +11,16 @@ class CamrasHpibDevice(HpibDevice):
@
property
@
property
def
frequency
(
self
):
def
frequency
(
self
):
"""Returns the frequency (in Hz) of the receiver"""
"""Returns the frequency (in Hz) of the device. Throws a RuntimeError if no response"""
freq_str
=
self
.
query
(
"freq?"
)
if
len
(
freq_str
)
==
0
:
raise
RuntimeError
(
"Camras device at address {} is not responding"
.
format
(
self
.
_hpib_address
))
return
int
(
float
(
self
.
query
(
"freq?"
)))
return
int
(
float
(
self
.
query
(
"freq?"
)))
@
frequency
.
setter
@
frequency
.
setter
def
frequency
(
self
,
freq
):
def
frequency
(
self
,
freq
):
"""Set the receiver to the specified frequency. Throws a RuntimeError if failed"""
"""Set the device to the specified frequency. Throws a RuntimeError if failed"""
print
(
"setting frequency to"
,
freq
)
self
.
command
(
"freq {:d} Hz"
.
format
(
int
(
freq
)))
self
.
command
(
"freq {:d} Hz"
.
format
(
int
(
freq
)))
new_freq
=
self
.
frequency
new_freq
=
self
.
frequency
if
new_freq
!=
freq
:
if
new_freq
!=
freq
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment