Inline crandn function.

This commit is contained in:
François Orieux
2013-12-10 22:45:09 +01:00
parent d2e04fde2e
commit c942ad54c7
2 changed files with 3 additions and 12 deletions
-11
View File
@@ -332,17 +332,6 @@ def image_quad_norm(inarray):
return np.sum(np.sum(np.abs(inarray)**2, axis=-1), axis=-1)
def crandn(shape):
"""white complex gaussian noise
Generate directly the unitary Fourier transform of white gaussian
noise noise field (with given shape) of zero mean and variance
unity (ie N(0,1)).
"""
return np.sqrt(0.5) * (np.random.standard_normal(shape) +
1j * np.random.standard_normal(shape))
def ir2tf(imp_resp, shape, dim=None, real=True):
"""Compute the transfer function of IR
+3 -1
View File
@@ -266,7 +266,9 @@ def unsupervised_wiener(data, psf, reg=None, user_params=None):
# weighing (correlation in direct space)
precision = gn_chain[-1] * atf2 + gx_chain[-1] * areg2 # Eq. 29
excursion = uft.crandn(data.shape) / np.sqrt(precision)
excursion = np.sqrt(0.5) / np.sqrt(precision) * (
np.random.standard_normal(data.shape) +
1j * np.random.standard_normal(data.shape))
# mean Eq. 30 (RLS for fixed gn, gamma0 and gamma1 ...)
wiener_filter = gn_chain[-1] * np.conj(trans_fct) / precision