Skip to content

Commit

Permalink
Merge branch 'feature/composite' of https://github.com/ajshajib/hierArc
Browse files Browse the repository at this point in the history
… into feature/composite
  • Loading branch information
ajshajib committed Dec 4, 2023
2 parents d2648e3 + eaae1a2 commit ff4b614
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hierarc/Likelihood/hierarchy_likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def draw_lens_scaling_params(
gamma_in + alpha_gamma_in * self._lambda_scaling_property,
gamma_in_sigma,
m2l + alpha_m2l * self._lambda_scaling_property,
m2l_sigma
m2l_sigma,
)
return gamma_in_draw, m2l_draw
else:
Expand Down
16 changes: 10 additions & 6 deletions hierarc/Likelihood/parameter_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ def draw_anisotropy(
return np.array([a_ani_draw, beta_inf_draw])
return None

def draw_lens_parameters(self, gamma_in=None, gamma_in_sigma=0, m2l=None,
m2l_sigma=0):
"""
Draw Gaussian distribution and re-sample if outside bounds.
def draw_lens_parameters(
self, gamma_in=None, gamma_in_sigma=0, m2l=None, m2l_sigma=0
):
"""Draw Gaussian distribution and re-sample if outside bounds.
:param gamma_in: mean of the distribution
:param gamma_in_sigma: std of the distribution
Expand All @@ -200,8 +200,12 @@ def draw_lens_parameters(self, gamma_in=None, gamma_in_sigma=0, m2l=None,
gamma_in_draw = np.random.normal(gamma_in, gamma_in_sigma)
m2l_draw = np.random.normal(m2l, m2l_sigma)

if (gamma_in_draw < self._gamma_in_min or gamma_in_draw > self._gamma_in_max
or m2l_draw < self._m2l_min or m2l_draw > self._m2l_max):
if (
gamma_in_draw < self._gamma_in_min
or gamma_in_draw > self._gamma_in_max
or m2l_draw < self._m2l_min
or m2l_draw > self._m2l_max
):
return self.draw_lens_parameters(gamma_in, gamma_in_sigma, m2l, m2l_sigma)

return gamma_in_draw, m2l_draw

0 comments on commit ff4b614

Please sign in to comment.