Note
Click here to download the full example code
Shell Spatial Model¶
This is a spatial model parametrizing a projected radiating shell.
The shell spatial model is defined by the following equations:
\[\begin{split}\phi(lon, lat) = \frac{3}{2 \pi (r_{out}^3 - r_{in}^3)} \cdot
\begin{cases}
\sqrt{r_{out}^2 - \theta^2} - \sqrt{r_{in}^2 - \theta^2} &
\text{for } \theta \lt r_{in} \\
\sqrt{r_{out}^2 - \theta^2} &
\text{for } r_{in} \leq \theta \lt r_{out} \\
0 & \text{for } \theta > r_{out}
\end{cases}\end{split}\]
where \(\theta\) is the sky separation and \(r_{\text{out}} = r_{\text{in}}\) + width
Note that the normalization is a small angle approximation, although that approximation is still very good even for 10 deg radius shells.
Example plot¶
Here is an example plot of the model:
from gammapy.modeling.models import (
Models,
PowerLawSpectralModel,
ShellSpatialModel,
SkyModel,
)
model = ShellSpatialModel(
lon_0="10 deg", lat_0="20 deg", radius="2 deg", width="0.5 deg", frame="galactic",
)
model.plot(add_cbar=True)
Out:
/Users/adonath/github/adonath/astropy/astropy/units/quantity.py:1032: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
out = super().__getitem__(key)
/Users/adonath/github/adonath/astropy/astropy/units/quantity.py:1054: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
self.view(np.ndarray).__setitem__(i, self._to_own_unit(value))
YAML representation¶
Here is an example YAML file using the model:
Out:
components:
- name: pwl-shell-model
type: SkyModel
spectral:
type: PowerLawSpectralModel
parameters:
- {name: index, value: 2.0, unit: '', min: .nan, max: .nan, frozen: false}
- {name: amplitude, value: 1.0e-12, unit: cm-2 s-1 TeV-1, min: .nan, max: .nan,
frozen: false}
- {name: reference, value: 1.0, unit: TeV, min: .nan, max: .nan, frozen: true}
spatial:
type: ShellSpatialModel
frame: icrs
parameters:
- {name: lon_0, value: 0.0, unit: deg, min: .nan, max: .nan, frozen: false}
- {name: lat_0, value: 0.0, unit: deg, min: -90.0, max: 90.0, frozen: false}
- {name: radius, value: 1.0, unit: deg, min: .nan, max: .nan, frozen: false}
- {name: width, value: 0.2, unit: deg, min: .nan, max: .nan, frozen: false}