ArrayDisplay#
- class ctapipe.visualization.ArrayDisplay(subarray, axes=None, autoupdate=True, tel_scale=2.0, alpha=0.7, title=None, radius=None, frame=<GroundFrame Frame (reference_location=None)>)[source]#
Bases:
object
Display a top-town view of a telescope array.
This can be used in two ways: by default, you get a display of all telescopes in the subarray, colored by telescope type, however you can also color the telescopes by a value (like trigger pattern, or some other scalar per-telescope parameter). To set the color value, simply set the
value
attribute, and the fill color will be updated with the value. You might want to set the border color to zero to avoid confusion between the telescope type color and the value color (array_disp.telescope.set_linewidth(0)
)To display a vector field over the telescope positions, e.g. for reconstruction, call
set_vector_uv()
to set cartesian vectors, orset_vector_rho_phi()
to set polar coordinate vectors. These both take an array of length N_tels, or a single value.- Parameters:
- subarray: ctapipe.instrument.SubarrayDescription
the array layout to display
- axes: matplotlib.axes.Axes
matplotlib axes to plot on, or None to use current one
- title: str
title of array plot
- tel_scale: float
scaling between telescope mirror radius in m to displayed size
- autoupdate: bool
redraw when the input changes
- radius: Union[float, list, None]
set telescope radius to value, list/array of values. If None, radius is taken from the telescope’s mirror size.
Attributes Summary
An array containing a value per telescope
Methods Summary
add_radial_grid
([spacing])add some dotted rings for distance estimation.
background_contour
(x, y, background, **kwargs)Draw image contours in background of the display, useful when likelihood fitting
set_line_hillas
(hillas_dict, core_dict, ...)Plot the telescope-wise direction of the shower as a segment.
set_vector_hillas
(hillas_dict, core_dict, ...)Function to set the vector angle and length from a set of Hillas parameters.
set_vector_rho_phi
(rho, phi[, c])sets the vector field using R, Phi for each telescope
set_vector_uv
(uu, vv[, c])sets the vector field U,V and color for all telescopes
Attributes Documentation
- values#
An array containing a value per telescope
Methods Documentation
- add_radial_grid(spacing=<Quantity 100. m>)[source]#
add some dotted rings for distance estimation. The number of rings is estimated automatically from the spacing and the array footprint.
- Parameters:
- spacing: Quantity
spacing between rings
- background_contour(x, y, background, **kwargs)[source]#
Draw image contours in background of the display, useful when likelihood fitting
- Parameters:
- x: ndarray
array of image X coordinates
- y: ndarray
array of image Y coordinates
- background: ndarray
Array of image to use in background
- kwargs: key=value
any style keywords to pass to matplotlib
- set_line_hillas(hillas_dict, core_dict, range, **kwargs)[source]#
Plot the telescope-wise direction of the shower as a segment.
Each segment will be centered with a point on the telescope position and will be 2*range long.
- Parameters:
- hillas_dict: Dict[int, HillasParametersContainer]
mapping of tel_id to Hillas parameters
- core_dictDict[int, CoreParameters]
mapping of tel_id to CoreParametersContainer
- range: float
half of the length of the segments to be plotted (in meters)
- set_vector_hillas(hillas_dict, core_dict, length, time_gradient, angle_offset)[source]#
Function to set the vector angle and length from a set of Hillas parameters.
In order to proper use the arrow on the ground, also a dictionary with the time gradients for the different telescopes is needed. If the gradient is 0 the arrow is not plotted on the ground, whereas if the value of the gradient is negative, the arrow is rotated by 180 degrees (Angle(angle_offset) not added).
This plotting behaviour has been tested with the timing_parameters function in ctapipe/image.
- Parameters:
- hillas_dict: Dict[int, HillasParametersContainer]
mapping of tel_id to Hillas parameters
- core_dictDict[int, CoreParameters]
mapping of tel_id to CoreParametersContainer
- length: Float
length of the arrow (in meters)
- time_gradient: Dict[int, value of time gradient (no units)]
dictionary for value of the time gradient for each telescope
- angle_offset: Float
This should be the
event.pointing.array_azimuth
parameter
- set_vector_rho_phi(rho, phi, c=None, **kwargs)[source]#
sets the vector field using R, Phi for each telescope
- Parameters:
- rho: float or array[float]
vector magnitude for each telescope
- phi: array[Angle]
vector angle for each telescope
- c: color or list of colors
vector color for each telescope (or one for all)
- set_vector_uv(uu, vv, c=None, **kwargs)[source]#
sets the vector field U,V and color for all telescopes
- Parameters:
- uu: array[n_tels]
x-component of direction vector
- vv: array[n_tels]
y-component of direction vector
- c: color or list of colors
vector color for each telescope (or one for all)
- kwargs:
extra args passed to plt.quiver(), ignored on subsequent updates