Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
2 merge requests!29Nif ty3 temp,!21Refactor spaces to match Space specification
...@@ -15,7 +15,6 @@ from nifty.field_types import FieldType,\ ...@@ -15,7 +15,6 @@ from nifty.field_types import FieldType,\
from nifty.spaces.space import Space from nifty.spaces.space import Space
import nifty.nifty_utilities as utilities import nifty.nifty_utilities as utilities
from nifty_random import random
POINT_DISTRIBUTION_STRATEGIES = DISTRIBUTION_STRATEGIES['global'] POINT_DISTRIBUTION_STRATEGIES = DISTRIBUTION_STRATEGIES['global']
COMM = getattr(gdi[gc['mpi_module']], gc['default_comm']) 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 ...@@ -7,6 +7,8 @@ from nifty.spaces.space import SpaceParadict
class HPSpaceParadict(SpaceParadict): class HPSpaceParadict(SpaceParadict):
def __init__(self, nside): def __init__(self, nside):
if not hasattr(self, 'parameters'):
self.parameters = {}
SpaceParadict.__init__(self, nside=nside) SpaceParadict.__init__(self, nside=nside)
def __setitem__(self, key, arg): def __setitem__(self, key, arg):
...@@ -14,9 +16,12 @@ class HPSpaceParadict(SpaceParadict): ...@@ -14,9 +16,12 @@ class HPSpaceParadict(SpaceParadict):
raise ValueError(about._errors.cstring( raise ValueError(about._errors.cstring(
"ERROR: Unsupported hp_space parameter")) "ERROR: Unsupported hp_space parameter"))
temp = int(arg) if key == 'nside':
# if(not hp.isnsideok(nside)): temp = int(arg)
if ((temp & (temp - 1)) != 0) or (temp < 2): if ((temp & (temp - 1)) != 0) or (temp < 2):
raise ValueError(about._errors.cstring( raise ValueError(
"ERROR: invalid parameter ( nside <> 2**n ).")) about._errors.cstring(
"ERROR: invalid parameter ( nside <> 2**n ).")
)
self.parameters.__setitem__(key, temp) self.parameters.__setitem__(key, temp)
This diff is collapsed.
...@@ -268,10 +268,6 @@ class Space(object): ...@@ -268,10 +268,6 @@ class Space(object):
raise NotImplementedError(about._errors.cstring( raise NotImplementedError(about._errors.cstring(
"ERROR: There is no generic k_array for Space base class.")) "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, def get_plot(self, x, title="", vmin=None, vmax=None, unit=None,
norm=None, other=None, legend=False, save=None, **kwargs): norm=None, other=None, legend=False, save=None, **kwargs):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment