Skip to content

Commit

Permalink
commit docs dev version
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 29, 2024
1 parent 7117f9b commit 44ea8b6
Show file tree
Hide file tree
Showing 1,140 changed files with 6,056 additions and 2,225 deletions.
2 changes: 1 addition & 1 deletion docs/dev/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 279c2a4860a6fd15fbc7251e29429d21
config: 3875ff32a449deddace46e69c7c93246
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified docs/dev/.doctrees/api/gammapy.data.Observation.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/api/gammapy.estimators.FluxMetaData.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/api/gammapy.irf.FoVAlignment.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/dev/.doctrees/index.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/sg_execution_times.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-1d/cta_sensitivity.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-1d/ebl.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-1d/sed_fitting.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-2d/detect.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-2d/modeling_2D.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-2d/ring_background.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-3d/analysis_3d.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-3d/analysis_mwl.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-3d/event_sampling.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-3d/flux_profiles.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-3d/simulate_3d.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/analysis-time/light_curve.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/astro_dark_matter.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/catalog.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/datasets.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/estimators.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/fitting.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/irfs.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/makers.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/maps.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/mask_maps.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/model_management.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/models.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/observation_clustering.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/priors.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/api/sg_execution_times.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/data/cta.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/data/fermi_lat.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/data/hawc.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/data/hess.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/data/sg_execution_times.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/scripts/sg_execution_times.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/starting/analysis_1.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/starting/analysis_2.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/starting/overview.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/tutorials/starting/sg_execution_times.doctree
Binary file not shown.
Binary file modified docs/dev/.doctrees/user-guide/howto.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/06ba2363ac6d8e23d2098c691bbc6e58/priors.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/1370bd9099a95d65461f2a665bb9decd/catalog.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified docs/dev/_downloads/21c6356dca773bb211972068bdd8edac/irfs.zip
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
)
from gammapy.maps import MapAxis, RegionGeom
from gammapy.modeling.models import PowerLawSpectralModel, SkyModel
from gammapy.modeling import Fit

######################################################################
# Check setup
Expand Down Expand Up @@ -126,9 +127,8 @@
# Define time intervals
# ---------------------
#
# We create the list of time intervals. Each time interval is an
# We create the list of time intervals, each of duration 10 minutes. Each time interval is an
# `astropy.time.Time` object, containing a start and stop time.
#

t0 = Time("2006-07-29T20:30")
duration = 10 * u.min
Expand Down Expand Up @@ -236,26 +236,21 @@


######################################################################
# Define the Model
# ----------------
# Define underlying model
# -----------------------
#
# The actual flux will depend on the spectral shape assumed. For
# simplicity, we use the power law spectral model of index 3.4 used in the
# Since we use forward folding to obtain the flux points in each bin, exact values will depend on the underlying model. In this example, we use a power law as used in the
# `reference
# paper <https://ui.adsabs.harvard.edu/abs/2009A%26A...502..749A/abstract>`__.
#
# Here we use only a spectral model in the
# `~gammapy.modeling.models.SkyModel` object.
# As we have are only using spectral datasets, we do not need any spatial models.
#
# **Note** : All time bins must have the same spectral model. To see how to investigate spectral variability,
# see :doc:`time resolved spectroscopy notebook </tutorials/analysis-time/time_resolved_spectroscopy>`.

spectral_model = PowerLawSpectralModel(
index=3.4, amplitude=2e-11 * u.Unit("1 / (cm2 s TeV)"), reference=1 * u.TeV
)
spectral_model.parameters["index"].frozen = False

spectral_model = PowerLawSpectralModel(amplitude=1e-10 * u.Unit("1 / (cm2 s TeV)"))
sky_model = SkyModel(spatial_model=None, spectral_model=spectral_model, name="pks2155")


######################################################################
# Assign to model to all datasets
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -266,22 +261,30 @@
datasets.models = sky_model


# %%time
fit = Fit()
result = fit.run(datasets)
print(result.models.to_parameters_table())

######################################################################
# Extract the light curve
# -----------------------
#
# We first create the `~gammapy.estimators.LightCurveEstimator` for the
# list of datasets we just produced. We give the estimator the name of the
# source component to be fitted.
# source component to be fitted. We can directly compute the light curve in multiple energy
# bins by supplying a list of `energy_edges`.
#
# By default the likelihood scan is computed from 0.2 to 5.0.
# Here, we increase the max value to 10.0, because we are
# dealing with a large flare.

lc_maker_1d = LightCurveEstimator(
energy_edges=[0.7, 20] * u.TeV,
energy_edges=[0.7, 1, 20] * u.TeV,
source="pks2155",
time_intervals=time_intervals,
selection_optional="all",
n_jobs=4,
)
lc_maker_1d.norm.scan_max = 10

Expand All @@ -301,21 +304,37 @@
# Finally we plot the result for the 1D lightcurve:
#
plt.figure(figsize=(8, 6))
lc_1d.plot(marker="o")
plt.tight_layout()
plt.subplots_adjust(bottom=0.3)
lc_1d.plot(marker="o", axis_name="time", sed_type="flux")
plt.show()


######################################################################
# Light curves once obtained can be rebinned.
# Here, we rebin 4 adjacent bins together, to get 30 min bins
# Light curves once obtained can be rebinned using the likelihood profiles.
# Here, we rebin 3 adjacent bins together, to get 30 minute bins.
#
# We will first slice `lc_1d` to obtain the lightcurve in the first energy bin
#

axis_new = get_rebinned_axis(lc_1d, method="fixed-bins", group_size=3, axis_name="time")
slices = {"energy": slice(0, 1)}
sliced_lc = lc_1d.slice_by_idx(slices)
print(sliced_lc)

axis_new = get_rebinned_axis(
sliced_lc, method="fixed-bins", group_size=3, axis_name="time"
)
print(axis_new)

lc_new = lc_1d.resample_axis(axis_new)
lc_new = sliced_lc.resample_axis(axis_new)
plt.figure(figsize=(8, 6))
ax = lc_1d.plot(label="original")
plt.tight_layout()
plt.subplots_adjust(bottom=0.3)
ax = sliced_lc.plot(label="original")
lc_new.plot(ax=ax, label="rebinned")
plt.legend()
plt.show()
plt.show()

#####################################################################
# We can use the sliced lightcurve to understand the variability,
# as shown in the doc:`/tutorials/analysis-time/variability_estimation` tutorial.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@
},
"outputs": [],
"source": [
"fp_estimator.norm.scan_min = 0.1\nfp_estimator.norm.scan_max = 3"
"fp_estimator.norm.scan_min = 0.1\nfp_estimator.norm.scan_max = 10"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note: The default scan range of the norm parameter is between 0.1 to 10. In case the upper\nlimit values lie outside this range, nan values will be returned. It may thus be useful to\nincrease this range, specially for the computation of upper limits from weak sources.\n\nThe various quantities utilised in this tutorial are described here:\n\n- ``source``: which source from the model to compute the flux points for\n- ``energy_edges``: edges of the flux points energy bins\n- ``n_sigma``: number of sigma for the flux error\n- ``n_sigma_ul``: the number of sigma for the flux upper limits\n- ``selection_optional``: what additional maps to compute\n- ``fit``: the fit instance (as defined above)\n- ``reoptimize``: whether to reoptimize the flux points with other model parameters, aside from the ``norm``\n- ``norm``: normalisation parameter for the fit\n\n**Important note**: the output ``energy_edges`` are taken from the parent dataset energy bins,\nselecting the bins closest to the requested ``energy_edges``. To match the input bins directly,\nspecific binning must be defined based on the parent dataset geometry. This could be done in the following way:\n`energy_edges = datasets[0].geoms[\"geom\"].axes[\"energy\"].downsample(factor=5).edges`\n\n\n"
"Note: The default scan range of the norm parameter is between 0.2 to 5. In case the upper\nlimit values lie outside this range, nan values will be returned. It may thus be useful to\nincrease this range, specially for the computation of upper limits from weak sources.\n\nThe various quantities utilised in this tutorial are described here:\n\n- ``source``: which source from the model to compute the flux points for\n- ``energy_edges``: edges of the flux points energy bins\n- ``n_sigma``: number of sigma for the flux error\n- ``n_sigma_ul``: the number of sigma for the flux upper limits\n- ``selection_optional``: what additional maps to compute\n- ``fit``: the fit instance (as defined above)\n- ``reoptimize``: whether to reoptimize the flux points with other model parameters, aside from the ``norm``\n- ``norm``: normalisation parameter for the fit\n\n**Important note**: the output ``energy_edges`` are taken from the parent dataset energy bins,\nselecting the bins closest to the requested ``energy_edges``. To match the input bins directly,\nspecific binning must be defined based on the parent dataset geometry. This could be done in the following way:\n`energy_edges = datasets[0].geoms[\"geom\"].axes[\"energy\"].downsample(factor=5).edges`\n\n\n"
]
},
{
Expand Down
Binary file modified docs/dev/_downloads/277e8d586c77a3ac9f6ad21ecdfc3485/detect.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/3887251ea091cf5a495cbd0984520eec/hawc.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/3edea76cb3aefe6dfce230edb07b24e2/models.zip
Binary file not shown.
Binary file modified docs/dev/_downloads/408398be7d2e8fce69b0c175dfb7db6c/hess.zip
Binary file not shown.
Binary file modified docs/dev/_downloads/42884adaf5dec1438e6da837d7acfad0/cta.zip
Binary file not shown.
Binary file modified docs/dev/_downloads/432ee3a608125ae95df2e8d950f07716/dl3-1.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/4722787c7fa105f0833ba203665f472d/maps.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@

######################################################################
# To get an idea of the size of the PSF we check how the containment radii
# of the Fermi-LAT PSF vari with energy and different containment
# of the Fermi-LAT PSF vary with energy and different containment
# fractions:
#

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
# %%
# This is how for analysis you could slice out the PSF
# at a given field of view offset
plt.figure(figsize=(8, 5))
irfs["psf"].plot_containment_radius_vs_energy(
offset=[1] * u.deg, fraction=[0.68, 0.8, 0.95]
)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"outputs": [],
"source": [
"import logging\n\n# %matplotlib inline\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord\nfrom regions import CircleSkyRegion\nimport matplotlib.pyplot as plt\nfrom gammapy.analysis import Analysis, AnalysisConfig\nfrom gammapy.datasets import MapDatasetOnOff\nfrom gammapy.estimators import ExcessMapEstimator\nfrom gammapy.makers import RingBackgroundMaker\nfrom gammapy.visualization import plot_distribution\nfrom gammapy.utils.check import check_tutorials_setup\nlog = logging.getLogger(__name__)"
"import logging\n\n# %matplotlib inline\nimport astropy.units as u\nfrom astropy.coordinates import SkyCoord\nfrom regions import CircleSkyRegion\nimport matplotlib.pyplot as plt\nfrom gammapy.analysis import Analysis, AnalysisConfig\nfrom gammapy.datasets import MapDatasetOnOff\nfrom gammapy.estimators import ExcessMapEstimator\nfrom gammapy.makers import RingBackgroundMaker\nfrom gammapy.visualization import plot_distribution\nfrom gammapy.utils.check import check_tutorials_setup\n\nlog = logging.getLogger(__name__)"
]
},
{
Expand Down Expand Up @@ -58,7 +58,7 @@
},
"outputs": [],
"source": [
"# source_pos = SkyCoord.from_name(\"MSH 15-52\")\nsource_pos = SkyCoord(228.32, -59.08, unit=\"deg\")\n\nconfig = AnalysisConfig()\n# Select observations - 2.5 degrees from the source position\nconfig.observations.datastore = \"$GAMMAPY_DATA/hess-dl3-dr1/\"\nconfig.observations.obs_cone = {\n \"frame\": \"icrs\",\n \"lon\": source_pos.ra,\n \"lat\": source_pos.dec,\n \"radius\": 2.5 * u.deg,\n}\n\nconfig.datasets.type = \"3d\"\nconfig.datasets.geom.wcs.skydir = {\n \"lon\": source_pos.ra,\n \"lat\": source_pos.dec,\n \"frame\": \"icrs\",\n} # The WCS geometry - centered on MSH 15-52\nconfig.datasets.geom.wcs.width = {\"width\": \"3 deg\", \"height\": \"3 deg\"}\nconfig.datasets.geom.wcs.binsize = \"0.02 deg\"\n\n# Cutout size (for the run-wise event selection)\nconfig.datasets.geom.selection.offset_max = 3.5 * u.deg\n\n# We now fix the energy axis for the counts map - (the reconstructed energy binning)\nconfig.datasets.geom.axes.energy.min = \"0.5 TeV\"\nconfig.datasets.geom.axes.energy.max = \"5 TeV\"\nconfig.datasets.geom.axes.energy.nbins = 10\n\n# We need to extract the ring for each observation separately, hence, no stacking at this stage\nconfig.datasets.stack = False\n\nprint(config)"
"# source_pos = SkyCoord.from_name(\"MSH 15-52\")\nsource_pos = SkyCoord(228.32, -59.08, unit=\"deg\")\n\nconfig = AnalysisConfig()\n# Select observations - 2.5 degrees from the source position\nconfig.observations.datastore = \"$GAMMAPY_DATA/hess-dl3-dr1/\"\nconfig.observations.obs_cone = {\n \"frame\": \"icrs\",\n \"lon\": source_pos.ra,\n \"lat\": source_pos.dec,\n \"radius\": 2.5 * u.deg,\n}\n\nconfig.datasets.type = \"3d\"\nconfig.datasets.geom.wcs.skydir = {\n \"lon\": source_pos.ra,\n \"lat\": source_pos.dec,\n \"frame\": \"icrs\",\n} # The WCS geometry - centered on MSH 15-52\nconfig.datasets.geom.wcs.width = {\"width\": \"3 deg\", \"height\": \"3 deg\"}\nconfig.datasets.geom.wcs.binsize = \"0.02 deg\"\n\n# Cutout size (for the run-wise event selection)\nconfig.datasets.geom.selection.offset_max = 2.5 * u.deg\n\n# We now fix the energy axis for the counts map - (the reconstructed energy binning)\nconfig.datasets.geom.axes.energy.min = \"0.5 TeV\"\nconfig.datasets.geom.axes.energy.max = \"10 TeV\"\nconfig.datasets.geom.axes.energy.nbins = 10\n\n# We need to extract the ring for each observation separately, hence, no stacking at this stage\nconfig.datasets.stack = False\n\nprint(config)"
]
},
{
Expand Down Expand Up @@ -126,7 +126,7 @@
},
"outputs": [],
"source": [
"# get the geom that we use\ngeom = analysis.datasets[0].counts.geom\nenergy_axis = analysis.datasets[0].counts.geom.axes[\"energy\"]\ngeom_image = geom.to_image().to_cube([energy_axis.squash()])\n\n# Make the exclusion mask\nregions = CircleSkyRegion(center=source_pos, radius=0.3 * u.deg)\nexclusion_mask = ~geom_image.region_mask([regions])\nexclusion_mask.sum_over_axes().plot()\nplt.show()"
"# get the geom that we use\ngeom = analysis.datasets[0].counts.geom\nenergy_axis = analysis.datasets[0].counts.geom.axes[\"energy\"]\ngeom_image = geom.to_image().to_cube([energy_axis.squash()])\n\n# Make the exclusion mask\nregions = CircleSkyRegion(center=source_pos, radius=0.4 * u.deg)\nexclusion_mask = ~geom_image.region_mask([regions])\nexclusion_mask.sum_over_axes().plot()\nplt.show()"
]
},
{
Expand Down Expand Up @@ -162,7 +162,18 @@
},
"outputs": [],
"source": [
"energy_axis_true = analysis.datasets[0].exposure.geom.axes[\"energy_true\"]\nstacked_on_off = MapDatasetOnOff.create(\n geom=geom_image, energy_axis_true=energy_axis_true, name=\"stacked\"\n)\n\nfor dataset in analysis.datasets:\n # Ring extracting makes sense only for 2D analysis\n dataset_on_off = ring_maker.run(dataset.to_image())\n stacked_on_off.stack(dataset_on_off)"
"energy_axis_true = analysis.datasets[0].exposure.geom.axes[\"energy_true\"]\nstacked_on_off = MapDatasetOnOff.create(\n geom=geom_image, energy_axis_true=energy_axis_true, name=\"stacked\"\n)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"for dataset in analysis.datasets:\n # Ring extracting makes sense only for 2D analysis\n dataset_on_off = ring_maker.run(dataset.to_image())\n stacked_on_off.stack(dataset_on_off)"
]
},
{
Expand All @@ -187,7 +198,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Compute correlated significance and correlated excess maps\n\nWe need to convolve our maps with an appropriate smoothing kernel. The\nsignificance is computed according to the Li & Ma expression for ON and\nOFF Poisson measurements, see\n[here](https://ui.adsabs.harvard.edu/abs/1983ApJ...272..317L/abstract)_.\nSince astropy convolution kernels only accept integers, we first convert\nour required size in degrees to int depending on our pixel size.\n\n\n"
"## Compute correlated significance and correlated excess maps\n\nWe need to convolve our maps with an appropriate smoothing kernel. The\nsignificance is computed according to the Li & Ma expression for ON and\nOFF Poisson measurements, see\n[here](https://ui.adsabs.harvard.edu/abs/1983ApJ...272..317L/abstract)_.\n\n\nAlso, since the off counts are obtained with a ring background estimation, and are thus already correlated, we specify `correlate_off=False`\nto avoid over correlation.\n\n"
]
},
{
Expand All @@ -198,14 +209,14 @@
},
"outputs": [],
"source": [
"# Using a convolution radius of 0.04 degrees\nestimator = ExcessMapEstimator(0.04 * u.deg, selection_optional=[])\nlima_maps = estimator.run(stacked_on_off)\n\nsignificance_map = lima_maps[\"sqrt_ts\"]\nexcess_map = lima_maps[\"npred_excess\"]\n\n# We can plot the excess and significance maps\nfig, (ax1, ax2) = plt.subplots(\n figsize=(11, 4), subplot_kw={\"projection\": lima_maps.geom.wcs}, ncols=2\n)\n\nax1.set_title(\"Significance map\")\nsignificance_map.plot(ax=ax1, add_cbar=True)\n\nax2.set_title(\"Excess map\")\nexcess_map.plot(ax=ax2, add_cbar=True)\nplt.show()"
"# Using a convolution radius of 0.04 degrees\nestimator = ExcessMapEstimator(0.04 * u.deg, selection_optional=[], correlate_off=False)\nlima_maps = estimator.run(stacked_on_off)\n\nsignificance_map = lima_maps[\"sqrt_ts\"]\nexcess_map = lima_maps[\"npred_excess\"]\n\n# We can plot the excess and significance maps\nfig, (ax1, ax2) = plt.subplots(\n figsize=(11, 4), subplot_kw={\"projection\": lima_maps.geom.wcs}, ncols=2\n)\nax1.set_title(\"Significance map\")\nsignificance_map.plot(ax=ax1, add_cbar=True)\nax2.set_title(\"Excess map\")\nexcess_map.plot(ax=ax2, add_cbar=True)\nplt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It is often important to look at the significance distribution outside\nthe exclusion region to check that the background estimation is not\ncontaminated by gamma-ray events. This can be the case when exclusion\nregions are not large enough. Typically, we expect the off distribution\nto be a standard normal distribution.\n\n\n"
"It is often important to look at the significance distribution outside\nthe exclusion region to check that the background estimation is not\ncontaminated by gamma-ray events. This can be the case when exclusion\nregions are not large enough. Typically, we expect the off distribution\nto be a standard normal distribution. To compute the significance distribution outside the exclusion region,\nwe can recompute the maps after adding a `mask_fit` to our dataset.\n\n\n"
]
},
{
Expand All @@ -216,7 +227,7 @@
},
"outputs": [],
"source": [
"# create a 2D mask for the images\nsignificance_map_off = significance_map * exclusion_mask\n\nkwargs_axes = {\"xlabel\": \"Significance\", \"yscale\": \"log\", \"ylim\": (1e-5, 1)}\n\nax, _ = plot_distribution(\n significance_map,\n kwargs_hist={\n \"density\": True,\n \"alpha\": 0.5,\n \"color\": \"red\",\n \"label\": \"all bins\",\n \"bins\": 21,\n },\n kwargs_axes=kwargs_axes,\n)\n\nax, res = plot_distribution(\n significance_map_off,\n ax=ax,\n func=\"norm\",\n kwargs_hist={\n \"density\": True,\n \"alpha\": 0.5,\n \"color\": \"blue\",\n \"label\": \"off bins\",\n \"bins\": 21,\n },\n kwargs_axes=kwargs_axes,\n)\n\nplt.show()\n\n# sphinx_gallery_thumbnail_number = 2"
"# Mask the regions with gamma-ray emission\nstacked_on_off.mask_fit = exclusion_mask\nlima_maps2 = estimator.run(stacked_on_off)\nsignificance_map_off = lima_maps2[\"sqrt_ts\"]\n\n\n# region\nkwargs_axes = {\"xlabel\": \"Significance\", \"yscale\": \"log\", \"ylim\": (1e-3, 1)}\nax, _ = plot_distribution(\n significance_map,\n kwargs_hist={\n \"density\": True,\n \"alpha\": 0.5,\n \"color\": \"red\",\n \"label\": \"all bins\",\n \"bins\": 51,\n },\n kwargs_axes=kwargs_axes,\n)\n\nax, res = plot_distribution(\n significance_map_off,\n ax=ax,\n func=\"norm\",\n kwargs_hist={\n \"density\": True,\n \"alpha\": 0.5,\n \"color\": \"blue\",\n \"label\": \"off bins\",\n \"bins\": 51,\n },\n kwargs_axes=kwargs_axes,\n)\n\nplt.show()\n# endregion\n\n# sphinx_gallery_thumbnail_number = 2"
]
}
],
Expand Down
Binary file not shown.
Binary file modified docs/dev/_downloads/84424d59ec624940199b69d87a792d50/index-1.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified docs/dev/_downloads/920df746e67257657f5d44e868b95ff9/fitting.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To get an idea of the size of the PSF we check how the containment radii\nof the Fermi-LAT PSF vari with energy and different containment\nfractions:\n\n\n"
"To get an idea of the size of the PSF we check how the containment radii\nof the Fermi-LAT PSF vary with energy and different containment\nfractions:\n\n\n"
]
},
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@
#

fp_estimator.norm.scan_min = 0.1
fp_estimator.norm.scan_max = 3
fp_estimator.norm.scan_max = 10

######################################################################
# Note: The default scan range of the norm parameter is between 0.1 to 10. In case the upper
# Note: The default scan range of the norm parameter is between 0.2 to 5. In case the upper
# limit values lie outside this range, nan values will be returned. It may thus be useful to
# increase this range, specially for the computation of upper limits from weak sources.
#
Expand Down
Binary file not shown.
Loading

0 comments on commit 44ea8b6

Please sign in to comment.