Commit ad1e239f authored by Theo Steininger's avatar Theo Steininger
Browse files

Merge branch 'refactor_spaces' into 'feature/field_multiple_space'

Refactor spaces to match Space specification

Remove all functionality not provided by spaces from all the space classes. Also, move space-specific attributes to the paradicts.

See merge request !21
parents 30623565 04dfa1a2
......@@ -15,7 +15,6 @@ from nifty.field_types import FieldType,\
from nifty.spaces.space import Space
import nifty.nifty_utilities as utilities
from nifty_random import random
POINT_DISTRIBUTION_STRATEGIES = DISTRIBUTION_STRATEGIES['global']
COMM = getattr(gdi[gc['mpi_module']], gc['default_comm'])
......
This diff is collapsed.
This diff is collapsed.
......@@ -7,6 +7,8 @@ from nifty.spaces.space import SpaceParadict
class HPSpaceParadict(SpaceParadict):
def __init__(self, nside):
if not hasattr(self, 'parameters'):
self.parameters = {}
SpaceParadict.__init__(self, nside=nside)
def __setitem__(self, key, arg):
......@@ -14,9 +16,12 @@ class HPSpaceParadict(SpaceParadict):
raise ValueError(about._errors.cstring(
"ERROR: Unsupported hp_space parameter"))
temp = int(arg)
# if(not hp.isnsideok(nside)):
if ((temp & (temp - 1)) != 0) or (temp < 2):
raise ValueError(about._errors.cstring(
"ERROR: invalid parameter ( nside <> 2**n )."))
if key == 'nside':
temp = int(arg)
if ((temp & (temp - 1)) != 0) or (temp < 2):
raise ValueError(
about._errors.cstring(
"ERROR: invalid parameter ( nside <> 2**n ).")
)
self.parameters.__setitem__(key, temp)
This diff is collapsed.
......@@ -268,10 +268,6 @@ class Space(object):
raise NotImplementedError(about._errors.cstring(
"ERROR: There is no generic k_array for Space base class."))
def smooth(self, x, **kwargs):
raise AttributeError(about._errors.cstring(
"ERROR: There is no generic smoothing for Space base class."))
def get_plot(self, x, title="", vmin=None, vmax=None, unit=None,
norm=None, other=None, legend=False, save=None, **kwargs):
"""
......
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