Commit f1696ca8 authored by Martin Reinecke's avatar Martin Reinecke

cosmetics

parent ba58ae24
...@@ -69,7 +69,7 @@ class EnergyAdapter(ift.Energy): ...@@ -69,7 +69,7 @@ class EnergyAdapter(ift.Energy):
@property @property
def gradient(self): def gradient(self):
return self._res.jac.adjoint_times(ift.full(self._res.jac.target, 1.)) return self._res.gradient
@property @property
def metric(self): def metric(self):
...@@ -126,7 +126,7 @@ if __name__ == '__main__': ...@@ -126,7 +126,7 @@ if __name__ == '__main__':
A = pd(a) A = pd(a)
# Set up a sky model # Set up a sky model
sky = lambda inp: (HT(A*inp)).exp() sky = lambda inp: (HT(inp*A)).exp()
M = ift.DiagonalOperator(exposure) M = ift.DiagonalOperator(exposure)
GR = ift.GeometryRemover(position_space) GR = ift.GeometryRemover(position_space)
......
...@@ -30,8 +30,15 @@ class Linearization(object): ...@@ -30,8 +30,15 @@ class Linearization(object):
def jac(self): def jac(self):
return self._jac return self._jac
@property
def gradient(self):
"""Only available if target is a scalar"""
from .sugar import full
return self._jac.adjoint_times(full(self._jac.target, 1.))
@property @property
def metric(self): def metric(self):
"""Only available if target is a scalar"""
return self._metric return self._metric
def __neg__(self): def __neg__(self):
......
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