Commit 398c77f2 authored by Jiaxin Wang's avatar Jiaxin Wang

wmap3yr b_field

parent 1d9e44ed
# -*- coding: utf-8 -*-
from wmap3yr_magnetic_field import WMAP3yrMagneticField
from wmap3yr_magnetic_field_factory import WMAP3yrMagneticFieldFactory
\ No newline at end of file
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.magnetic_field import MagneticField
class WMAP3yrMagneticField(MagneticField):
@property
def parameter_list(self):
parameter_list = ['B_field_b0',
'B_field_psi0_deg',
'B_field_psi1_deg',
'B_field_xsi0_deg']
return parameter_list
def _create_field(self):
raise NotImplementedError
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.magnetic_field.magnetic_field_factory \
import MagneticFieldFactory
from wmap3yr_magnetic_field import WMAP3yrMagneticField
class WMAP3yrMagneticFieldFactory(MagneticFieldFactory):
@property
def magnetic_field_class(self):
return WMAP3yrMagneticField
@property
def _initial_parameter_defaults(self):
defaults = {
'B_field_b0': 6,
'B_field_psi0_deg': 27,
'B_field_psi1_deg': 0.9,
'B_field_xsi0_deg': 25
}
return defaults
@property
def _initial_variable_to_parameter_mappings(self):
return self._generate_variable_to_parameter_mapping_defaults(n=3)
def _generate_variable_to_parameter_mapping_defaults(self, n):
defaults = {
'B_field_b0': self._positive_interval(6.0, 2.0, n), # b0
'B_field_psi0': self._positive_interval(27.0, 5.0, n), #psi0
'B_field_psi1': self._positive_interval(0.9, 5.0, n), #psi1
'B_field_xsi0': self._positive_interval(25, 5.0, n), #xsi0
}
return defaults
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.wmap3yr_magnetic_field import WMAP3yrMagneticField
class WMAP3yrMixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128,
analytic_ensemble_mean=False):
self.__parameter_dict={'B_field_type': '1',
'B_field_do_random': 'T',
'B_field_RMS_uG': '1.0',
'B_field_z_antisym': '0',
}
super(WMAP3yrMixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside,
analytic_ensemble_mean)
@property
def magnetic_field_class(self):
return WMAP3yrMagneticField
def _build_parameter_dict(self, parameter_dict, magnetic_field,
working_directory, local_ensemble_index):
parameter_dict.update(self.__parameter_dict)
parameter_dict.update(magnetic_field.parameters)
super(WMAP3yrMixin, self)._build_parameter_dict(parameter_dict,
magnetic_field,
working_directory,
local_ensemble_index)
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