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
85fcff13
Commit
85fcff13
authored
Mar 06, 2017
by
Theo Steininger
Browse files
Fixed bugs serialization.
Increased version number to 3.0.4
parent
f389aa57
Pipeline
#10585
failed with stages
in 37 minutes and 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/field.py
View file @
85fcff13
...
...
@@ -836,7 +836,10 @@ class Field(Loggable, Versionable, object):
hdf5_group
.
attrs
[
'domain_axes'
]
=
str
(
self
.
domain_axes
)
hdf5_group
[
'num_domain'
]
=
len
(
self
.
domain
)
ret_dict
=
{
'val'
:
self
.
val
}
if
self
.
_val
is
None
:
ret_dict
=
{}
else
:
ret_dict
=
{
'val'
:
self
.
val
}
for
i
in
range
(
len
(
self
.
domain
)):
ret_dict
[
's_'
+
str
(
i
)]
=
self
.
domain
[
i
]
...
...
@@ -856,7 +859,12 @@ class Field(Loggable, Versionable, object):
new_field
.
domain
=
tuple
(
temp_domain
)
exec
(
'new_field.domain_axes = '
+
hdf5_group
.
attrs
[
'domain_axes'
])
new_field
.
_val
=
repository
.
get
(
'val'
,
hdf5_group
)
try
:
new_field
.
_val
=
repository
.
get
(
'val'
,
hdf5_group
)
except
(
KeyError
):
new_field
.
_val
=
None
new_field
.
dtype
=
np
.
dtype
(
hdf5_group
.
attrs
[
'dtype'
])
new_field
.
distribution_strategy
=
\
hdf5_group
.
attrs
[
'distribution_strategy'
]
...
...
nifty/field_types/field_array.py
View file @
85fcff13
# -*- coding: utf-8 -*-
import
pickle
import
numpy
as
np
from
field_type
import
FieldType
...
...
@@ -29,14 +27,14 @@ class FieldArray(FieldType):
def
_to_hdf5
(
self
,
hdf5_group
):
hdf5_group
[
'shape'
]
=
self
.
shape
hdf5_group
[
'dtype'
]
=
pickle
.
dumps
(
self
.
dtype
)
hdf5_group
.
attrs
[
'dtype'
]
=
self
.
dtype
.
name
return
None
@
classmethod
def
_from_hdf5
(
cls
,
hdf5_group
,
loopback_get
):
result
=
cls
(
hdf5_group
[
'shape'
][:],
pickle
.
loads
(
hdf5_group
[
'dtype'
]
[()]
)
shape
=
hdf5_group
[
'shape'
][:],
dtype
=
np
.
dtype
(
hdf5_group
.
attrs
[
'dtype'
])
)
return
result
nifty/version.py
View file @
85fcff13
...
...
@@ -4,4 +4,4 @@
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__
=
'3.0.
3
'
__version__
=
'3.0.
4
'
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