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

Merge branch 'NIFTy_5' into plottest

parents df7b30c9 af1d849c
...@@ -73,9 +73,6 @@ run_ipynb: ...@@ -73,9 +73,6 @@ run_ipynb:
stage: demo_runs stage: demo_runs
script: script:
- jupyter nbconvert --execute --ExecutePreprocessor.timeout=None demos/Wiener_Filter.ipynb - jupyter nbconvert --execute --ExecutePreprocessor.timeout=None demos/Wiener_Filter.ipynb
artifacts:
paths:
- '*.png'
run_getting_started_1: run_getting_started_1:
stage: demo_runs stage: demo_runs
...@@ -83,6 +80,9 @@ run_getting_started_1: ...@@ -83,6 +80,9 @@ run_getting_started_1:
- python demos/getting_started_1.py - python demos/getting_started_1.py
- python3 demos/getting_started_1.py - python3 demos/getting_started_1.py
- mpiexec -n 2 --bind-to none python3 demos/getting_started_1.py 2> /dev/null - mpiexec -n 2 --bind-to none python3 demos/getting_started_1.py 2> /dev/null
artifacts:
paths:
- '*.png'
run_getting_started_2: run_getting_started_2:
stage: demo_runs stage: demo_runs
...@@ -90,12 +90,18 @@ run_getting_started_2: ...@@ -90,12 +90,18 @@ run_getting_started_2:
- python demos/getting_started_2.py - python demos/getting_started_2.py
- python3 demos/getting_started_2.py - python3 demos/getting_started_2.py
- mpiexec -n 2 --bind-to none python3 demos/getting_started_2.py 2> /dev/null - mpiexec -n 2 --bind-to none python3 demos/getting_started_2.py 2> /dev/null
artifacts:
paths:
- '*.png'
run_getting_started_3: run_getting_started_3:
stage: demo_runs stage: demo_runs
script: script:
- python demos/getting_started_3.py - python demos/getting_started_3.py
- python3 demos/getting_started_3.py - python3 demos/getting_started_3.py
artifacts:
paths:
- '*.png'
run_bernoulli: run_bernoulli:
stage: demo_runs stage: demo_runs
......
...@@ -103,4 +103,4 @@ if __name__ == '__main__': ...@@ -103,4 +103,4 @@ if __name__ == '__main__':
# Plot results # Plot results
result_sky = sky.at(H.position).value result_sky = sky.at(H.position).value
# PLOTTING # FIXME PLOTTING
...@@ -44,13 +44,10 @@ def make_correlated_field(s_space, amplitude_model): ...@@ -44,13 +44,10 @@ def make_correlated_field(s_space, amplitude_model):
ht = HartleyOperator(h_space, s_space) ht = HartleyOperator(h_space, s_space)
p_space = amplitude_model.value.domain[0] p_space = amplitude_model.value.domain[0]
power_distributor = PowerDistributor(h_space, p_space) power_distributor = PowerDistributor(h_space, p_space)
# FIXME Remove tau and phi stuff from here. Should not be necessary
position = MultiField.from_dict({
'xi': Field.from_random('normal', h_space),
'tau': amplitude_model.position['tau'],
'phi': amplitude_model.position['phi']})
position = MultiField.from_dict({'xi': Field.full(h_space, 0.)})
xi = Variable(position)['xi'] xi = Variable(position)['xi']
A = power_distributor(amplitude_model) A = power_distributor(amplitude_model)
correlated_field_h = A * xi correlated_field_h = A * xi
correlated_field = ht(correlated_field_h) correlated_field = ht(correlated_field_h)
...@@ -79,10 +76,11 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy, ...@@ -79,10 +76,11 @@ def make_mf_correlated_field(s_space_spatial, s_space_energy,
pd_energy = PowerDistributor(pd_spatial.domain, p_space_energy, 1) pd_energy = PowerDistributor(pd_spatial.domain, p_space_energy, 1)
pd = pd_spatial*pd_energy pd = pd_spatial*pd_energy
dom_distr_0 = DomainDistributor(pd.domain, 0) dom_distr_spatial = DomainDistributor(pd.domain, 0)
dom_distr_1 = DomainDistributor(pd.domain, 1) dom_distr_energy = DomainDistributor(pd.domain, 1)
a_spatial = dom_distr_1(amplitude_model_spatial)
a_energy = dom_distr_0(amplitude_model_energy) a_spatial = dom_distr_spatial(amplitude_model_spatial)
a_energy = dom_distr_energy(amplitude_model_energy)
a = a_spatial*a_energy a = a_spatial*a_energy
A = pd(a) A = pd(a)
......
...@@ -61,7 +61,7 @@ class GaussianEnergy(Energy): ...@@ -61,7 +61,7 @@ class GaussianEnergy(Energy):
@property @property
@memo @memo
def gradient(self): def gradient(self):
return self._inp.jacobian.adjoint_times(self._icovres) return self._inp.jacobian.adjoint_times(self._icovres).real
@property @property
@memo @memo
......
...@@ -37,9 +37,11 @@ class EnergySum(Energy): ...@@ -37,9 +37,11 @@ class EnergySum(Energy):
eout = [] eout = []
fout = [] fout = []
EnergySum._unpackEnergies(energies, factors, 1., eout, fout) EnergySum._unpackEnergies(energies, factors, 1., eout, fout)
for e in eout[1:]: # FIXME we need to reach an agreement about how we want to deal
if not e.position.isEquivalentTo(eout[0].position): # with domain and field compatibility. Until then, we relax te check.
raise ValueError("position mismatch") # for e in eout[1:]:
# if not e.position.isEquivalentTo(eout[0].position):
# raise ValueError("position mismatch")
return EnergySum(eout[0].position, eout, fout) return EnergySum(eout[0].position, eout, fout)
@staticmethod @staticmethod
......
...@@ -53,5 +53,5 @@ class EnergySum_Tests(unittest.TestCase): ...@@ -53,5 +53,5 @@ class EnergySum_Tests(unittest.TestCase):
E1+2 E1+2
with assert_raises(TypeError): with assert_raises(TypeError):
E1-"hello" E1-"hello"
with assert_raises(ValueError): # with assert_raises(ValueError):
E1+E2.at(2*pos) # E1+E2.at(2*pos)
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