Compare commits

..

2 Commits

Author SHA1 Message Date
Sebastien Bourdeauducq 6e95a08608 add stepper pulser 2022-08-04 13:56:13 +08:00
Sebastien Bourdeauducq bd903b530d add siglent capture script 2022-08-04 13:55:47 +08:00
2 changed files with 82 additions and 0 deletions

36
siglent.py Normal file
View File

@ -0,0 +1,36 @@
# nix-shell -p python3Packages.pyvisa python3Packages.pyvisa-py python3Packages.numpy
import pyvisa as visa
import time
import numpy as np
resources = visa.ResourceManager('@py')
device = resources.open_resource("TCPIP::192.168.1.145::INSTR", write_termination='\n', query_delay=0.25)
print(device.query("*IDN?"))
device.write("*RST")
time.sleep(5)
device.write("MSIZ 20M")
device.write("TIME_DIV 200MS")
device.write("C1:VDIV 2V")
device.write("C2:TRA ON")
device.write("C2:VDIV 2V")
time.sleep(5)
device.write("STOP")
for channel in range(1, 3):
sample_num = int(float(device.query("SANU? C{}".format(channel))))
print("C{}:{}".format(channel, sample_num))
device.write("C{}:WF? DAT2".format(channel))
response = device.read_raw()[18:]
assert len(response) == sample_num
array = np.frombuffer(response, dtype="u8")
np.save("siglent_ch{}.npy".format(channel), array)
time.sleep(1)

46
stepper.py Normal file
View File

@ -0,0 +1,46 @@
from artiq.experiment import *
class Stepper(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("ttl0")
self.setattr_device("ttl1")
@kernel
def run(self):
self.core.reset()
while True:
delay(5*ms)
for i in range(4000):
self.ttl0.pulse(5*us)
delay(5*us)
for i in range(4000):
self.ttl0.pulse(2*us)
delay(2*us)
for i in range(100000):
self.ttl0.pulse(1*us)
delay(1*us)
for i in range(4000):
self.ttl0.pulse(2*us)
delay(2*us)
for i in range(4000):
self.ttl0.pulse(5*us)
delay(5*us)
delay(5*ms)
for i in range(4000):
self.ttl1.pulse(5*us)
delay(5*us)
for i in range(4000):
self.ttl1.pulse(2*us)
delay(2*us)
for i in range(100000):
self.ttl1.pulse(1*us)
delay(1*us)
for i in range(4000):
self.ttl1.pulse(2*us)
delay(2*us)
for i in range(4000):
self.ttl1.pulse(5*us)
delay(5*us)