def filterNormalization(self, block_size=64, all_at_once = False): """ Normalize signal intensity. @block_size (integer) A block size determining the divided volume size. This argument is passed to the block_separator function. @all_at_once (bool) A flag determining all-at-onec processing. This argument is passed to the block_separator function. """ print("Intensity normalization") if self.peak_air == None: raise Exception('Call the calculateNormalizationParam in ahead.') maxid = [self.peak_air, self.peak_soil] maxid = [i-self.hist_x[0] for i in maxid] plt.figure() plt.plot(self.hist_x, self.hist_y) plt.plot(self.hist_x[maxid], self.hist_y[maxid],'ro') plt.xlabel('intensity') plt.ylabel('count') plt.pause(.01) i_block = self.block_separator(overlapping = 1, block_size = block_size, all_at_once = all_at_once) for blocks, indexes in i_block: blocks = tqdm_multiprocessing(functools.partial(normalizeIntensity, peak_air=self.peak_air, peak_soil=self.peak_soil), blocks) self.updateStack(blocks, indexes, overlapping = 1, block_size = block_size) return请完整详细解释每一行的代码意思
时间: 2023-06-02 09:05:09 浏览: 112
def filterNormalization(self, block_size=64, all_at_once=False):
"""
Normalize signal intensity.
@block_size (integer): A block size determining the divided volume size.
This argument is passed to the block_separator function.
@all_at_once (bool): A flag determining all-at-once processing.
This argument is passed to the block_separator function.
"""
# 打印字符串
print("Intensity normalization")
# 如果没有设置峰值,抛出异常
if self.peak_air == None:
raise Exception('Call the calculateNormalizationParam in ahead.')
# 设置峰值
maxid = [self.peak_air, self.peak_soil]
maxid = [i-self.hist_x[0] for i in maxid]
# 绘图
plt.figure()
plt.plot(self.hist_x, self.hist_y)
plt.plot(self.hist_x[maxid], self.hist_y[maxid],'ro')
plt.xlabel('intensity')
plt.ylabel('count')
plt.pause(.01)
# 将数据分块处理
i_block = self.block_separator(overlapping=1, block_size=block_size, all_at_once=all_at_once)
# 对分块数据进行处理
for blocks, indexes in i_block:
# 对分块数据进行处理
blocks = tqdm_multiprocessing(functools.partial(normalizeIntensity, peak_air=self.peak_air, peak_soil=self.peak_soil), blocks)
# 更新数据
self.updateStack(blocks, indexes, overlapping=1, block_size=block_size)
# 返回结果
return
阅读全文