SkyDisk

class gammapy.image.models.SkyDisk(lon_0, lat_0, r_0, edge='0.01 deg', frame='galactic')[source]

Bases: gammapy.image.models.SkySpatialModel

Constant radial disk model.

\[\begin{split}\phi(lon, lat) = \frac{1}{2 \pi (1 - \cos{r_0}) } \cdot \begin{cases} 1 & \text{for } \theta \leq r_0 \\ 0 & \text{for } \theta > r_0 \end{cases}\end{split}\]

where \(\theta\) is the sky separation. To improve fit convergence of the model, the sharp edges is smoothed using erf.

Parameters:
lon_0 : Longitude

\(lon_0\)

lat_0 : Latitude

\(lat_0\)

r_0 : Angle

\(r_0\)

edge : Angle

Width of the edge. The width is defined as the range within the smooth edges of the model drops from 95% to 5% of its amplitude (see illustration below).

frame : {“galactic”, “icrs”}

Coordinate frame of lon_0 and lat_0.

Examples

Here is an illustration of the definition of the edge parameter:

import matplotlib.pyplot as plt
from astropy import units as u
from gammapy.image.models import SkyDisk

lons = np.linspace(0, 0.3, 500) * u.deg

r_0 = 0.2 * u.deg
edge = 0.1 * u.deg

disk = SkyDisk(lon_0="0 deg", lat_0="0 deg", r_0=r_0, edge=edge)
profile = disk(lons, 0 * u.deg)
plt.plot(lons, profile / profile.max(), alpha=0.5)
plt.xlabel("Radius (deg)")
plt.ylabel("Profile (A.U.)")

edge_min, edge_max = (r_0 - edge / 2.).value, (r_0 + edge / 2.).value
plt.vlines([edge_min, edge_max], 0, 1, linestyles=["--"])
plt.annotate("", xy=(edge_min, 0.5), xytext=(edge_min + edge.value, 0.5),
             arrowprops=dict(arrowstyle="<->", lw=2))
plt.text(0.2, 0.52, "Edge width", ha="center", size=12)
plt.hlines([0.95], edge_min - 0.02, edge_min + 0.02, linestyles=["-"])
plt.text(edge_min + 0.02, 0.95, "95%", size=12, va="center")
plt.hlines([0.05], edge_max - 0.02, edge_max + 0.02, linestyles=["-"])
plt.text(edge_max - 0.02, 0.05, "5%", size=12, va="center", ha="right")
plt.show()

(png, hires.png, pdf)

../_images/gammapy-image-models-SkyDisk-1.png

Attributes Summary

evaluation_radius Returns the effective radius of the sky region where the model evaluates to non-zero.
frame
lat_0
lon_0
parameters Parameters (Parameters)
position Spatial model center position
r_0

Methods Summary

__call__(self, lon, lat) Call evaluate method
copy(self) A deep copy.
evaluate(lon, lat, lon_0, lat_0, r_0, edge) Evaluate the model (static function).

Attributes Documentation

evaluation_radius

Returns the effective radius of the sky region where the model evaluates to non-zero. For a Disk source, we fix it to \(r_0\).

Returns:
radius : Angle

Radius in angular units

frame
lat_0
lon_0
parameters

Parameters (Parameters)

position

Spatial model center position

r_0

Methods Documentation

__call__(self, lon, lat)

Call evaluate method

copy(self)

A deep copy.

static evaluate(lon, lat, lon_0, lat_0, r_0, edge)[source]

Evaluate the model (static function).