Commit a976d920 authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'linear-amplitude-model' into 'NIFTy_5'

Linear amplitude model

See merge request !309
parents eac959bd 883dc5bf
Pipeline #46554 passed with stages
in 18 minutes and 31 seconds
...@@ -74,7 +74,8 @@ from .minimization.metric_gaussian_kl import MetricGaussianKL ...@@ -74,7 +74,8 @@ from .minimization.metric_gaussian_kl import MetricGaussianKL
from .sugar import * from .sugar import *
from .plot import Plot from .plot import Plot
from .library.smooth_linear_amplitude import SLAmplitude, CepstrumOperator from .library.smooth_linear_amplitude import (
SLAmplitude, LinearSLAmplitude, CepstrumOperator)
from .library.inverse_gamma_operator import InverseGammaOperator from .library.inverse_gamma_operator import InverseGammaOperator
from .library.los_response import LOSResponse from .library.los_response import LOSResponse
from .library.dynamic_operator import (dynamic_operator, from .library.dynamic_operator import (dynamic_operator,
......
...@@ -169,6 +169,18 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, keys=['tau', 'phi']): ...@@ -169,6 +169,18 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, keys=['tau', 'phi']):
which returns on its target a power spectrum which consists out of a which returns on its target a power spectrum which consists out of a
smooth and a linear part. smooth and a linear part.
''' '''
return LinearSLAmplitude(target=target, n_pix=n_pix, a=a, k0=k0, sm=sm,
sv=sv, im=im, iv=iv, keys=keys).exp()
def LinearSLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv,
keys=['tau', 'phi']):
'''LinearOperator for parametrizing smooth log-amplitudes (square roots of
power spectra).
Logarithm of SLAmplitude
See documentation of SLAmplitude for more details
'''
if not (isinstance(n_pix, int) and isinstance(target, PowerSpace)): if not (isinstance(n_pix, int) and isinstance(target, PowerSpace)):
raise TypeError raise TypeError
...@@ -196,4 +208,4 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, keys=['tau', 'phi']): ...@@ -196,4 +208,4 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, keys=['tau', 'phi']):
loglog_ampl = 0.5*(smooth + linear) loglog_ampl = 0.5*(smooth + linear)
# Go from loglog-space to linear-linear-space # Go from loglog-space to linear-linear-space
return et @ loglog_ampl.exp() return et @ loglog_ampl
...@@ -20,6 +20,7 @@ import numpy as np ...@@ -20,6 +20,7 @@ import numpy as np
from .. import utilities from .. import utilities
from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple
from ..field import Field from ..field import Field
from ..multi_field import MultiField
from ..linearization import Linearization from ..linearization import Linearization
from ..sugar import makeDomain, makeOp from ..sugar import makeDomain, makeOp
from .linear_operator import LinearOperator from .linear_operator import LinearOperator
...@@ -121,7 +122,7 @@ class GaussianEnergy(EnergyOperator): ...@@ -121,7 +122,7 @@ class GaussianEnergy(EnergyOperator):
""" """
def __init__(self, mean=None, covariance=None, domain=None): def __init__(self, mean=None, covariance=None, domain=None):
if mean is not None and not isinstance(mean, Field): if mean is not None and not isinstance(mean, (Field, MultiField)):
raise TypeError raise TypeError
if covariance is not None and not isinstance(covariance, if covariance is not None and not isinstance(covariance,
LinearOperator): LinearOperator):
...@@ -307,7 +308,6 @@ class StandardHamiltonian(EnergyOperator): ...@@ -307,7 +308,6 @@ class StandardHamiltonian(EnergyOperator):
Tells an internal :class:`SamplingEnabler` which convergence criterion Tells an internal :class:`SamplingEnabler` which convergence criterion
to use to draw Gaussian samples. to use to draw Gaussian samples.
See also See also
-------- --------
`Encoding prior knowledge in the structure of the likelihood`, `Encoding prior knowledge in the structure of the likelihood`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment