Commit ad4c6cde authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'fixups_pa' into 'NIFTy_6'


See merge request ift/nifty!425
parents 50168dda 4bd62855
......@@ -19,7 +19,6 @@ import numpy as np
from scipy.stats import invgamma, norm
from scipy.interpolate import CubicSpline
from .. import Adder
from ..domain_tuple import DomainTuple
from import UnstructuredDomain
from ..field import Field
......@@ -76,7 +75,6 @@ class _InterpolationOperator(Operator):
self._deriv = self._interpolator.derivative()
self._inv_table_func = inv_table_func
def apply(self, x):
lin = isinstance(x, Linearization)
......@@ -143,28 +141,19 @@ class UniformOperator(Operator):
def __init__(self, domain, loc=0, scale=1):
self._target = self._domain = DomainTuple.make(domain)
self.loc = loc
self.scale = scale
self._loc = float(loc)
self._scale = float(scale)
def apply(self, x):
lin = isinstance(x, Linearization)
xval = x.val.val if lin else x.val
res = Field(self._target, norm._cdf(xval) * self.scale + self.loc)
res = Field(self._target, self._scale*norm._cdf(xval) + self._loc)
if not lin:
return res
jac = makeOp(Field(self._domain, norm._pdf(xval)*self.scale))
jac = makeOp(Field(self._domain, norm._pdf(xval)*self._scale))
return, jac)
def uni(field, loc=0, high=1):
foo = norm._cdf(field.val) * scale + loc
return Field(field.domain, foo)
def inverse_uni(field, low=0, scale=1):
res = norm._ppf(field.val/scale - loc)
def inverse(self, field):
res = norm._ppf(field.val/self._scale - self._loc)
return Field(field.domain, res)
Supports Markdown
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