Skip to content

Commit

Permalink
Set halo_model to default to None everywhere, to avoid evaluation bef…
Browse files Browse the repository at this point in the history
…ore numericalunits reset
  • Loading branch information
kdund committed Jun 7, 2019
1 parent 1093a56 commit 75d7675
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion wimprates/bremsstrahlung.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def integrand(erec):
@wr.vectorize_first
def rate_bremsstrahlung(w, mw, sigma_nucleon, interaction='SI',
m_med=float('inf'), t=None,
halo_model = wr.standard_halo_model(),**kwargs):
halo_model = None,**kwargs):
"""Differential rate per unit detector mass and recoil energy of
Bremsstrahlung elastic WIMP-nucleus scattering.
Expand All @@ -122,6 +122,7 @@ def rate_bremsstrahlung(w, mw, sigma_nucleon, interaction='SI',
Further kwargs are passed to scipy.integrate.quad numeric integrator
(e.g. error tolerance).
"""
halo_model = wr.standard_halo_model() if halo_model is None else halo_model
vmin = vmin_w(w, mw)

if vmin >= wr.v_max(t, halo_model.v_esc):
Expand Down
3 changes: 2 additions & 1 deletion wimprates/elastic_nr.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def vmin_elastic(erec, mw):
@wr.vectorize_first
def rate_elastic(erec, mw, sigma_nucleon, interaction='SI',
m_med=float('inf'), t=None,
halo_model = wr.standard_halo_model(), **kwargs):
halo_model = None, **kwargs):
"""Differential rate per unit detector mass and recoil energy of
elastic WIMP scattering
Expand All @@ -200,6 +200,7 @@ def rate_elastic(erec, mw, sigma_nucleon, interaction='SI',
Analytic expressions are known for this rate, but they are not used here.
"""
halo_model = wr.standard_halo_model() if halo_model is None else halo_model
v_min = vmin_elastic(erec, mw)

if v_min >= wr.v_max(t, halo_model.v_esc):
Expand Down
2 changes: 1 addition & 1 deletion wimprates/electron.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def diff_xsec(q):
# Note dblquad expects the function to be f(y, x), not f(x, y)...
def diff_xsec(v, q):
result = q * dme_ionization_ff(shell, erec, q)
result *= 1 / v * halo_model.valocity_dist(v, t)
result *= 1 / v * halo_model.velocity_dist(v, t)
return result

r = dblquad(
Expand Down
3 changes: 2 additions & 1 deletion wimprates/migdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def vmin_migdal(w, erec, mw):
@wr.vectorize_first
def rate_migdal(w, mw, sigma_nucleon, interaction='SI', m_med=float('inf'),
include_approx_nr=False,
t=None, halo_model = wr.standard_halo_model(), **kwargs):
t=None, halo_model = None, **kwargs):
"""Differential rate per unit detector mass and deposited ER energy of
Migdal effect WIMP-nucleus scattering
Expand All @@ -65,6 +65,7 @@ def rate_migdal(w, mw, sigma_nucleon, interaction='SI', m_med=float('inf'),
Further kwargs are passed to scipy.integrate.quad numeric integrator
(e.g. error tolerance).
"""
halo_model = wr.standard_halo_model() if halo_model is None else halo_model
include_approx_nr = 1 if include_approx_nr else 0

result = 0
Expand Down

0 comments on commit 75d7675

Please sign in to comment.