Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes notebook resolution examples #206

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuousintegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions ctaplot/plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ def plot_impact_point_heatmap(reco_x, reco_y, ax=None, outfile=None, **kwargs):
outfile: string
path to the output file. If None, the figure is not saved.
"""

from matplotlib import colormaps
ax = plt.gca() if ax is None else ax

unit = reco_x.unit

kwargs.setdefault('norm', LogNorm())
kwargs.setdefault('cmap', plt.cm.get_cmap('PuBu'))
kwargs.setdefault('cmap', colormaps['PuBu'])
kwargs.setdefault('bins', 50)
h = ax.hist2d(reco_x.to_value(unit), reco_y.to_value(unit), **kwargs)
cb = plt.colorbar(h[3], ax=ax)
Expand Down
19 changes: 16 additions & 3 deletions examples/notebooks/resolution_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,21 @@
"outputs": [],
"source": [
"fig, axes = plt.subplots(1, 2, figsize=(20,5))\n",
"ctaplot.plot_theta2(reco_alt, reco_az, simu_alt, simu_az, bins=40, ax=axes[0])\n",
"ctaplot.plot_angular_resolution_per_energy(reco_alt, reco_az, simu_alt, simu_az, simu_energy, ax=axes[1]) \n",
"ctaplot.plot_theta2(simu_alt, reco_alt, simu_az, reco_az, bins=40, ax=axes[0])\n",
"ctaplot.plot_angular_resolution_per_energy(simu_alt, reco_alt, simu_az, reco_az, simu_energy, ax=axes[1]) \n",
"ctaplot.plot_angular_resolution_cta_requirement('south', ax=axes[1], color='black')\n",
"axes[1].legend();\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"reco_az, , simu_az, bins=40, ax=axes[0])\n",
"ctaplot.plot_angular_resolution_per_energy(simu_alt, reco_alt, simu_az, reco_az, simu_energy, ax=axes[1]) \n",
"ctaplot.plot_angular_resolution_cta_requirement('south', ax=axes[1], color='black')\n",
"axes[1].legend();\n",
"plt.show()"
Expand Down Expand Up @@ -127,7 +140,7 @@
" bias_correction=True,\n",
" ax=axes[0])\n",
"\n",
"ctaplot.plot_angular_resolution_per_energy(reco_alt, reco_az, simu_alt, simu_az, simu_energy,\n",
"ctaplot.plot_angular_resolution_per_energy(simu_alt, reco_alt, simu_az, reco_az, simu_energy,\n",
" bias_correction=True,\n",
" ax=axes[1])\n",
"\n",
Expand Down
Loading