Commit 3749b04a authored by Martin Reinecke's avatar Martin Reinecke

misc improvements

parent c15669d0
NIFTy - Numerical Information Field Theory NIFTy - Numerical Information Field Theory
========================================== ==========================================
[![build status](https://gitlab.mpcdf.mpg.de/ift/NIFTy/badges/NIFTy_5/build.svg)](https://gitlab.mpcdf.mpg.de/ift/NIFTy/commits/NIFTy_5) [![build status](https://gitlab.mpcdf.mpg.de/ift/nifty-dev/badges/NIFTy_5/build.svg)](https://gitlab.mpcdf.mpg.de/ift/nifty-dev/commits/NIFTy_5)
[![coverage report](https://gitlab.mpcdf.mpg.de/ift/NIFTy/badges/NIFTy_5/coverage.svg)](https://gitlab.mpcdf.mpg.de/ift/NIFTy/commits/NIFTy_5) [![coverage report](https://gitlab.mpcdf.mpg.de/ift/nifty-dev/badges/NIFTy_5/coverage.svg)](https://gitlab.mpcdf.mpg.de/ift/nifty-dev/commits/NIFTy_5)
**NIFTy** project homepage: **NIFTy** project homepage:
[http://ift.pages.mpcdf.de/NIFTy](http://ift.pages.mpcdf.de/NIFTy) [http://ift.pages.mpcdf.de/NIFTy](http://ift.pages.mpcdf.de/NIFTy)
......
...@@ -21,7 +21,7 @@ from .nonlinearities import Exponential, Linear, PositiveTanh, Tanh ...@@ -21,7 +21,7 @@ from .nonlinearities import Exponential, Linear, PositiveTanh, Tanh
from .models.constant import Constant from .models.constant import Constant
from .models.linear_model import LinearModel from .models.linear_model import LinearModel
from .models.local_nonlinearity import (LocalModel, PointwiseExponential, from .models.local_nonlinearity import (LocalModel, PointwiseExponential,
PointwisePositiveTanh, PointwiseTanh) PointwisePositiveTanh, PointwiseTanh)
from .models.model import Model from .models.model import Model
from .models.multi_model import MultiModel from .models.multi_model import MultiModel
from .models.variable import Variable from .models.variable import Variable
...@@ -65,7 +65,8 @@ from .minimization.steepest_descent import SteepestDescent ...@@ -65,7 +65,8 @@ from .minimization.steepest_descent import SteepestDescent
from .minimization.vl_bfgs import VL_BFGS from .minimization.vl_bfgs import VL_BFGS
from .minimization.l_bfgs import L_BFGS from .minimization.l_bfgs import L_BFGS
from .minimization.relaxed_newton import RelaxedNewton from .minimization.relaxed_newton import RelaxedNewton
from .minimization.scipy_minimizer import ScipyMinimizer, NewtonCG, L_BFGS_B, ScipyCG from .minimization.scipy_minimizer import (ScipyMinimizer, NewtonCG, L_BFGS_B,
ScipyCG)
from .minimization.energy import Energy from .minimization.energy import Energy
from .minimization.quadratic_energy import QuadraticEnergy from .minimization.quadratic_energy import QuadraticEnergy
from .minimization.line_energy import LineEnergy from .minimization.line_energy import LineEnergy
...@@ -82,7 +83,8 @@ from .library.point_sources import PointSources ...@@ -82,7 +83,8 @@ from .library.point_sources import PointSources
from .library.poissonian_energy import PoissonianEnergy from .library.poissonian_energy import PoissonianEnergy
from .library.wiener_filter_curvature import WienerFilterCurvature from .library.wiener_filter_curvature import WienerFilterCurvature
from .library.wiener_filter_energy import WienerFilterEnergy from .library.wiener_filter_energy import WienerFilterEnergy
from .library.correlated_fields import make_correlated_field, make_mf_correlated_field from .library.correlated_fields import (make_correlated_field,
make_mf_correlated_field)
from . import extra from . import extra
......
...@@ -34,5 +34,5 @@ class SampledKullbachLeiblerDivergence(Energy): ...@@ -34,5 +34,5 @@ class SampledKullbachLeiblerDivergence(Energy):
@property @property
@memo @memo
def curvature(self): def curvature(self):
return (my_sum(map(lambda v: v.curvature, self._energy_list)) * return (my_sum(map(lambda v: v.curvature, self._energy_list)) *
(1./len(self._energy_list))) (1./len(self._energy_list)))
...@@ -47,7 +47,8 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy, ...@@ -47,7 +47,8 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy,
from ..models.variable import Variable from ..models.variable import Variable
from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple
from ..operators.domain_distributor import DomainDistributor from ..operators.domain_distributor import DomainDistributor
from ..operators.harmonic_transform_operator import HarmonicTransformOperator from ..operators.harmonic_transform_operator \
import HarmonicTransformOperator
h_space_spatial = s_space_spatial.get_default_codomain() h_space_spatial = s_space_spatial.get_default_codomain()
h_space_energy = s_space_energy.get_default_codomain() h_space_energy = s_space_energy.get_default_codomain()
h_space = DomainTuple.make((h_space_spatial, h_space_energy)) h_space = DomainTuple.make((h_space_spatial, h_space_energy))
......
...@@ -51,7 +51,8 @@ class PointSources(Model): ...@@ -51,7 +51,8 @@ class PointSources(Model):
@staticmethod @staticmethod
def IG_prime(field, alpha, q): def IG_prime(field, alpha, q):
inner = norm.pdf(field.local_data) inner = norm.pdf(field.local_data)
outer = invgamma.pdf(invgamma.ppf(norm.cdf(field.local_data), alpha, scale=q), alpha, scale=q) outer = invgamma.pdf(invgamma.ppf(norm.cdf(field.local_data), alpha,
scale=q), alpha, scale=q)
# # FIXME # # FIXME
# outer = np.clip(outer, 1e-20, None) # outer = np.clip(outer, 1e-20, None)
outer = 1/outer outer = 1/outer
......
...@@ -94,9 +94,8 @@ class ChainOperator(LinearOperator): ...@@ -94,9 +94,8 @@ class ChainOperator(LinearOperator):
@staticmethod @staticmethod
def make(ops): def make(ops):
"""Build a ChainOperator (or something simpler if possible), """Build a ChainOperator (or something simpler if possible),
a sequence of concatenated LinearOperators. a sequence of concatenated LinearOperators.
Parameters Parameters
---------- ----------
......
...@@ -277,7 +277,8 @@ class LinearOperator(NiftyMetaBase()): ...@@ -277,7 +277,8 @@ class LinearOperator(NiftyMetaBase()):
if not self._validMode[mode]: if not self._validMode[mode]:
raise NotImplementedError("invalid operator mode specified") raise NotImplementedError("invalid operator mode specified")
if mode & self.capability == 0: if mode & self.capability == 0:
raise NotImplementedError("requested operator mode is not supported") raise NotImplementedError(
"requested operator mode is not supported")
def _check_input(self, x, mode): def _check_input(self, x, mode):
self._check_mode(mode) self._check_mode(mode)
......
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