Skip to content

Commit

Permalink
added anisotropy_parameterization consistently through the likelihood…
Browse files Browse the repository at this point in the history
… and parameter module
  • Loading branch information
sibirrer committed Jan 10, 2025
1 parent e3ec71d commit 3d1f648
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hierarc/Sampling/ParamManager/kin_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ def __init__(
anisotropy_sampling=False,
anisotropy_model="OM",
distribution_function="NONE",
anisotropy_parameterization="beta",
sigma_v_systematics=False,
log_scatter=False,
kwargs_fixed=None,

):
"""
:param anisotropy_sampling: bool, if True, makes use of this module, else ignores it's functionalities
:param anisotropy_model: string, name of anisotropy model to consider
:param distribution_function: string, 'NONE', 'GAUSSIAN', 'GAUSSIAN_SCALED', description of the distribution
function of the anisotropy model parameters
:param anisotropy_parameterization: model of parameterization (currently for constant anisotropy),
["beta" or "TAN_RAD"] supported
:param sigma_v_systematics: bool, if True samples parameters relative to systematics in the velocity dispersion
measurement
:param log_scatter: boolean, if True, samples the Gaussian scatter amplitude in log space (and thus flat prior in log)
Expand All @@ -28,6 +32,7 @@ def __init__(
self._anisotropy_sampling = anisotropy_sampling
self._anisotropy_model = anisotropy_model
self._distribution_function = distribution_function
self._anisotropy_parameterization = anisotropy_parameterization
self._sigma_v_systematics = sigma_v_systematics
if kwargs_fixed is None:
kwargs_fixed = {}
Expand All @@ -46,7 +51,12 @@ def param_list(self, latex_style=False):
if self._anisotropy_model in ["OM", "GOM", "const"]:
if "a_ani" not in self._kwargs_fixed:
if latex_style is True:
list.append(r"$\langle a_{\rm ani}\rangle$")
if self._anisotropy_model == "const" and self._anisotropy_parameterization == "TAN_RAD":
list.append(r"$\langle \phi_{\rm TAN}/\phi_{\rm RAD}\rangle$")
elif self._anisotropy_model == "const":
list.append(r"$\langle \beta_{\rm ani}\rangle$")
else:
list.append(r"$\langle a_{\rm ani}\rangle$")
else:
list.append("a_ani")
if self._distribution_function in ["GAUSSIAN", "GAUSSIAN_SCALED"]:
Expand Down
5 changes: 5 additions & 0 deletions hierarc/Sampling/ParamManager/param_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(
anisotropy_sampling=False,
anisotropy_model="OM",
anisotropy_distribution="NONE",
anisotropy_parameterization="beta",
gamma_in_sampling=False,
gamma_in_distribution="NONE",
log_m2l_sampling=False,
Expand Down Expand Up @@ -95,6 +96,9 @@ def __init__(
:type los_distributions: list of str
:param kwargs_fixed_los: fixed arguments in sampling
:type kwargs_fixed_los: list of dictionaries for each los distribution
:param anisotropy_parameterization: model of parameterization (currently for constant anisotropy),
["beta" or "TAN_RAD"] supported
:type anisotropy_parameterization: str
"""
self._kin_param = KinParam(
anisotropy_sampling=anisotropy_sampling,
Expand All @@ -103,6 +107,7 @@ def __init__(
log_scatter=log_scatter,
sigma_v_systematics=sigma_v_systematics,
kwargs_fixed=kwargs_fixed_kin,
anisotropy_parameterization=anisotropy_parameterization,
)
self._cosmo_param = CosmoParam(
cosmology=cosmology,
Expand Down
13 changes: 13 additions & 0 deletions test/test_Sampling/test_ParamManager/test_kin_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def setup_method(self):
kwargs_fixed={},
)

self._param_tan_rad = KinParam(
anisotropy_sampling=True,
anisotropy_model="const",
distribution_function="GAUSSIAN",
sigma_v_systematics=True,
anisotropy_parameterization="TAN_RAD",
log_scatter=True,
kwargs_fixed={},
)

kwargs_fixed = {
"a_ani": 1,
"a_ani_sigma": 0.1,
Expand All @@ -43,6 +53,9 @@ def test_param_list(self):
param_list = self._param.param_list(latex_style=True)
assert len(param_list) == 5

param_list = self._param_tan_rad.param_list(latex_style=True)
assert len(param_list) == 3

param_list = self._param_log_scatter.param_list(latex_style=False)
assert len(param_list) == 5
param_list = self._param_log_scatter.param_list(latex_style=True)
Expand Down

0 comments on commit 3d1f648

Please sign in to comment.