From e77b5d0836a0b62e15c498ab55822bd7fc25a78a Mon Sep 17 00:00:00 2001 From: Lukas Platz <lukas@lplatz.de> Date: Fri, 1 Mar 2019 14:46:41 +0100 Subject: [PATCH] polishing a bit (docstrings, refactoring) --- nifty5/library/smooth_linear_amplitude.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nifty5/library/smooth_linear_amplitude.py b/nifty5/library/smooth_linear_amplitude.py index 34b6ca548..5f19efb45 100644 --- a/nifty5/library/smooth_linear_amplitude.py +++ b/nifty5/library/smooth_linear_amplitude.py @@ -169,10 +169,11 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za=None, zq=None, iv : float Prior standard deviation of y-intercept of power law. za : float, optional - The alpha-parameter of the inverse-gamma distribution. - Setting the a seperate prior on the zeroGmode of the amplitude model. + Parameter of the optional zero mode prior (inverse-gamma): alpha + See :class:`InverseGammaOperator` for interpretation. zq : float, optional - The q-parameter of the inverse-gamma distribution. + Parameter of the optional zero mode prior (inverse-gamma): q + See :class:`InverseGammaOperator` for interpretation. Returns ------- @@ -192,6 +193,7 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za=None, zq=None, if za != None and zq != None: separate_zero_mode_prior = True za, zq = float(za), float(zq) + print(keys[2] + " mean: ", (zq/(1+za))) else: separate_zero_mode_prior = False if za != None or zq != None: @@ -220,14 +222,13 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za=None, zq=None, return et @ loglog_ampl.exp() else: zero_mode = ValueInserter(et.target, (0,)*len(et.target.shape)) + zero_mode = zero_mode @ InverseGammaOperator( + zero_mode.domain, za, zq) @ FieldAdapter( + zero_mode.domain, keys[2]) mask = np.ones(et.target.shape) mask[(0,)*len(et.target.shape)] = 0. mask = from_global_data(et.target, mask) mask = DiagonalOperator(mask) - zero_mode = zero_mode @ InverseGammaOperator( - zero_mode.domain, za, zq) @ FieldAdapter( - zero_mode.domain, keys[2]) - print(keys[2] + " mean: ", (zq/(1+za))) - return mask @ (et @ loglog_ampl.exp()) + zero_mode + return mask @ et @ loglog_ampl.exp() + zero_mode -- GitLab