diff --git a/Python/control.py b/Python/control.py index bc1e3b9e6b01b87862983f78af074d4a0d4bb739..c5d2675b530f81eda601c89956ca620815b2ff16 100644 --- a/Python/control.py +++ b/Python/control.py @@ -16,7 +16,6 @@ def trigger(): global awg # step = get_step() awg.force_trigger() - # step = int32(0) print("triggering...") # print("current step:", step) @@ -54,9 +53,10 @@ def load(fpath): data = np.load(fpath, allow_pickle=True) sig = data['signal'] step = get_step() - segment = (step + 1) % 2 + segment = 1 awg.write_segment(sig, segment) - print(f"currently playing step {step}, loaded data onto step {segment}") + print(f"currently step {step}, loaded step {segment}") + data.close() # argument parsing, more functionalities to be added later... @@ -87,10 +87,15 @@ sig0 = data0['signal'] data1 = np.load("data/wfm_5.npz", allow_pickle=True) sig1 = data1["signal"] -# empty = np.zeros(static_sig.shape) +# empty = np.zeros(512) # AWG stuff + +# condition for awg step sequence. +# 0 for infinite loop until trigger +# 1 for finite loop, then goto nextstep afterwards. +condition = [SPCSEQ_ENDLOOPONTRIG, SPCSEQ_ENDLOOPALWAYS] awg = AWG() awg.open(id=awg_id) # change this to b'/dev/spcm0' for top AWG awg.set_sampling_rate(sampling_rate) @@ -99,8 +104,10 @@ awg.set_trigger(EXT0=SPC_TM_POS) awg.set_sequence_mode(2) # partition AWG memory into 2 segments awg.write_segment(sig0, segment=0) awg.write_segment(sig1, segment=1) -awg.configure_step(step=0, segment=0, nextstep=1, loop=1, condition=SPCSEQ_ENDLOOPONTRIG) -awg.configure_step(step=1, segment=1, nextstep=0, loop=1, condition=SPCSEQ_ENDLOOPONTRIG) +# awg.write_segment(empty, segment=1) +awg.configure_step(step=0, segment=0, nextstep=1, loop=1, condition=condition[0]) +awg.configure_step(step=1, segment=1, nextstep=0, loop=1, condition=contition[0]) +# awg.configure_step(step=1, segment=1, nextstep=0, loop=1, condition=SPCSEQ_ENDLOOPONTRIG) start() # console