Skip to content

Commit

Permalink
after testing with device
Browse files Browse the repository at this point in the history
  • Loading branch information
CatherineH committed Sep 17, 2016
1 parent 07cf48a commit ac6aa9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
16 changes: 13 additions & 3 deletions doc/examples/minghe/ex_minghe_mhs5200.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@
mhs.channel[0].frequency = 3000000*pq.Hz
print(mhs.channel[0].frequency)
mhs.channel[0].function = MHS5200.Function.sawtooth_down
print(mhs.channel[0].wave_type)
mhs.channel[0].amplitude[0] = 9.0*pq.V
print(mhs.channel[0].function)
mhs.channel[0].amplitude = 9.0*pq.V
print(mhs.channel[0].amplitude)
mhs.channel[0].offset = -0.5
print(mhs.channel[0].offset)
mhs.channel[0].phase = 90
print(mhs.channel[0].phase)

mhs.channel[1].wave_type = MHS5200.Function.sawtooth_up
mhs.channel[1].frequency = 2000000*pq.Hz
print(mhs.channel[1].frequency)
mhs.channel[1].function = MHS5200.Function.square
print(mhs.channel[1].function)
mhs.channel[1].amplitude = 2.0*pq.V
print(mhs.channel[1].amplitude)
mhs.channel[1].offset = 0.0
print(mhs.channel[1].offset)
mhs.channel[1].phase = 15
print(mhs.channel[1].phase)

8 changes: 8 additions & 0 deletions instruments/minghe/mhs5200a.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ class MHS5200(Instrument):
def __init__(self, filelike):
super(MHS5200, self).__init__(filelike)
self._channel_count = 2
self.terminator = "\r\n"

def _ack_expected(self, msg=""):
if msg.find(":r") == 0:
return None
else:
# most commands res
return "ok"

# INNER CLASSES #

Expand Down
18 changes: 9 additions & 9 deletions instruments/tests/test_minghe/test_minghe_mhs5200a.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_mhs_amplitude():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].amplitude[0] == 3.3*pq.V
assert mhs.channel[1].amplitude[0] == 5.0*pq.V
Expand All @@ -51,7 +51,7 @@ def test_mhs_amplitude_dbm_notimplemented():
[
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
mhs.channel[0].amplitude = 6.6*ik.units.dBm

Expand All @@ -72,7 +72,7 @@ def test_mhs_duty_cycle():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].duty_cycle == 330.0*pq.s
assert mhs.channel[1].duty_cycle == 500.0*pq.s
Expand All @@ -95,7 +95,7 @@ def test_mhs_enable():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].enable
assert not mhs.channel[1].enable
Expand All @@ -119,7 +119,7 @@ def test_mhs_frequency():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].frequency == 33.0*pq.kHz
assert mhs.channel[1].frequency == 500.0*pq.kHz
Expand All @@ -143,7 +143,7 @@ def test_mhs_offset():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].offset == 0
assert mhs.channel[1].offset == -1.2
Expand All @@ -167,7 +167,7 @@ def test_mhs_phase():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].phase == 120
assert mhs.channel[1].phase == 0
Expand All @@ -191,7 +191,7 @@ def test_mhs_wave_type():
"ok",
"ok"
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.channel[0].function == mhs.Function.sine
assert mhs.channel[1].function == mhs.Function.square
Expand All @@ -209,6 +209,6 @@ def test_mhs_serial_number():
[
":r0c5225A1",
],
sep="\n"
sep="\r\n"
) as mhs:
assert mhs.serial_number == "5225A1"

0 comments on commit ac6aa9d

Please sign in to comment.