Commit db6718c7 authored by Theo Steininger's avatar Theo Steininger

Hammurapy observers now reuse the HPSpace instance for creating observables.

parent 344fafef
......@@ -21,7 +21,7 @@ class Hammurapy(Observer):
self.conf_directory = os.path.abspath(conf_directory)
self.working_directory_base = os.path.abspath(working_directory_base)
self.nside = nside
self.nside = int(nside)
self.last_call_log = ""
......
......@@ -6,11 +6,18 @@ from nifty import Field, HPSpace
class DMMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(DMMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
observable_dict['dm'] = Field(domain=(ensemble_space, hpSpace),
observable_dict['dm'] = Field(domain=(ensemble_space, self.__hpSpace),
distribution_strategy='equal')
super(DMMixin, self)._initialize_observable_dict(observable_dict,
magnetic_field)
......
......@@ -6,12 +6,20 @@ from nifty import Field, HPSpace
class DustMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(DustMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
for name in ['dust_I', 'dust_Q', 'dust_U']:
observable_dict[name] = Field(domain=(ensemble_space, hpSpace),
observable_dict[name] = Field(domain=(ensemble_space,
self.__hpSpace),
distribution_strategy='equal')
super(DustMixin, self)._initialize_observable_dict(observable_dict,
......
......@@ -6,11 +6,17 @@ from nifty import Field, HPSpace
class FFMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(FFMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
observable_dict['ff'] = Field(domain=(ensemble_space, hpSpace),
observable_dict['ff'] = Field(domain=(ensemble_space, self.__hpSpace),
distribution_strategy='equal')
super(FFMixin, self)._initialize_observable_dict(observable_dict,
magnetic_field)
......
......@@ -6,11 +6,18 @@ from nifty import Field, HPSpace
class RMMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(RMMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
observable_dict['rm'] = Field(domain=(ensemble_space, hpSpace),
observable_dict['rm'] = Field(domain=(ensemble_space, self.__hpSpace),
distribution_strategy='equal')
super(RMMixin, self)._initialize_observable_dict(observable_dict,
magnetic_field)
......
......@@ -6,12 +6,20 @@ from nifty import Field, HPSpace
class SyncMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(SyncMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
for name in ['sync_I', 'sync_Q', 'sync_U']:
observable_dict[name] = Field(domain=(ensemble_space, hpSpace),
observable_dict[name] = Field(domain=(ensemble_space,
self.__hpSpace),
distribution_strategy='equal')
super(SyncMixin, self)._initialize_observable_dict(observable_dict,
......
......@@ -6,11 +6,17 @@ from nifty import Field, HPSpace
class TauMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__hpSpace = HPSpace(nside=int(nside))
super(TauMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
def _initialize_observable_dict(self, observable_dict, magnetic_field):
ensemble_space = magnetic_field.domain[0]
hpSpace = HPSpace(nside=self.nside)
observable_dict['tau'] = Field(domain=(ensemble_space, hpSpace),
observable_dict['tau'] = Field(domain=(ensemble_space, self.__hpSpace),
distribution_strategy='equal')
super(TauMixin, self)._initialize_observable_dict(observable_dict,
magnetic_field)
......
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