-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
40 lines (35 loc) · 1.3 KB
/
example.py
File metadata and controls
40 lines (35 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Copyright (c) 2026 University of Bern, Space Research & Planetary Sciences, Linus Leo Stöckli.
This work is licensed under the Creative Commons
Attribution-NonCommercial 4.0 International License.
To view a copy of this license, visit
https://creativecommons.org/licenses/by-nc/4.0/
"""
import time
from teraflash import TeraFlash
import matplotlib.pyplot as plt
if __name__ == "__main__":
# use context manager!
with TeraFlash(log_file="test.log") as device:
print(f"status: {device.get_status()}")
device.set_acq_begin(1100.0) # optional, otherwise use default values
device.set_acq_range(150.0) # optional, otherwise use default values
device.set_acq_avg(10) # optional, otherwise use default values
device.set_laser(True)
device.set_emitter(1, True)
device.set_acq_start()
time.sleep(3)
for i in range(20):
data = device.get_data()
print(data.signal_1)
time.sleep(0.1)
device.set_acq_stop()
device.set_laser(False)
device.set_emitter(1, False)
data = device.get_data()
print(len(data.signal_1))
plt.plot(data.time, data.signal_1, color="black")
plt.xlabel("time [ps]")
plt.ylabel("amplitude [a.u.]")
plt.title("Time Domain Pulse")
plt.show()