Commit 70ef764a authored by Martin Reinecke's avatar Martin Reinecke

Merge branch 'master' into line_search

parents 7b98c3bb 67a98fe9
Pipeline #14942 passed with stage
in 6 minutes and 26 seconds
......@@ -18,6 +18,7 @@
from __future__ import division
import ast
import itertools
import numpy as np
......@@ -1519,7 +1520,8 @@ class Field(Loggable, Versionable, object):
temp_domain.append(repository.get('s_' + str(i), hdf5_group))
new_field.domain = tuple(temp_domain)
exec('new_field.domain_axes = ' + hdf5_group.attrs['domain_axes'])
new_field.domain_axes = ast.literal_eval(
hdf5_group.attrs['domain_axes'])
try:
new_field._val = repository.get('val', hdf5_group)
......
......@@ -16,6 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
import ast
import numpy as np
from d2o import distributed_data_object
......@@ -311,6 +312,6 @@ class PowerSpace(Space):
@classmethod
def _from_hdf5(cls, hdf5_group, repository):
hp = repository.get('harmonic_partner', hdf5_group)
exec("bb = " + hdf5_group.attrs['binbounds'])
bb = ast.literal_eval(hdf5_group.attrs['binbounds'])
ds = hdf5_group.attrs['distribution_strategy']
return PowerSpace(hp, ds, binbounds=bb)
......@@ -21,6 +21,7 @@ import unittest
from numpy.testing import assert_equal
from keepers import Repository
from test.common import expand, generate_spaces
from nifty import Field
from nose.plugins.skip import SkipTest
import os
......@@ -33,6 +34,9 @@ class SpaceSerializationTests(unittest.TestCase):
raise SkipTest
repo = Repository('test.h5')
repo.add(space, 'space')
field = Field(space,val=42.)
repo.add(field, 'field')
repo.commit()
assert_equal(space, repo.get('space'))
assert_equal(field, repo.get('field'))
os.remove('test.h5')
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