本文整理汇总了Python中Analysis.get_num_blocks方法的典型用法代码示例。如果您正苦于以下问题:Python Analysis.get_num_blocks方法的具体用法?Python Analysis.get_num_blocks怎么用?Python Analysis.get_num_blocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analysis
的用法示例。
在下文中一共展示了Analysis.get_num_blocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_total_SSRO_events
# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import get_num_blocks [as 别名]
def get_total_SSRO_events(pqf, RO_start, RO_length, marker_chan, chan_rnd_0, chan_rnd_1, sync_time_lim, VERBOSE = True):
"""
Returns SSRO data for all marked events.
Colums are:
Sync Nymber | number of photons | RND number indicator | RND number | Sync Time RND number | Sync Times photon 1-24 |
"""
_a = get_attributes(pqf)
# Gets the number of blocks in the data
num_blocks = Analysis.get_num_blocks(pqf)
if VERBOSE or (num_blocks > 1):
print 'The total number of blocks is:', num_blocks
# Initializes arrays to save the PQ-data
PQ_sync_number = np.empty((0,), dtype = np.uint32)
PQ_special = np.empty((0,), dtype = np.uint32)
PQ_sync_time = np.empty((0,), dtype = np.uint64)
PQ_time = np.empty((0,), dtype = np.uint64)
PQ_channel = np.empty((0,), dtype = np.uint32)
# Initializes an array to save the SSRO data
total_SSRO_events = np.empty((0,30), dtype = np.uint64)
# Loops over every block
for i in range(num_blocks):
# Get the SSRO events and PQ data for these sync numbers
gc.collect()
_events, _PQ_sync_number, _PQ_special, _PQ_sync_time, _PQ_time, _PQ_channel = \
get_SSRO_events(pqf, marker_chan, RO_start, RO_length, chan_rnd_0, chan_rnd_1, sync_time_lim = sync_time_lim, index = i+1, VERBOSE = VERBOSE)
# Concatenates all PQ data
PQ_sync_number = np.hstack((PQ_sync_number,_PQ_sync_number))
PQ_special = np.hstack((PQ_special, _PQ_special))
PQ_sync_time = np.hstack((PQ_sync_time, _PQ_sync_time))
PQ_time = np.hstack((PQ_time, _PQ_time))
PQ_channel = np.hstack((PQ_channel, _PQ_channel))
# Stacks all SSRO data
total_SSRO_events = np.vstack((total_SSRO_events, _events))
if VERBOSE>2:
print
print 'Found {} valid marked SSRO events in block'.format(int(len(_events))), i+1
print '===================================='
print
if VERBOSE:
print
print 'Found {} valid marked SSRO events in all blocks'.format(int(len(total_SSRO_events)))
print '===================================='
print
return total_SSRO_events, _a, PQ_sync_number, PQ_special, PQ_sync_time, PQ_time, PQ_channel
示例2: get_total_SSRO_events_quick
# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import get_num_blocks [as 别名]
def get_total_SSRO_events_quick(pqf, RO_start, RO_length, marker_chan, sync_time_lim, VERBOSE = True):
"""
Returns quick SSRO data for all marked events.
Sync Nymber | number of photons | Sync time first photon
"""
columns = "Sync_Number,Number of photons,Sync_Time_photon_1"
_a = {'Columns': columns}
# Gets the number of blocks for the data
num_blocks = Analysis.get_num_blocks(pqf)
if VERBOSE:
print 'The total number of blocks is:', num_blocks
# Initializes the array to save all SSRO events
total_SSRO_events = np.empty((0,3))
# Loop over all blocks
for i in range(num_blocks):
_events = get_SSRO_events_quick(pqf, marker_chan, RO_start, RO_length, sync_time_lim = sync_time_lim, index = i+1)
# Stacks all events for several blocks
total_SSRO_events = np.vstack((total_SSRO_events, _events))
if VERBOSE:
print
print 'Found {} valid marked SSRO events in block'.format(int(len(_events))), i+1
print '===================================='
print
if VERBOSE:
print
print 'Found {} valid marked SSRO events in all blocks'.format(int(len(total_SSRO_events)))
print '===================================='
print
return total_SSRO_events, _a