Skip to content

Commit 39c6f0b

Browse files
committed
Name all the args
1 parent 255d74e commit 39c6f0b

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

example.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165

166166
# The time (in seconds) we wish the pineblaster pseudoclock to start after
167167
# the master pseudoclock (the pulseblaster)
168-
pineblaster_0.set_initial_trigger_time(0.9)
168+
pineblaster_0.set_initial_trigger_time(t=0.9)
169169

170170
# Start the experiment!
171171
start()
@@ -176,32 +176,32 @@
176176
# Analog Acquisitions are acquired at the sample rate specified when the *device* is
177177
# instantiated (eg NI_PCIE_6363() above)
178178
# Acquire an analog trace on this channel from t=0s to t=1s
179-
input1.acquire('measurement1', 0, 1)
179+
input1.acquire(label='measurement1', start_time=0, end_time=1)
180180
# Acquire an analog trace on this channel from t=3s to t=5s
181-
input1.acquire('measurement2', 3, 5)
181+
input1.acquire(label='measurement2', start_time=3, end_time=5)
182182
# Acquire an analog trace on this channel from t=7s to t=9s
183-
input1.acquire('measurement3', 7, 9)
183+
input1.acquire(label='measurement3', start_time=7, end_time=9)
184184

185185
# Set some initial values (t=0) for DDS 1
186-
dds1.setamp(t, 0.5)
187-
dds1.setfreq(t, 0.6)
188-
dds1.setphase(t, 0.7)
186+
dds1.setamp(t=t, value=0.5)
187+
dds1.setfreq(t=t, value=0.6)
188+
dds1.setphase(t=t, value=0.7)
189189

190190
# Set some values for dds2 at t=1s. They will have value '0' before this
191191
# time unless otherwise set
192-
dds2.setamp(t + 1, 0.9)
193-
dds2.setfreq(t + 1, 1.0)
194-
dds2.setphase(t + 1, 1.1)
192+
dds2.setamp(t=t + 1, value=0.9)
193+
dds2.setfreq(t=t + 1, value=1.0)
194+
dds2.setphase(t=t + 1, value=1.1)
195195

196196
# dds5 is a "static" DDS. This means its value can only be set once, and
197197
# will be set just before the experiment begins
198-
dds5.setfreq(90 * MHz)
199-
dds5.setamp(1)
200-
dds5.setphase(0)
198+
dds5.setfreq(value=90 * MHz)
199+
dds5.setamp(value=1)
200+
dds5.setphase(value=0)
201201

202202
# Have the shutters start in the closed state (t=0)
203-
shutter1.close(t)
204-
shutter2.close(t)
203+
shutter1.close(t=t)
204+
shutter2.close(t=t)
205205

206206
# Analog0 is attached to ni_card_1, which is an NI-pci_6733 card (MAX name
207207
# ni_pcie_6733_0) clocked by a pineblaster
@@ -214,16 +214,16 @@
214214
# the device has actually started.
215215
# To do so, make sure no commands happen on this channel before analog0.t0
216216
# (this variable contains the delay time!)
217-
analog0.constant(analog0.t0, 2)
217+
analog0.constant(t=analog0.t0, value=2)
218218

219219
# Set this channel to a constant value
220220
# As this channel is clocked by the master pseudoclock, you can command
221221
# output from t=0
222-
analog2.constant(t, 3)
222+
analog2.constant(t=t, value=3)
223223

224224
# Again, this must not start until analog1.t0 or later!
225225
analog1.sine(
226-
analog1.t0,
226+
t=analog1.t0,
227227
duration=6,
228228
amplitude=5,
229229
angfreq=2 * np.pi,
@@ -236,13 +236,13 @@
236236
t += max(1, analog0.t0)
237237

238238
# Open the shutter, enable the DDS, ramp an analog output!
239-
shutter2.open(t)
240-
dds3.enable(t)
241-
analog0.ramp(t, duration=2, initial=2, final=3, samplerate=rate)
239+
shutter2.open(t=t)
240+
dds3.enable(t=t)
241+
analog0.ramp(t=t, duration=2, initial=2, final=3, samplerate=rate)
242242

243243
# Take a picture
244-
andor_ixon_0.expose('exposure_1', t, 'flat')
245-
andor_ixon_0.expose('exposure_1', t + 1, 'atoms')
244+
andor_ixon_0.expose(name='exposure_1', t=t, frametype='flat')
245+
andor_ixon_0.expose(name='exposure_1', t=t + 1, frametype='atoms')
246246

247247
# Do some more things at various times!
248248
# (these are ignoring the t variable)
@@ -267,7 +267,7 @@ def my_ramp(t, *args, **kwargs):
267267
# The timeout defaults to 5s, unless otherwise specified.
268268
# The timeout specifies how long to wait without seeing the external
269269
# trigger before continuing the experiment
270-
t += wait('my_first_wait', t=t, timeout=2)
270+
t += wait(label='my_first_wait', t=t, timeout=2)
271271

272272
# Waits take very little time as far as labscript is concerned. They only add on the
273273
# retirggering time needed to start devices up and get them all in sync again.
@@ -278,27 +278,27 @@ def my_ramp(t, *args, **kwargs):
278278

279279
t += 1
280280
# Do something 1s after the wait!
281-
switch.go_high(t)
281+
switch.go_high(t=t)
282282

283283
# Examples programming in different units as specified in the
284284
# unitconversion classes passed as parameters to the channel definition
285-
analog0.constant(t, value=5, units='A')
286-
analog1.constant(t, value=1000, units='mGauss')
287-
dds3.setfreq(t, value=50, units='detuned_MHz')
288-
dds3.setamp(t, value=1.9, units='W')
285+
analog0.constant(t=t, value=5, units='A')
286+
analog1.constant(t=t, value=1000, units='mGauss')
287+
dds3.setfreq(t=t, value=50, units='detuned_MHz')
288+
dds3.setamp(t=t, value=1.9, units='W')
289289

290290
# Hold values for 2 seconds
291291
t += 2
292292

293-
analog0.ramp(t, duration=1, initial=5, final=7, samplerate=rate, units='Gauss')
294-
analog1.constant(t, value=3e6, units='uA')
295-
dds3.setfreq(t, value=60, units='detuned_MHz')
296-
dds3.setamp(t, value=500, units='mW')
293+
analog0.ramp(t=t, duration=1, initial=5, final=7, samplerate=rate, units='Gauss')
294+
analog1.constant(t=t, value=3e6, units='uA')
295+
dds3.setfreq(t=t, value=60, units='detuned_MHz')
296+
dds3.setamp(t=t, value=500, units='mW')
297297

298298
# Hold values for 2 seconds
299299
t += 2
300300

301301
# Stop at t=15 seconds, note that because of the wait timeout, this might
302302
# be as late as 17s (Plus a little bit of retriggering time) in execution
303303
# time
304-
stop(t)
304+
stop(t=t)

0 commit comments

Comments
 (0)