# ArrayDisplay¶

class ctapipe.visualization.ArrayDisplay(subarray, axes=None, autoupdate=True, tel_scale=2.0, alpha=0.7, title=None, radius=None, frame=<GroundFrame Frame>)[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_uv() to set cartesian vectors, or set_r_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

set telescope radius to value, list/array of values. If None, radius is taken from the telescope’s mirror size.

Attributes Summary

 values An array containing a value per telescope

Methods Summary

 background_contour(x, y, background, **kwargs) Draw image contours in background of the display, useful when likelihood fitting set_line_hillas(hillas_dict, range, **kwargs) Function to plot a segment of length 2*range for each telescope from a set of Hillas parameters. set_vector_hillas(hillas_dict, length, …) 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_labels()[source]
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

remove_labels()[source]
set_line_hillas(hillas_dict, range, **kwargs)[source]

Function to plot a segment of length 2*range for each telescope from a set of Hillas parameters. The segment is centered on the telescope position. A point is added at each telescope position for better visualization.

Parameters
hillas_dict: Dict[int, HillasParametersContainer]

mapping of tel_id to Hillas parameters

range: float

half of the length of the segments to be plotted (in meters)

set_vector_hillas(hillas_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

length: Float

length of the arrow (in meters)

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[num_tels]

x-component of direction vector

vv: array[num_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