Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
bedabf78
Commit
bedabf78
authored
Jul 14, 2018
by
Martin Reinecke
Browse files
Merge branch 'NIFTy_5' into plottest
parents
df7b30c9
af1d849c
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
bedabf78
...
...
@@ -73,9 +73,6 @@ run_ipynb:
stage
:
demo_runs
script
:
-
jupyter nbconvert --execute --ExecutePreprocessor.timeout=None demos/Wiener_Filter.ipynb
artifacts
:
paths
:
-
'
*.png'
run_getting_started_1
:
stage
:
demo_runs
...
...
@@ -83,6 +80,9 @@ run_getting_started_1:
-
python 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
artifacts
:
paths
:
-
'
*.png'
run_getting_started_2
:
stage
:
demo_runs
...
...
@@ -90,12 +90,18 @@ run_getting_started_2:
-
python 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
artifacts
:
paths
:
-
'
*.png'
run_getting_started_3
:
stage
:
demo_runs
script
:
-
python demos/getting_started_3.py
-
python3 demos/getting_started_3.py
artifacts
:
paths
:
-
'
*.png'
run_bernoulli
:
stage
:
demo_runs
...
...
demos/getting_started_2.py
View file @
bedabf78
...
...
@@ -103,4 +103,4 @@ if __name__ == '__main__':
# Plot results
result_sky
=
sky
.
at
(
H
.
position
).
value
# PLOTTING
#
FIXME
PLOTTING
nifty5/library/correlated_fields.py
View file @
bedabf78
...
...
@@ -44,13 +44,10 @@ def make_correlated_field(s_space, amplitude_model):
ht
=
HartleyOperator
(
h_space
,
s_space
)
p_space
=
amplitude_model
.
value
.
domain
[
0
]
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'
]
A
=
power_distributor
(
amplitude_model
)
correlated_field_h
=
A
*
xi
correlated_field
=
ht
(
correlated_field_h
)
...
...
@@ -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
=
pd_spatial
*
pd_energy
dom_distr_0
=
DomainDistributor
(
pd
.
domain
,
0
)
dom_distr_1
=
DomainDistributor
(
pd
.
domain
,
1
)
a_spatial
=
dom_distr_1
(
amplitude_model_spatial
)
a_energy
=
dom_distr_0
(
amplitude_model_energy
)
dom_distr_spatial
=
DomainDistributor
(
pd
.
domain
,
0
)
dom_distr_energy
=
DomainDistributor
(
pd
.
domain
,
1
)
a_spatial
=
dom_distr_spatial
(
amplitude_model_spatial
)
a_energy
=
dom_distr_energy
(
amplitude_model_energy
)
a
=
a_spatial
*
a_energy
A
=
pd
(
a
)
...
...
nifty5/library/gaussian_energy.py
View file @
bedabf78
...
...
@@ -61,7 +61,7 @@ class GaussianEnergy(Energy):
@
property
@
memo
def
gradient
(
self
):
return
self
.
_inp
.
jacobian
.
adjoint_times
(
self
.
_icovres
)
return
self
.
_inp
.
jacobian
.
adjoint_times
(
self
.
_icovres
)
.
real
@
property
@
memo
...
...
nifty5/minimization/energy_sum.py
View file @
bedabf78
...
...
@@ -37,9 +37,11 @@ class EnergySum(Energy):
eout
=
[]
fout
=
[]
EnergySum
.
_unpackEnergies
(
energies
,
factors
,
1.
,
eout
,
fout
)
for
e
in
eout
[
1
:]:
if
not
e
.
position
.
isEquivalentTo
(
eout
[
0
].
position
):
raise
ValueError
(
"position mismatch"
)
# FIXME we need to reach an agreement about how we want to deal
# with domain and field compatibility. Until then, we relax te check.
# for e in eout[1:]:
# if not e.position.isEquivalentTo(eout[0].position):
# raise ValueError("position mismatch")
return
EnergySum
(
eout
[
0
].
position
,
eout
,
fout
)
@
staticmethod
...
...
test/test_energies/test_energy_sum.py
View file @
bedabf78
...
...
@@ -53,5 +53,5 @@ class EnergySum_Tests(unittest.TestCase):
E1
+
2
with
assert_raises
(
TypeError
):
E1
-
"hello"
with
assert_raises
(
ValueError
):
E1
+
E2
.
at
(
2
*
pos
)
#
with assert_raises(ValueError):
#
E1+E2.at(2*pos)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment