Commit 97790be1 authored by Philipp Arras's avatar Philipp Arras
Browse files

Add tests for imaginizer

parent 170fe8ec
......@@ -43,7 +43,8 @@ from .operators.outer_product_operator import OuterProduct
from .operators.simple_linear_operators import (
VdotOperator, ConjugationOperator, Realizer,
FieldAdapter, ducktape, GeometryRemover, NullOperator,
MatrixProductOperator, PartialExtractor, SwitchSpacesOperator)
MatrixProductOperator, PartialExtractor, SwitchSpacesOperator,
from .operators.value_inserter import ValueInserter
from .operators.energy_operators import (
EnergyOperator, GaussianEnergy, PoissonianEnergy, InverseGammaLikelihood,
......@@ -127,7 +127,9 @@ class Imaginizer(EndomorphicOperator):
def apply(self, x, mode):
self._check_input(x, mode)
return x.imag
if mode == self.TIMES:
return x.imag
return 1j*x
class FieldAdapter(LinearOperator):
......@@ -82,6 +82,13 @@ def testRealizer(sp):
@pmp('sp', _h_spaces + _p_spaces + _pow_spaces)
def testImaginizer(sp):
op = ift.Imaginizer(sp)
ift.extra.consistency_check(op, np.complex128, np.float64,
@pmp('sp', _h_spaces + _p_spaces + _pow_spaces)
def testConjugationOperator(sp):
op = ift.ConjugationOperator(sp)
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