Visualization#

In this section you find the reference documentation of the modules contained in the visualization module.

visualize#

Module for visualization.

visualization.visualize.get_colors(palette='default')[source]#

Get the colour list of the palette requested.

If no palette is provided, the default is returned.

Parameters:
palette: str

Colour palette.

Returns:
list

Colour list.

Raises:
KeyError

if provided palette does not exist.

visualization.visualize.get_lines()[source]#

Get the line style list used in this module.

Returns:
list

List with line styles.

visualization.visualize.get_markers()[source]#

Get the marker list used in this module.

Returns:
list

List with markers.

visualization.visualize.get_telescope_patch(name, x, y, radius)[source]#

Collect the patch of one telescope to be plotted by plot_array.

Parameters:
name: str

Name of the telescope (type).

x: astropy.units.Quantity

x position of the telescope usually in meters.

y: astropy.units.Quantity

y position of the telescope usually in meters.

radius: astropy.units.Quantity

Radius of the telescope sphere usually in meters.

Returns:
patch

Instance of mpatches.Circle.

visualization.visualize.plot_1d(data, **kwargs)[source]#

Produce a high contrast one dimensional plot from multiple data sets.

A ratio plot can be added at the bottom to allow easy comparison. Additional options, such as plot title, plot legend, etc., are given in kwargs. Any option that can be changed after plotting (e.g., axes limits, log scale, etc.) should be done using the returned plt instance.

Parameters:
data: numpy structured array or a dictionary of structured arrays

Each structured array has two columns, the first is the x-axis and the second the y-axis. The titles of the columns are set as the axes titles. The labels of each dataset set are given in the dictionary keys and will be used in the legend.

**kwargs:
  • palette: string Choose a colour palette (see set_style for additional information).

  • title: string Set a plot title.

  • no_legend: bool Do not print a legend for the plot.

  • big_plot: bool Increase marker and font sizes (like in a wide light curve).

  • no_markers: bool Do not print markers.

  • empty_markers: bool Print empty (hollow) markers

  • plot_ratio: bool Add a ratio plot at the bottom. The first entry in the data dictionary is used as the reference for the ratio. If data dictionary is not an OrderedDict, the reference will be random.

  • plot_difference: bool Add a difference plot at the bottom. The first entry in the data dictionary is used as the reference for the difference. If data dictionary is not an OrderedDict, the reference will be random.

  • Any additional kwargs for plt.plot

Returns:
pyplot.figure

Instance of pyplot.figure in which the plot was produced

Raises:
ValueError

if asked to plot a ratio or difference with just one set of data

visualization.visualize.plot_array(telescopes, rotate_angle=0, show_tel_label=False, axes_range=None, marker_scaling=1.0)[source]#

Plot the array of telescopes.

The x axis gives the easting direction and y axis gives the northing direction. Note that in order to convert from the CORSIKA coordinate system to the ‘conventional’ system of North/East, a 90 degree rotation is always applied. Rotation of the array elements is possible through the ‘rotate_angle’ given either in degrees, or in radians. The direction of rotation of the array elements is counterclockwise. The rotation does not change Telescope instance attributes.

Parameters:
telescopes: astropy.table

Table with the telescope position and names. Note the orientation of the axes.

rotate_angle:

Angle to rotate the plot. For rotate_angle = 0 the resulting plot will have the x-axis pointing towards the east, and the y-axis pointing towards the North.

show_tel_label: bool

If True it will print the label of the individual telescopes in the plot. While it works well for the smaller arrays, it gets crowded for larger arrays.

axes_rangefloat

Axis range for both axes. Range is from -plot_range to plot_range.

maker_scalingfloat

Scaling factor for marker size to be plotted.

Returns:
plt.figure

Instance of plt.figure with the array of telescopes plotted.

visualization.visualize.plot_hist_2d(data, **kwargs)[source]#

Produce a two dimensional histogram plot.

Any option that can be changed after plotting (e.g., axes limits, log scale, etc.) should be done using the returned plt instance.

Parameters:
data: numpy structured array

The columns of the structured array are used as the x-axis and y-axis titles.

**kwargs:
  • title: set a plot title.

  • Any additional kwargs for plt.hist2d

Returns:
pyplot.figure

Instance of pyplot.figure in which the plot was produced.

visualization.visualize.plot_table(table, y_title, **kwargs)[source]#

Produce a high contrast one dimensional plot from the data in an astropy.Table.

A ratio plot can be added at the bottom to allow easy comparison. Additional options, such as plot title, plot legend, etc., are given in kwargs. Any option that can be changed after plotting (e.g., axes limits, log scale, etc.) should be done using the returned plt instance.

Parameters:
table: astropy.Table or astropy.QTable

The first column of the table is the x-axis and the second column is the y-axis. Any additional columns will be treated as additional data to plot. The column titles are used in the legend (except for the first column).

y_title: str

The y-axis title.

**kwargs:
  • palette: choose a colour palette (see set_style for additional information).

  • title: set a plot title.

  • no_legend: do not print a legend for the plot.

  • big_plot: increase marker and font sizes (like in a wide light curve).

  • no_markers: do not print markers.

  • empty_markers: print empty (hollow) markers

  • plot_ratio: bool Add a ratio plot at the bottom. The first entry in the data dictionary is used as the reference for the ratio. If data dictionary is not an OrderedDict, the reference will be random.

  • plot_difference: bool Add a difference plot at the bottom. The first entry in the data dictionary is used as the reference for the difference. If data dictionary is not an OrderedDict, the reference will be random.

  • Any additional kwargs for plt.plot

Returns:
pyplot.fig

Instance of pyplot.fig.

Raises:
ValueError

if table has less than two columns.

visualization.visualize.set_style(palette='default', big_plot=False)[source]#

Set the plotting style to homogenize plot style across the framework.

The function receives the colour palette name and whether it is a big plot or not. The latter sets the fonts and marker to be bigger in case it is a big plot. The available colour palettes are as follows:

  • classic (default): A classic colorful palette with strong colors and contrast.

  • modified classic: Similar to the classic, with slightly different colors.

  • autumn: A slightly darker autumn style colour palette.

  • purples: A pseudo sequential purple colour palette (not great for contrast).

  • greens: A pseudo sequential green colour palette (not great for contrast).

To use the function, simply call it before plotting anything. The function is made public, so that it can be used outside the visualize module. However, it is highly recommended to create plots only through the visualize module.

Parameters:
palette: str

Colour palette.

big_plot: bool

Flag to set fonts and marker bigger. If True, it sets them bigger.

Raises:
KeyError

if provided palette does not exist.

legend_handlers#

class visualization.legend_handlers.EdgePixelObject[source]#

Edge-Pixel Object.

class visualization.legend_handlers.HexEdgePixelHandler[source]#

Legend handler class to plot a hexagonal “edge” pixel.

class visualization.legend_handlers.HexOffPixelHandler[source]#

Legend handler class to plot a hexagonal “off” pixel.

class visualization.legend_handlers.HexPixelHandler[source]#

Legend handler class to plot a hexagonal “on” pixel.

class visualization.legend_handlers.LSTHandler(radius=None)[source]#

Legend handler class to plot a representation of an LST in an array layout.

class visualization.legend_handlers.LSTObject[source]#

LST Object.

class visualization.legend_handlers.MSTHandler(radius=None)[source]#

Legend handler class to plot a representation of an MST in an array layout.

class visualization.legend_handlers.MSTObject[source]#

MST Object.

class visualization.legend_handlers.MeanRadiusOuterEdgeHandler[source]#

Legend handler class to plot a the mean radius outer edge of the dish.

class visualization.legend_handlers.MeanRadiusOuterEdgeObject[source]#

Object for Mean radius outer edge.

class visualization.legend_handlers.OffPixelObject[source]#

Off-Pixel Object.

class visualization.legend_handlers.PixelObject[source]#

Pixel Object.

class visualization.legend_handlers.SCTHandler(radius=None)[source]#

Legend handler class to plot a representation of an SCT in an array layout.

class visualization.legend_handlers.SCTObject[source]#

SCT Object.

class visualization.legend_handlers.SSTHandler(radius=None)[source]#

Legend handler class to plot a representation of an SST in an array layout.

class visualization.legend_handlers.SSTObject[source]#

SST Object.

class visualization.legend_handlers.SquareEdgePixelHandler[source]#

Legend handler class to plot a square “edge” pixel.

class visualization.legend_handlers.SquareOffPixelHandler[source]#

Legend handler class to plot a square “off” pixel.

class visualization.legend_handlers.SquarePixelHandler[source]#

Legend handler class to plot a square “on” pixel.

class visualization.legend_handlers.TelescopeHandler(radius=None)[source]#

Telescope handler that centralizes the telescope information. Individual telescopes handlers inherit from this class.