1+ from snAPI .Main import *
2+
3+ if (__name__ == "__main__" ):
4+
5+ start = 0
6+ length = 10
7+
8+ sn = snAPI ()
9+ sn .getDevice ()
10+
11+ # offline processing:
12+ # sn.getFileDevice(r"E:\Data\PicoQuant\G2_T3_sameTTs.ptu")
13+ sn .initDevice (MeasMode .T2 )
14+
15+ # set the trigger level
16+ sn .loadIniConfig ("config\MH.ini" )
17+
18+ #list of channels to build the coincidence from
19+ chans = [1 ,2 ]
20+ ciIndex = sn .manipulators .coincidence (chans , 1000 , mode = CoincidenceMode .CountOnce ,
21+ time = CoincidenceTime .Last ,
22+ keepChannels = True ) #set keepChannels to false to get the coincidences only
23+ # ciIndex is the 'channel number' where the coincidences are stored
24+ sn .logPrint (f"coincidence index: { ciIndex } " )
25+
26+ # block measurement for continuous (acqTime = 0 is until stop) measurement
27+ sn .unfold .startBlock (acqTime = 1000 , size = 1024 * 1024 * 1024 , savePTU = False )
28+
29+ while (True ):
30+ times , channels = sn .unfold .getBlock ()
31+
32+ if (len (times ) > 9 ):
33+ sn .logPrint ("new data block:" )
34+ sn .logPrint (" channel | time tag" )
35+ sn .logPrint ("--------------------" )
36+
37+ # only print the first 10 time tags per block out
38+ # for performance reasons
39+ # but it here should all data be stored to disc
40+ for i in range (10 ):
41+ sn .logPrint (f"{ channels [i ]:9} | { times [i ]:8} " )
42+
43+
44+ # filter the time tags of coincidences
45+ ciTimes = sn .unfold .getTimesByChannel (ciIndex )
46+ sn .logPrint ("new coincidence block:" )
47+ sn .logPrint ("time tag" )
48+ sn .logPrint ("--------" )
49+ if len (ciTimes ) > 9 :
50+ for i in range (10 ):
51+ sn .logPrint (f"{ ciTimes [i ]:8} " )
52+
53+
54+ if sn .unfold .finished .contents :
55+ break
56+
57+ # if otherBreakCondition:
58+ sn .unfold .stopMeasure
59+
60+ sn .logPrint ("end" )
0 commit comments