From b500a64af59b7084b2acbb8032204f53a698f5c8 Mon Sep 17 00:00:00 2001 From: "Joran R. Angevaare" Date: Wed, 17 Aug 2022 11:25:05 +0200 Subject: [PATCH 01/15] Update pytest.yml --- .github/workflows/pytest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8594f06..7bcb277 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,6 +36,7 @@ jobs: - name: Install requirements for tests and latest strax run: | # Requirements for running the notebooks as a pytest + pip install cython pip install nbmake pytest-xdist # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax From ee3246d24d23e8780558165bcef9cfa62db625cc Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:28:15 +0200 Subject: [PATCH 02/15] update pytest --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 7bcb277..e0cba6b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -37,7 +37,7 @@ jobs: run: | # Requirements for running the notebooks as a pytest pip install cython - pip install nbmake pytest-xdist + pip install nbmake pytest-xdist pytest coverage coveralls # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax python setup.py develop From dac54c268f35157d2bac883f4ea73bc336fd7ec3 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:29:31 +0200 Subject: [PATCH 03/15] fix pytest --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e0cba6b..0b95754 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -43,7 +43,7 @@ jobs: python setup.py develop - name: Test package if: matrix.test == 'pytest' - run: coverage run --source=pema -m pytest -vs --log-level=DEBUG --durations 0 + run: coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: NUMBA_DISABLE_JIT: 1 From 9318ab63897e554241b3c8a91559771eb14b21f1 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:34:21 +0200 Subject: [PATCH 04/15] fix notebooks --- notebooks/Checks, plots.ipynb | 56 +++++++++++++++++--------- notebooks/DM-electron scattering.ipynb | 10 +++-- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/notebooks/Checks, plots.ipynb b/notebooks/Checks, plots.ipynb index 65355d9..3376f66 100644 --- a/notebooks/Checks, plots.ipynb +++ b/notebooks/Checks, plots.ipynb @@ -36,8 +36,10 @@ "source": [ "try:\n", " plt.style.use('latex_thesis')\n", + " _latex_thesis=True\n", "except (FileNotFoundError, OSError):\n", - " print(\"Can't use my favourite plotting style... oh well\")" + " print(\"Can't use my favourite plotting style... oh well\")\n", + " _latex_thesis=False" ] }, { @@ -48,7 +50,8 @@ "source": [ "kms = nu.km/nu.s\n", "\n", - "from wimprates import v_0, v_earth, v_esc \n", + "from wimprates import StandardHaloModel, v_earth\n", + "v_0, v_esc = StandardHaloModel().v_0, StandardHaloModel().v_esc\n", "\n", "def galactic_v_dist(v):\n", " # Maxwell Boltzmann distribution with\n", @@ -393,10 +396,14 @@ ], "source": [ "# Get mean energies and energy spectra\n", - "from laidbax import wimps\n", - "from s2only import wimprates as wr\n", + "try:\n", + " from laidbax import wimps\n", + " from s2only import wimprates as wr\n", + "except ImportError:\n", + " import wimprates as wr\n", + " wimps = None\n", "\n", - "es = np.logspace(-2, 3.5, 500)\n", + "es = np.logspace(-2, 3.5, 100)\n", "ms = mchi / gevcsq\n", "rates = []\n", "rates_bs = []\n", @@ -407,7 +414,10 @@ "means_bs = np.zeros(len(ms), dtype=np.float)\n", "\n", "for i, mw in enumerate(tqdm(ms)):\n", - " r = wimps.wimp_recoil_spectrum(es, mass=mw, sigma=1e-45)\n", + " if wimps is not None:\n", + " r = wimps.wimp_recoil_spectrum(es, mass=mw, sigma=1e-45)\n", + " else:\n", + " r = wr.rate_wimp_std(es, mw, 1e-45)\n", " rates.append(r)\n", " rate_per_bin = (r[1:] + r[:-1])/2 * widths\n", " if rate_per_bin.sum() != 0:\n", @@ -435,9 +445,13 @@ "metadata": {}, "outputs": [], "source": [ - "from s2only.utils import load_pickle, dump_pickle\n", - "dump_pickle(dict(means=means, means_bs=means_bs, rates=rates, rates_bs=rates_bs, ms=ms),\n", - " 'dm_mean_energies.pickle')" + "try:\n", + " from s2only.utils import load_pickle, dump_pickle\n", + "except ModuleNotFoundError:\n", + " pass\n", + "else:\n", + " dump_pickle(dict(means=means, means_bs=means_bs, rates=rates, rates_bs=rates_bs, ms=ms),\n", + " 'dm_mean_energies.pickle')" ] }, { @@ -574,13 +588,13 @@ "tyear = 1e3 * 365\n", "\n", "plt.plot(ms, [tyear * total_rate(m, threshold=5) for m in ms], \n", - " label='NR, $E_T =\\SI{5}{keV}$', \n", + " label='NR, $E_T =\\SI{5}{keV}$' if _latex_thesis else 'NR, $E_T =5$ keV', \n", " c='blue', linewidth=1)\n", "plt.plot(ms, [tyear * total_rate(m, threshold=1) for m in ms], \n", - " label='NR, $E_T = \\SI{1}{keV}$', \n", + " label='NR, $E_T = \\SI{1}{keV}$' if _latex_thesis else 'NR, $E_T = 1$ keV', \n", " c='g', linewidth=1)\n", "plt.plot(ms, [tyear * total_rate(m, bs=True, threshold=0.18) * 1e-10 for m in ms], \n", - " label='BS, $E_T =\\SI{180}{eV}$',\n", + " label='BS, $E_T =\\SI{180}{eV}$' if _latex_thesis else 'BS, $E_T =180$ eV',\n", " c='r', linewidth=1)\n", "plt.yscale('log')\n", "plt.ylim(None, 1e4)\n", @@ -589,8 +603,12 @@ "leg = plt.legend(loc='upper right')\n", "leg.get_frame().set_linewidth(0.0)\n", "leg.get_frame().set_alpha(0.85)\n", - "plt.ylabel('Rate (\\si{events/(ton\\;year)})')\n", - "plt.xlabel('$m_\\chi$ (\\si{GeV/c^2})')\n", + "if _latex_thesis:\n", + " plt.ylabel('Rate (\\si{events/(ton\\;year)})')\n", + " plt.xlabel('$m_\\chi$ (\\si{GeV/c^2})')\n", + "else:\n", + " plt.ylabel('Rate')\n", + " plt.xlabel('$m_\\chi$')\n", "plt.gca().invert_yaxis()\n", "#plt.plot(es, total_rate(, c='b', label='$\\SI{1}{GeV/c^2}$')\n", "plt.xlim(1e-1, 1e4)\n", @@ -615,10 +633,10 @@ } ], "source": [ - "plt.plot(es, nearest_rate(1), c='b', label='$\\SI{1}{GeV/c^2}$')\n", - "plt.plot(es, nearest_rate(100), label='$\\SI{100}{GeV/c^2}$', c='g')\n", + "plt.plot(es, nearest_rate(1), c='b', label='$\\SI{1}{GeV/c^2}$' if _latex_thesis else None)\n", + "plt.plot(es, nearest_rate(100), label='$\\SI{100}{GeV/c^2}$' if _latex_thesis else None, c='g')\n", "plt.plot(es, nearest_rate(1, bs=True) * 1e-10, c='b', linestyle=':',\n", - " label='$\\SI{1}{GeV/c^2}$, Bremsstrahlung' # $\\\\times 10^{10}$'\n", + " label='$\\SI{1}{GeV/c^2}$, Bremsstrahlung' if _latex_thesis else None # $\\\\times 10^{10}$'\n", " )\n", "leg = plt.legend(loc='upper right', frameon=False)\n", "#leg.get_frame().set_linewidth(0.0)\n", @@ -695,7 +713,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -709,7 +727,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.10.4" } }, "nbformat": 4, diff --git a/notebooks/DM-electron scattering.ipynb b/notebooks/DM-electron scattering.ipynb index b25f562..b3bf752 100644 --- a/notebooks/DM-electron scattering.ipynb +++ b/notebooks/DM-electron scattering.ipynb @@ -325,11 +325,13 @@ " \n", " for shell, rn in drsn.items():\n", " rn *= (1000 * nu.kg * nu.year)\n", - " plt.plot(n_el, rn, linestyle='steps-mid', label=shell)\n", + " plt.plot(n_el, rn, drawstyle='steps-mid', label=shell)\n", "\n", " plt.plot(n_el, np.sum(list(drsn.values()), axis=0),\n", " label='Total',\n", - " drawstyle='steps-mid', linestyle='--', c='k')\n", + " drawstyle='steps-mid', \n", + " linestyle='--', \n", + " c='k')\n", "\n", " plt.title(title + (' -- SWAP 4s<->4p' if do_swap else ''))\n", " plt.legend(loc='upper right', ncol=2)\n", @@ -355,7 +357,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -369,7 +371,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.10.4" } }, "nbformat": 4, From 24bb78377bab960310d6fb0c497d33053a81b681 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:44:48 +0200 Subject: [PATCH 05/15] fix also SD --- notebooks/Spin-dependent.ipynb | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/notebooks/Spin-dependent.ipynb b/notebooks/Spin-dependent.ipynb index 6e456b6..110b299 100644 --- a/notebooks/Spin-dependent.ipynb +++ b/notebooks/Spin-dependent.ipynb @@ -3,9 +3,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", @@ -32,9 +30,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -48,16 +44,14 @@ "source": [ "try:\n", " plt.style.use('latex_thesis')\n", - "except FileNotFoundError:\n", + "except (FileNotFoundError, OSError):\n", " print(\"Can't use my favourite plotting style... oh well\")" ] }, { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -76,7 +70,6 @@ "cell_type": "code", "execution_count": 8, "metadata": { - "collapsed": false, "scrolled": false }, "outputs": [], @@ -122,9 +115,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -184,9 +175,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -265,7 +254,7 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -279,7 +268,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.5" + "version": "3.10.4" } }, "nbformat": 4, From 9e9073875df72f903d687212de70696d2a4f759d Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:46:04 +0200 Subject: [PATCH 06/15] speedup --- notebooks/Checks, plots.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notebooks/Checks, plots.ipynb b/notebooks/Checks, plots.ipynb index 3376f66..4f7f4c6 100644 --- a/notebooks/Checks, plots.ipynb +++ b/notebooks/Checks, plots.ipynb @@ -405,6 +405,8 @@ "\n", "es = np.logspace(-2, 3.5, 100)\n", "ms = mchi / gevcsq\n", + "# Reduce the number a bit to get the results quicker\n", + "ms = ms[::5]\n", "rates = []\n", "rates_bs = []\n", "\n", From dd80e7ad83d1d51aa4856a4010d933ed8c458918 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 11:54:17 +0200 Subject: [PATCH 07/15] fix --- notebooks/Checks, plots.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/Checks, plots.ipynb b/notebooks/Checks, plots.ipynb index 4f7f4c6..4a9e725 100644 --- a/notebooks/Checks, plots.ipynb +++ b/notebooks/Checks, plots.ipynb @@ -477,7 +477,7 @@ " ax.set_ylabel(label, color=color)\n", " ax.tick_params('y', colors=color)\n", "\n", - "v = v_earth + v_esc\n", + "v = v_earth() + v_esc\n", "plt.plot(mchi / gevcsq, \n", " 4 * mchi * mn / (mchi + mn)**2 * (mchi * v**2 /2) / nu.keV,\n", " linestyle=':', c='b'\n", From 5d26b7875970ac9d8b70bfb75047eef4afe9a27c Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 12:53:50 +0200 Subject: [PATCH 08/15] update test --- .github/workflows/pytest.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0b95754..8749c84 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -37,18 +37,22 @@ jobs: run: | # Requirements for running the notebooks as a pytest pip install cython - pip install nbmake pytest-xdist pytest coverage coveralls + pip install nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax python setup.py develop - name: Test package if: matrix.test == 'pytest' - run: coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 + run: + pytest --cov wimprates -v --nbmake notebooks_fixed/*.ipynb --durations 0 --nb-coverage +# coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: NUMBA_DISABLE_JIT: 1 if: matrix.test == 'coveralls' - run: coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 + run: + pytest --cov wimprates -v --nbmake notebooks_fixed/*.ipynb --durations 0 --nb-coverage +# coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1d0e80555a087b2905a2eef99015928f9c904a07 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:01:07 +0200 Subject: [PATCH 09/15] add requirement --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8749c84..747823d 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -37,7 +37,7 @@ jobs: run: | # Requirements for running the notebooks as a pytest pip install cython - pip install nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook + pip install nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax python setup.py develop From 54d6a874a23fb948373d9a7d68b29b13b76d21bd Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:10:00 +0200 Subject: [PATCH 10/15] weird dependencies --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 747823d..24f55aa 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,8 +36,8 @@ jobs: - name: Install requirements for tests and latest strax run: | # Requirements for running the notebooks as a pytest - pip install cython - pip install nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils + pip install cythonipython + pip install nbconvert==6.4.3 nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax python setup.py develop From 3b6e1fe85c0285eafa1b151342b2242c827173f0 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:11:12 +0200 Subject: [PATCH 11/15] fix --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 24f55aa..cc3621e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,7 +36,7 @@ jobs: - name: Install requirements for tests and latest strax run: | # Requirements for running the notebooks as a pytest - pip install cythonipython + pip install cython ipython pip install nbconvert==6.4.3 nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils # Several optional packages that are imported in the notebooks pip install git+https://github.com/XENON1T/laidbax From f593aed90cd00cb8dead03c126eb52b1a0c1e7e7 Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:12:50 +0200 Subject: [PATCH 12/15] too much copy paste --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index cc3621e..c53f077 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -44,14 +44,14 @@ jobs: - name: Test package if: matrix.test == 'pytest' run: - pytest --cov wimprates -v --nbmake notebooks_fixed/*.ipynb --durations 0 --nb-coverage + pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage # coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: NUMBA_DISABLE_JIT: 1 if: matrix.test == 'coveralls' run: - pytest --cov wimprates -v --nbmake notebooks_fixed/*.ipynb --durations 0 --nb-coverage + pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage # coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: From 4031aca54cc186bc4fcbff22f5a603284506a4ed Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:23:53 +0200 Subject: [PATCH 13/15] fix the bug --- notebooks/Checks, plots.ipynb | 4 ++-- wimprates/bremsstrahlung.py | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/notebooks/Checks, plots.ipynb b/notebooks/Checks, plots.ipynb index 4a9e725..b3ee16f 100644 --- a/notebooks/Checks, plots.ipynb +++ b/notebooks/Checks, plots.ipynb @@ -404,9 +404,9 @@ " wimps = None\n", "\n", "es = np.logspace(-2, 3.5, 100)\n", - "ms = mchi / gevcsq\n", "# Reduce the number a bit to get the results quicker\n", - "ms = ms[::5]\n", + "ms = mchi[::5]\n", + "ms = mchi / gevcsq\n", "rates = []\n", "rates_bs = []\n", "\n", diff --git a/wimprates/bremsstrahlung.py b/wimprates/bremsstrahlung.py index 5a19a89..cbe7ca7 100644 --- a/wimprates/bremsstrahlung.py +++ b/wimprates/bremsstrahlung.py @@ -21,7 +21,7 @@ def to_itp(fn): f2 = to_itp('atomic_form_2') -def vmin_w(w, mw): +def vmin_w(w, mw, material): """Minimum wimp velocity to emit a Bremsstrahlung photon w :param w: Bremsstrahlung photon energy @@ -29,10 +29,10 @@ def vmin_w(w, mw): From Kouvaris/Pradler [arxiv:1607.01789v2], equation in text below eq. 10 """ - return (2 * w / wr.mu_nucleus(mw))**0.5 + return (2 * w / wr.mu_nucleus(mw, material))**0.5 -def erec_bound(sign, w, v, mw): +def erec_bound(sign, w, v, mw, material): """Bremsstrahlung scattering recoil energy kinematic limits From Kouvaris/Pradler [arxiv:1607.01789v2], eq. between 8 and 9, simplified by vmin (see above) @@ -44,8 +44,8 @@ def erec_bound(sign, w, v, mw): """ return (wr.mu_nucleus(mw)**2 * v**2 / wr.mn() * (1 - - vmin_w(w, mw)**2 / (2 * v**2) - + sign * (1 - vmin_w(w, mw)**2 / v**2)**0.5)) + - vmin_w(w, mw, material)**2 / (2 * v**2) + + sign * (1 - vmin_w(w, mw, material)**2 / v**2)**0.5)) def sigma_w_erec(w, erec, v, mw, sigma_nucleon, @@ -75,7 +75,9 @@ def sigma_w_erec(w, erec, v, mw, sigma_nucleon, def sigma_w(w, v, mw, sigma_nucleon, - interaction='SI', m_med=float('inf'), **kwargs): + material, + interaction='SI', m_med=float('inf'), + **kwargs): """Differential Bremsstrahlung WIMP-nucleus cross section :param w: Bremsstrahlung photon energy @@ -94,8 +96,8 @@ def integrand(erec): return sigma_w_erec(w, erec, v, mw, sigma_nucleon, interaction, m_med) return quad(integrand, - erec_bound(-1, w, v, mw), - erec_bound(+1, w, v, mw), + erec_bound(-1, w, v, mw, material=material), + erec_bound(+1, w, v, mw, material=material), **kwargs)[0] @@ -103,6 +105,7 @@ def integrand(erec): @wr.vectorize_first def rate_bremsstrahlung(w, mw, sigma_nucleon, interaction='SI', m_med=float('inf'), t=None, + material='Xe', halo_model=None, **kwargs): """Differential rate per unit detector mass and recoil energy of Bremsstrahlung elastic WIMP-nucleus scattering. @@ -124,13 +127,16 @@ def rate_bremsstrahlung(w, mw, sigma_nucleon, interaction='SI', (e.g. error tolerance). """ halo_model = wr.StandardHaloModel() if halo_model is None else halo_model - vmin = vmin_w(w, mw) + vmin = vmin_w(w, mw, material) if vmin >= wr.v_max(t, halo_model.v_esc): return 0 def integrand(v): - return (sigma_w(w, v, mw, sigma_nucleon, interaction, m_med) * + return (sigma_w(w, v, mw, sigma_nucleon, + interaction=interaction, + m_med=m_med, + material=material) * v * halo_model.velocity_dist(v, t)) return halo_model.rho_dm / mw * (1 / wr.mn()) * quad( From 7806b19f9926e22fb2cb8a3ef05bebcdf7f2176a Mon Sep 17 00:00:00 2001 From: Joran Angevaare Date: Wed, 17 Aug 2022 13:25:46 +0200 Subject: [PATCH 14/15] reduce the right one --- notebooks/Checks, plots.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/Checks, plots.ipynb b/notebooks/Checks, plots.ipynb index b3ee16f..46b8e9f 100644 --- a/notebooks/Checks, plots.ipynb +++ b/notebooks/Checks, plots.ipynb @@ -405,7 +405,7 @@ "\n", "es = np.logspace(-2, 3.5, 100)\n", "# Reduce the number a bit to get the results quicker\n", - "ms = mchi[::5]\n", + "mchi = mchi[::5]\n", "ms = mchi / gevcsq\n", "rates = []\n", "rates_bs = []\n", From a00aa2aebc06df888ef3a7f05fe4fdb78dca3f86 Mon Sep 17 00:00:00 2001 From: "Joran R. Angevaare" Date: Wed, 17 Aug 2022 13:35:51 +0200 Subject: [PATCH 15/15] Update pytest.yml --- .github/workflows/pytest.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c53f077..1d6d69c 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -45,14 +45,12 @@ jobs: if: matrix.test == 'pytest' run: pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage -# coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: NUMBA_DISABLE_JIT: 1 if: matrix.test == 'coveralls' run: pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage -# coverage run --source=wimprates -m pytest -v --nbmake -n=auto notebooks/*.ipynb --durations 0 - name: Coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}