Commit 2924e62b authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cosmetics

parent 9a7e60bf
...@@ -91,4 +91,5 @@ if __name__ == '__main__': ...@@ -91,4 +91,5 @@ if __name__ == '__main__':
ift.plot(reconstruction, title='reconstruction') ift.plot(reconstruction, title='reconstruction')
ift.plot(GR.adjoint_times(data), title='data') ift.plot(GR.adjoint_times(data), title='data')
ift.plot(sky.at(mock_position).value, title='truth') ift.plot(sky.at(mock_position).value, title='truth')
ift.plot_finish(nx=3, xsize=16, ysize=5, title="results", name="bernoulli.png") ift.plot_finish(nx=3, xsize=16, ysize=5, title="results",
name="bernoulli.png")
...@@ -115,4 +115,5 @@ if __name__ == '__main__': ...@@ -115,4 +115,5 @@ if __name__ == '__main__':
powers = [A.at(s+position).value for s in samples] powers = [A.at(s+position).value for s in samples]
ift.plot([A.at(position).value, A.at(MOCK_POSITION).value]+powers, ift.plot([A.at(position).value, A.at(MOCK_POSITION).value]+powers,
title="power") title="power")
ift.plot_finish(nx=3, xsize=16, ysize=5, title="results", name="results.png") ift.plot_finish(nx=3, xsize=16, ysize=5, title="results",
name="results.png")
...@@ -18,7 +18,7 @@ def plot_test(): ...@@ -18,7 +18,7 @@ def plot_test():
field_gl = ift.Field.from_global_data(gl_space, np.random.randn(32640)) field_gl = ift.Field.from_global_data(gl_space, np.random.randn(32640))
field_ps = ift.power_analyze(fft.times(field_rg2)) field_ps = ift.power_analyze(fft.times(field_rg2))
## Start various plotting tests # Start various plotting tests
ift.plot(field_rg1_1, title='Single plot') ift.plot(field_rg1_1, title='Single plot')
ift.plot_finish() ift.plot_finish()
...@@ -36,5 +36,6 @@ def plot_test(): ...@@ -36,5 +36,6 @@ def plot_test():
ift.plot(field_rg2, title='2d rg') ift.plot(field_rg2, title='2d rg')
ift.plot_finish(nx=2, ny=3, title='Five plots') ift.plot_finish(nx=2, ny=3, title='Five plots')
if __name__ == '__main__': if __name__ == '__main__':
plot_test() plot_test()
...@@ -71,7 +71,7 @@ class DOFDistributor(LinearOperator): ...@@ -71,7 +71,7 @@ class DOFDistributor(LinearOperator):
raise ValueError("incorrect dofdex domain") raise ValueError("incorrect dofdex domain")
ldat = dofdex.local_data ldat = dofdex.local_data
if ldat.size==0: # can happen for weird configurations if ldat.size == 0: # can happen for weird configurations
nbin = 0 nbin = 0
else: else:
nbin = ldat.max() nbin = ldat.max()
......
...@@ -39,9 +39,9 @@ class Consistency_Tests(unittest.TestCase): ...@@ -39,9 +39,9 @@ class Consistency_Tests(unittest.TestCase):
[np.float64, np.complex128])) [np.float64, np.complex128]))
def testOperatorCombinations(self, sp, dtype): def testOperatorCombinations(self, sp, dtype):
a = ift.DiagonalOperator(ift.Field.from_random("normal", sp, a = ift.DiagonalOperator(ift.Field.from_random("normal", sp,
dtype=dtype)) dtype=dtype))
b = ift.DiagonalOperator(ift.Field.from_random("normal", sp, b = ift.DiagonalOperator(ift.Field.from_random("normal", sp,
dtype=dtype)) dtype=dtype))
op = ift.SandwichOperator.make(a, b) op = ift.SandwichOperator.make(a, b)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
op = a*b op = a*b
...@@ -66,7 +66,7 @@ class Consistency_Tests(unittest.TestCase): ...@@ -66,7 +66,7 @@ class Consistency_Tests(unittest.TestCase):
_h_spaces + _p_spaces + _pow_spaces, _h_spaces + _p_spaces + _pow_spaces,
[np.float64, np.complex128])) [np.float64, np.complex128]))
def testSelectionOperator(self, sp1, sp2, dtype): def testSelectionOperator(self, sp1, sp2, dtype):
mdom = ift.MultiDomain.make({'a':sp1, 'b':sp2}) mdom = ift.MultiDomain.make({'a': sp1, 'b': sp2})
op = ift.SelectionOperator(mdom, 'a') op = ift.SelectionOperator(mdom, 'a')
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
...@@ -86,20 +86,19 @@ class Consistency_Tests(unittest.TestCase): ...@@ -86,20 +86,19 @@ class Consistency_Tests(unittest.TestCase):
def testNullOperator(self, sp1, sp2, dtype): def testNullOperator(self, sp1, sp2, dtype):
op = ift.NullOperator(sp1, sp2) op = ift.NullOperator(sp1, sp2)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
mdom1 = ift.MultiDomain.make({'a':sp1}) mdom1 = ift.MultiDomain.make({'a': sp1})
mdom2 = ift.MultiDomain.make({'b':sp2}) mdom2 = ift.MultiDomain.make({'b': sp2})
op = ift.NullOperator(mdom1, mdom2) op = ift.NullOperator(mdom1, mdom2)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
op = ift.NullOperator(sp1, mdom2) op = ift.NullOperator(sp1, mdom2)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
op = ift.NullOperator(mdom1, sp2) op = ift.NullOperator(mdom1, sp2)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
@expand(product(_h_spaces + _p_spaces @expand(product(_h_spaces + _p_spaces + _pow_spaces,
+ _pow_spaces,
[np.float64, np.complex128])) [np.float64, np.complex128]))
def testMultiAdaptor(self, sp, dtype): def testMultiAdaptor(self, sp, dtype):
mdom = ift.MultiDomain.make({'a':sp}) mdom = ift.MultiDomain.make({'a': sp})
op = ift.MultiAdaptor(mdom) op = ift.MultiAdaptor(mdom)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
...@@ -109,19 +108,17 @@ class Consistency_Tests(unittest.TestCase): ...@@ -109,19 +108,17 @@ class Consistency_Tests(unittest.TestCase):
op = ift.HarmonicSmoothingOperator(sp, 0.1) op = ift.HarmonicSmoothingOperator(sp, 0.1)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
@expand(product(_h_spaces + _p_spaces @expand(product(_h_spaces + _p_spaces + _pow_spaces,
+ _pow_spaces,
[np.float64, np.complex128])) [np.float64, np.complex128]))
def testDOFDistributor(self, sp, dtype): def testDOFDistributor(self, sp, dtype):
#TODO: Test for DomainTuple # TODO: Test for DomainTuple
if sp.size < 4: if sp.size < 4:
return return
dofdex = np.arange(sp.size).reshape(sp.shape)%3 dofdex = np.arange(sp.size).reshape(sp.shape) % 3
dofdex = ift.Field.from_global_data(sp, dofdex) dofdex = ift.Field.from_global_data(sp, dofdex)
op = ift.DOFDistributor(dofdex) op = ift.DOFDistributor(dofdex)
ift.extra.consistency_check(op, dtype, dtype) ift.extra.consistency_check(op, dtype, dtype)
@expand(product(_h_spaces, [np.float64, np.complex128])) @expand(product(_h_spaces, [np.float64, np.complex128]))
def testPPO(self, sp, dtype): def testPPO(self, sp, dtype):
op = ift.PowerDistributor(target=sp) op = ift.PowerDistributor(target=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