Skip to content

Commit

Permalink
update legends and labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Joran Angevaare committed Oct 24, 2022
1 parent 70f02ab commit 54dc8b9
Show file tree
Hide file tree
Showing 15 changed files with 262 additions and 173 deletions.
Binary file modified figures/LZ_combined_efficiency.pdf
Binary file not shown.
Binary file modified figures/LZ_combined_efficiency.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/limit_setting.pdf
Binary file not shown.
Binary file modified figures/limit_setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/recoil_rates.pdf
Binary file not shown.
Binary file modified figures/recoil_rates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/rot_curve_mw.pdf
Binary file not shown.
Binary file modified figures/velocities.pdf
Binary file not shown.
Binary file modified figures/velocities.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions notebooks/Rotation_curve_m33.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"cell_type": "code",
"execution_count": 1,
"id": "6ddfb2f5",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"import thesis_plots\n",
Expand All @@ -15,7 +19,11 @@
"cell_type": "code",
"execution_count": 2,
"id": "fe455ba3",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# thesis_plots.setup_plt()"
Expand All @@ -25,7 +33,11 @@
"cell_type": "code",
"execution_count": 3,
"id": "6f0fa6f0",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -77,4 +89,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
20 changes: 16 additions & 4 deletions notebooks/density_profile.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"cell_type": "code",
"execution_count": 1,
"id": "6f640aa5",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"import thesis_plots\n",
Expand All @@ -15,7 +19,11 @@
"cell_type": "code",
"execution_count": 2,
"id": "5dbe967d",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stderr",
Expand Down Expand Up @@ -46,7 +54,11 @@
"cell_type": "code",
"execution_count": null,
"id": "a1f13c08",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": []
}
Expand All @@ -72,4 +84,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
131 changes: 108 additions & 23 deletions notebooks/limits-step_by_step_example.ipynb

Large diffs are not rendered by default.

100 changes: 68 additions & 32 deletions notebooks/limits.ipynb

Large diffs are not rendered by default.

130 changes: 28 additions & 102 deletions notebooks/recoil_spectra.ipynb

Large diffs are not rendered by default.

34 changes: 26 additions & 8 deletions thesis_plots/recoil_rates/recoil_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import matplotlib.pyplot as plt
import numericalunits as nu
import numpy as np
import scipy.interpolate as itp

import wimprates
from wimprates import StandardHaloModel, v_earth
Expand Down Expand Up @@ -54,7 +55,9 @@ class RecoilRatesPlot:
sigma_nucleon = 1e-47
mws = np.array([5, 10, 20, 50, 100, 200])
targets = ('Si', 'Ar', 'Ge', 'Xe')
color_map = 'viridis_r'
shm_defaults = dict(v_0=238 * _kms, v_esc=544 * _kms)
arrow_kwargs = dict(lw=2.5, head_width=0.5, head_length=10, length_includes_head=True, fc='k', ec='k')
color_map = 'cividis_r'
_subplot_opts = dict(
left=0.05, # the left side of the subplots of the figure
right=0.95, # the right side of the subplots of the figure
Expand Down Expand Up @@ -90,7 +93,7 @@ def plot_recoil_rates(self, targets=None):
targets = self.targets
fig = plt.figure(**self._figure_settings)
plt.subplots_adjust(**self._subplot_opts)
shm = StandardHaloModel(v_0=238 * _kms, v_esc=524 * _kms)
shm = StandardHaloModel(**self.shm_defaults)
layout = """"""
legend_key = 'l'
assert len(targets) >= 1, f"should have at least one target, got {targets}"
Expand Down Expand Up @@ -155,11 +158,13 @@ def plot_recoil_rates(self, targets=None):
rotation='vertical',
fontsize=plt.rcParams.get('axes.labelsize'),
)
axes[target_keys[-1]].set_xlabel(mathrm('E_{nr} [keV_{nr}]'))
axes[target_keys[-1]].set_xlabel('$E_\mathrm{nr}$ ' + mathrm('[keV_{nr}]'))

def plot_velocities(self,
targets=None,
vs=np.linspace(0, 850 * _kms, 1_000)
vs=np.linspace(0, 850 * _kms, 1_000),
es=np.linspace(0, 5, 100),
annotate_mw_enr = (10, 1),
):
if targets is None:
targets = self.targets
Expand All @@ -181,14 +186,14 @@ def plot_velocities(self,
n_target = len(targets)
target_keys = string.ascii_uppercase[1:n_target + 1]
self._join_x_axes(axes, string.ascii_uppercase[:n_target + 1])
es = np.linspace(0, 5, 100)


new = vel_dist(vs, v_0=238, v_esc=544)
plt.sca(axes['A'])
axes['A'].xaxis.set_ticks_position('both')

plt.plot(vs / _kms, vel_dist(vs, v_0=220, v_esc=544), label=mathrm('Old'), color='b', marker='')
labeled_vline(544+v_earth()/_kms, '$v_\mathrm{esc}+v_\mathrm{Earth}$', 0.0005, color='b', ls='--', textoffset=0)
labeled_vline(544+v_earth()/_kms, '$v_\mathrm{esc}+v_{e}$', 0.0005, color='b', ls='--', textoffset=0)
plt.plot(vs / _kms, new, label=mathrm('New'), color='g', marker='')

plt.fill_between(
Expand All @@ -198,7 +203,7 @@ def plot_velocities(self,
color='g',
alpha=0.5,
)
labeled_vline(528+v_earth()/_kms, '$v_\mathrm{esc}+v_\mathrm{Earth}$', 0.0005, color='g', ls='--', text_kwargs=dict(ha='left'),
labeled_vline(528+v_earth()/_kms, '$v_\mathrm{esc}+v_{e}$', 0.0005, color='g', ls='--', text_kwargs=dict(ha='left'),
textoffset=-30)
plt.axvspan(528 - 25+v_earth()/_kms, 528 + 24+v_earth()/_kms, alpha=0.2, color='g')
plt.fill_between(
Expand All @@ -218,13 +223,25 @@ def plot_velocities(self,
for mw in self.mws:
xs = wimprates.vmin_elastic(es * 1000 * nu.eV, mw * nu.GeV / nu.c0 ** 2, label) / _kms
plt.plot(xs, es, c=getattr(plt.cm, self.color_map)(norm(mw)), marker='', )
if mw == annotate_mw_enr[0]:
e_annotate = annotate_mw_enr[1] # kevrn
start_arrow = itp.interp1d(es, xs)(e_annotate)

end_arrow = 528+v_earth()/_kms
plt.axvline(end_arrow, ls='--', c='green')
plt.arrow(start_arrow,
e_annotate,
end_arrow - start_arrow,
0,
**self.arrow_kwargs)

axes[ax].text(s=mathrm(label),
**{**self._text_kwargs, **{'x': 0.94}},
transform=axes[ax].transAxes,
ha='left',
va='top',
)

mpl.colorbar.ColorbarBase(ax=axes[legend_key],
norm=norm,
orientation='vertical',
Expand All @@ -238,12 +255,13 @@ def plot_velocities(self,
# axes[k].set_ylabel(mathrm('E_{nr} [keV]'))
axes[k].set_ylim(es[0], es[-1])
axes[target_keys[-1]].set_xlim(0, vs[-1]/_kms)
axes['A'].set_xlim(0, vs[-1] / _kms)
# Get one ylabel on the position next to the # targets panels. This depends
# on the fig-size where the panel ratios are defined in the fig.subplot_mosaic
l_y = 0.5 * n_target / (2.2 + 1 * n_target)
fig.text(-0.05,
l_y,
mathrm('E_{nr} [keV]'),
'$E_\mathrm{nr}$ ' + mathrm('[keV_{nr}]'),
va='center',
rotation='vertical',
fontsize=plt.rcParams.get('axes.labelsize'),
Expand Down

0 comments on commit 54dc8b9

Please sign in to comment.