def photonsToFrame(photonposframe,imagesize,background):
pixels = imagesize
edges = range(0, pixels+1)
# HANDLE CASE FOR NO PHOTONS DETECTED AT ALL IN FRAME
if photonposframe.size == 0:
simframe = _np.zeros((pixels, pixels))
else:
xx = photonposframe[:, 0]
yy = photonposframe[:, 1]
simframe, xedges, yedges = _np.histogram2d(yy, xx, bins=(edges, edges))
simframe = _np.flipud(simframe) # to be consistent with render
#simframenoise = noisy(simframe,background,noise)
simframenoise = noisy_p(simframe, background)
simframenoise[simframenoise > 2**16-1] = 2**16-1
simframeout = _np.round(simframenoise).astype('<u2')
return simframeout
评论列表
文章目录