Commit ad6df122 authored by Theo Steininger's avatar Theo Steininger

Added Jaffe13 model.

parent 065852c8
......@@ -2,7 +2,12 @@
from magnetic_field import MagneticField, \
MagneticFieldFactory
from constant_magnetic_field import ConstantMagneticField, \
ConstantMagneticFieldFactory
from jaffe13_magnetic_field import Jaffe13MagneticField, \
Jaffe13MagneticFieldFactory
from jf12_magnetic_field import JF12MagneticField, \
JF12MagneticFieldFactory
# -*- coding: utf-8 -*-
from jaffe13_magnetic_field import Jaffe13MagneticField
from jaffe13_magnetic_field_factory import Jaffe13MagneticFieldFactory
\ No newline at end of file
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.magnetic_field import MagneticField
class Jaffe13MagneticField(MagneticField):
@property
def parameter_list(self):
parameter_list = ['B_f_ord', 'B_field_alpha', 'B_field_cutoff',
'B_ran_b2', 'B_ran_h_d', 'B_ran_h_d2', 'B_ran_h_r',
'B_ran_h_r2', 'b1_Psi_0', 'bb_amps_0', 'bb_amps_1',
'bb_amps_2', 'bb_amps_3', 'bb_amps_4', 'bb_bar_a',
'bb_bar_boa', 'bb_bar_phi0_deg', 'bb_cr0_coh',
'bb_cr0_iso', 'bb_cr0_ord', 'bb_d0_iso', 'bb_d0',
'bb_delta_phi_iso_deg', 'bb_delta_phi_ord_deg',
'bb_disk_b0', 'bb_disk_h_d', 'bb_halo_b0',
'bb_halo_h_d', 'bb_phi0_deg', 'bb_pitch_biso',
'bb_pitch', 'bb_r_compconst', 'bb_r_innercut',
'bb_r_peak', 'bb_r_peak', 'bb_r_scale',
'bb_rmax_arms', 'bb_spiral_cpow', 'bb_spiral_h_d',
'bb_spiral_h_d']
return parameter_list
def _create_field(self):
raise NotImplementedError
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.magnetic_field.magnetic_field_factory \
import MagneticFieldFactory
from jaffe13_magnetic_field import Jaffe13MagneticField
class Jaffe13MagneticFieldFactory(MagneticFieldFactory):
@property
def magnetic_field_class(self):
return Jaffe13MagneticField
@property
def _initial_parameter_defaults(self):
defaults = {'B_f_ord': 0.,
'B_field_alpha': -2.37,
'B_field_cutoff': 5.,
'B_ran_b2': 0.,
'B_ran_h_d': 1.,
'B_ran_h_d2': 1.,
'B_ran_h_r': 10.,
'B_ran_h_r2': 10.,
'bb_amps_0': 1.,
'bb_amps_1': 1.,
'bb_amps_2': -1.,
'bb_amps_3': 1.,
'bb_amps_4': -1.,
'bb_bar_a': 0.,
'bb_bar_boa': 1.,
'bb_bar_phi0_deg': 45.,
'bb_cr0_coh': 1.,
'bb_cr0_iso': 1.,
'bb_cr0_ord': 1.,
'bb_d0_iso': 0.3,
'bb_d0': 0.3,
'bb_delta_phi_iso_deg': 0.,
'bb_delta_phi_ord_deg': 0.,
'bb_disk_b0': 1.,
'bb_disk_h_d': 1.,
'bb_halo_b0': 1.,
'bb_halo_h_d': 4.,
'bb_phi0_deg': 65.,
'bb_pitch_biso': -11.5,
'bb_pitch': -11.5,
'bb_r_compconst': 10.,
'bb_r_innercut': 0.5,
'bb_r_peak': -1.,
'bb_r_scale': 13.2,
'bb_rmax_arms': 15.,
'bb_spiral_cpow': 3.,
'bb_spiral_h_d': 0.5,
}
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_f_ord': self._interval(0, 1, n),
'B_field_alpha': self._interval(-2.37, 1., n),
'B_field_cutoff': self._interval(5., 1., n),
'B_ran_b2': self._interval(0., 1., n),
'B_ran_h_d': self._interval(1., 1., n),
'B_ran_h_d2': self._interval(1., 1., n),
'B_ran_h_r': self._interval(10., 3., n),
'B_ran_h_r2': self._interval(10., 3., n),
'bb_amps_0': self._interval(1., 1., n),
'bb_amps_1': self._interval(1., 1., n),
'bb_amps_2': self._interval(-1., 1., n),
'bb_amps_3': self._interval(1., 1., n),
'bb_amps_4': self._interval(-1., 1., n),
'bb_bar_a': self._interval(0., 1., n),
'bb_bar_boa': self._interval(1., 1., n),
'bb_bar_phi0_deg': self._interval(45., 15., n),
'bb_cr0_coh': self._interval(1., 1., n),
'bb_cr0_iso': self._interval(1., 1., n),
'bb_cr0_ord': self._interval(1., 1., n),
'bb_d0_iso': self._interval(0.3, 0.1, n),
'bb_d0': self._interval(0.3, 0.1, n),
'bb_delta_phi_iso_deg': self._interval(0., 1., n),
'bb_delta_phi_ord_deg': self._interval(0., 1., n),
'bb_disk_b0': self._interval(1., 1., n),
'bb_disk_h_d': self._interval(1., 1., n),
'bb_halo_b0': self._interval(1., 1., n),
'bb_halo_h_d': self._interval(4., 1., n),
'bb_phi0_deg': self._interval(65., 20., n),
'bb_pitch_biso': self._interval(-11.5, 5., n),
'bb_pitch': self._interval(-11.5, 5., n),
'bb_r_compconst': self._interval(10., 3., n),
'bb_r_innercut': self._interval(0.5, 1., n),
'bb_r_peak': self._interval(-1., 1., n),
'bb_r_scale': self._interval(13.2, 4., n),
'bb_rmax_arms': self._interval(15., 5., n),
'bb_spiral_cpow': self._interval(3., 1., n),
'bb_spiral_h_d': self._interval(0.5, 1., n),
}
return defaults
......@@ -22,12 +22,12 @@ class JF12MagneticFieldFactory(MagneticFieldFactory):
'b51_ran_b7': 37.29,
'b51_ran_b8': 10.35,
'b51_coh_b1': 0.1,
'b51_coh_b2': 3.0,
'b51_coh_b2': 3.,
'b51_coh_b3': -0.9,
'b51_coh_b4': -0.8,
'b51_coh_b5': -2.0,
'b51_coh_b5': -2.,
'b51_coh_b6': -4.2,
'b51_coh_b7': 0.0,
'b51_coh_b7': 0.,
'b51_z0_spiral': 0.61,
'b51_z0_smooth': 2.84,
'b51_r0_smooth': 10.97,
......@@ -41,8 +41,8 @@ class JF12MagneticFieldFactory(MagneticFieldFactory):
'b51_z0_halo': 5.3,
'b51_b_ring': 0.1,
'b51_b0_interior': 7.63,
'b51_reg_b0': 1,
'b51_shift': 0}
'b51_reg_b0': 1.,
'b51_shift': 0.}
return defaults
@property
......
# -*- coding: utf-8 -*-
from imagine.magnetic_fields.jaffe13_magnetic_field import Jaffe13MagneticField
class Jaffe13Mixin(object):
def __init__(self, hammurabi_executable, conf_directory='./confs',
working_directory_base='.', nside=128):
self.__parameter_dict = {'B_field_type': '10',
'B_field_do_random': 'T',
'B_analytic_beta': '0',
'B_field_RMS_uG': '3.5',
'B_field_interp': 'T',
'use_B_analytic': 'F',
'B_ran_mem_lim': '4',
'bb_molr_aniso': 'T',
'bb_ord_interarm': 'T',
'bb_scale_coh_amps': 'T',
'bb_scale_rms_amps': 'F',
'bb_swap_cr0': 'T', # SWAPS cr0 for 1/(1+cr0) for sampling
}
super(Jaffe13Mixin, self).__init__(hammurabi_executable,
conf_directory,
working_directory_base,
nside)
@property
def magnetic_field_class(self):
return Jaffe13MagneticField
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(Jaffe13Mixin, 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