本文整理汇总了Python中detector.Detector.filter方法的典型用法代码示例。如果您正苦于以下问题:Python Detector.filter方法的具体用法?Python Detector.filter怎么用?Python Detector.filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类detector.Detector
的用法示例。
在下文中一共展示了Detector.filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simulate_basic_with_pods
# 需要导入模块: from detector import Detector [as 别名]
# 或者: from detector.Detector import filter [as 别名]
def simulate_basic_with_pods(ptypy_pars_tree=None,sim_pars=None,save=False):
"""
Basic Simulation
"""
p = DEFAULT.copy()
ppt = ptypy_pars_tree
if ppt is not None:
p.update(ppt.get('simulation'))
if sim_pars is not None:
p.update(sim_pars)
P = ptypy.core.Ptycho(ppt,level=1)
# make a data source that has is basicaly empty
P.datasource = make_sim_datasource(P.modelm,p.pos_drift,p.pos_scale,p.pos_noise)
P.modelm.new_data()
u.parallel.barrier()
P.print_stats()
# Propagate and apply psf for simulationg partial coherence (if not done so with modes)
for name,pod in P.pods.iteritems():
if not pod.active: continue
pod.diff += conv(u.abs2(pod.fw(pod.exit)),p.psf)
# Filter storage data similar to a detector.
if p.detector is not None:
Det = Detector(p.detector)
save_dtype = Det.dtype
for ID,Sdiff in P.diff.S.items():
# get the mask storage too although their content will be overriden
Smask = P.mask.S[ID]
dat, mask = Det.filter(Sdiff.data)
if p.frame_size is not None:
hplanes = u.expect2(p.frame_size)-u.expect2(dat.shape[-2:])
dat = u.crop_pad(dat,hplanes,axes=[-2,-1]).astype(dat.dtype)
mask = u.crop_pad(mask,hplanes,axes=[-2,-1]).astype(mask.dtype)
Sdiff.fill(dat)
Smask.fill(mask)
else:
save_dtype = None
if save:
P.modelm.collect_diff_mask_meta(save=save,dtype=save_dtype)
u.parallel.barrier()
return P