-
|
I have a MultiHarp150, and I want to use TTL signals on the C1 and C2 control pins to start and stop the measurement. I’m running the following Python code: from snAPI.Main import *
import matplotlib
matplotlib.use('TkAgg',force=True)
from matplotlib import pyplot as plt
print("Switched to:",matplotlib.get_backend())
if(__name__ == "__main__"):
sn = snAPI()
sn.getDevice()
sn.initDevice(MeasMode.T2)
# a trigger signal on C1 starts and one on C2 stops the measurement
sn.device.setMeasControl(MeasControl.C1StartC2Stop.value)
sn.loadIniConfig("config\MH.ini")
# configure timetrace
sn.timeTrace.setNumBins(10000)
sn.timeTrace.setHistorySize(10)
# prepare measurement for triggered start and stop
sn.timeTrace.measure(waitFinished=False, savePTU=False) # waitFinished=False means that the measurement will not block the main thread, so we can plot in parallel
plt.figure(f'Figure: {sn.deviceConfig["Model"]}')
while True:
finished = sn.timeTrace.isFinished()
counts, times = sn.timeTrace.getData()
plt.clf()
plt.plot(times, counts[0], linewidth=2.0, label='sync')
for c in range(1, 1+sn.deviceConfig["NumChans"]):
plt.plot(times, counts[c], linewidth=2.0, label=f'chan{c}')
plt.xlabel('Time [s]')
plt.ylabel('Counts[Cts/s]')
plt.legend()
plt.title(f'TimeTrace Master {sn.deviceConfig["ID"]}')
plt.pause(0.1)
print('perform one loop')
if finished:
print("Measurement finished")
break
plt.show(block=True)However, from the terminal output (the printed messages), it seems like the measurement ends immediately without waiting for the trigger signal on C1. Why is this happening? Any ideas on how to make the measurement truly wait for a trigger on C1 to start and C2 to stop? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi, Thank you for your inquiry. In case you want a more personalised support please, go to https://www.picoquant.com/contact/support and contact our support team. Regards, |
Beta Was this translation helpful? Give feedback.

Thank you for your response! I've already resolved the issue. It turned out the problem was caused by using an outdated version of snAPI (v1.0.2). After updating to the latest version (v1.0.7), everything worked perfectly.