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
eeea9171
Commit
eeea9171
authored
Sep 10, 2018
by
Martin Reinecke
Browse files
Merge branch 'NIFTy_5' of gitlab.mpcdf.mpg.de:ift/nifty-dev into NIFTy_5
parents
694d61dc
1c1b9ebc
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/multi_field.py
View file @
eeea9171
...
...
@@ -66,11 +66,6 @@ class MultiField(object):
def
to_dict
(
self
):
return
{
key
:
val
for
key
,
val
in
zip
(
self
.
_domain
.
keys
(),
self
.
_val
)}
def
update
(
self
,
other
):
foo
=
self
.
to_dict
()
foo
.
update
(
other
.
to_dict
())
return
MultiField
.
from_dict
(
foo
)
def
__getitem__
(
self
,
key
):
return
self
.
_val
[
self
.
_domain
.
idx
[
key
]]
...
...
test/test_multi_field.py
View file @
eeea9171
...
...
@@ -56,19 +56,3 @@ class Test_Functionality(unittest.TestCase):
f1
=
op2
(
ift
.
full
(
dom
,
1
))
for
val
in
f1
.
values
():
assert_equal
((
val
==
40
).
all
(),
True
)
def
test_update
(
self
):
dom
=
ift
.
RGSpace
(
10
)
f1
=
ift
.
from_random
(
'normal'
,
domain
=
dom
)
f2
=
ift
.
from_random
(
'normal'
,
domain
=
dom
)
f_new
=
ift
.
MultiField
.
from_dict
({
'dom1'
:
f1
,
'dom2'
:
f2
})
f3
=
ift
.
from_random
(
'normal'
,
domain
=
dom
)
f4
=
ift
.
from_random
(
'normal'
,
domain
=
dom
)
f5
=
ift
.
from_random
(
'normal'
,
domain
=
dom
)
f_old
=
ift
.
MultiField
.
from_dict
({
'dom1'
:
f3
,
'dom2'
:
f4
,
'dom3'
:
f5
})
updated
=
f_old
.
update
(
f_new
).
to_dict
()
updated_true
=
f_old
.
to_dict
()
updated_true
.
update
(
f_new
.
to_dict
())
for
key
,
val
in
updated
.
items
():
assert_equal
((
val
==
updated_true
[
key
]).
all
(),
True
)
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