MCPcopy Create free account
hub / github.com/LabPy/lantz / test_experiment

Function test_experiment

examples/experiment.py:42–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40 print(sensor.voltage[0])
41
42def test_experiment():
43 import time
44 actuator = LantzSignalGeneratorTCP(host='localhost', port=5678)
45 sensor = LantzVoltmeterTCP(host='localhost', port=5679)
46 actuator.initialize()
47 sensor.initialize()
48
49 actuator.amplitude = 3 * volt
50 actuator.offset = 500 * milivolt
51 actuator.frequency = 1 * Hz
52 actuator.output_enabled = True
53 actuator.waveform = 'sine'
54 sensor.range[0] = 10
55 sensor.range[1] = 10
56
57 data = []
58 start_time = time.time()
59 try:
60 lantz.log.log_to_screen(lantz.log.ERROR)
61 while time.time() - start_time < 10:
62 datapoint = (time.time()-start_time,
63 sensor.voltage[0],
64 sensor.voltage[1])
65 data.append(datapoint)
66 print(data)
67 except KeyboardInterrupt:
68 print('Ending ')
69 finally:
70 actuator.finalize()
71 sensor.finalize()
72
73
74if __name__ == '__main__':

Callers 1

experiment.pyFile · 0.85

Calls 3

initializeMethod · 0.45
timeMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected