fact.plotting package

This module contains functions to plot fact data into the camera view.

The Viewer class starts a GUI with tkinter, that let’s you click through events. You will only have access to the Viewer if you have installed matplotlib with tcl/tk support

Currently these functions only work with shape (num_events, 1440), so on a pixel bases

fact.plotting.camera(data, ax=None, cmap='gray', vmin=None, vmax=None, pixelcoords=None, edgecolor='k', linewidth=None, picker=False)[source]
Parameters:
  • data (array like with shape 1440) – the data you want to plot into the pixels
  • ax (a matplotlib.axes.Axes instace or None) – The matplotlib axes in which to plot. If None, plt.gca() is used
  • cmap (str or matplotlib colormap instance) – the colormap to use for plotting the ‘dataset’ [default: gray]
  • vmin (float) – the minimum for the colorbar, if None min(data) is used [default: None]
  • vmax (float) – the maximum for the colorbar, if None max(data) is used [default: None]
  • pixelcoords (the coordinates for the pixels in form [x-values, y-values]) – if None, the package resource is used [default: None]
  • edgecolor (any matplotlib color) – the color around the pixel
  • picker (bool) – if True then the the pixel are made clickable to show information
fact.plotting.mark_pixel(pixels, color='g', ax=None, linewidth=None)[source]

surrounds pixels given by pixels with a border

fact.plotting.pixelids(ax=None, size=None, pixelcoords=None, *args, **kwargs)[source]

plot the chids into the pixels

fact.plotting.plot_excess_rate(binned_runs, outputfile=None)[source]

Create an excess rate plot from given data

Parameters:
  • binned_runs (pd.DataFrame) – Binned data as returned by fact.analysis.bin_runs
  • outputfile (path) – if not None, the plot is saved to this file
Returns:

  • ax_excess (matplotlib.axes.Axes) – the matplotlib Axes for the excess rate plot
  • ax_significance (matplotlib.axes.Axes) – the matplotlib Axes for the significance plot

class fact.plotting.Viewer(dataset, label, clickedcolour='r', mapfile='pixel-map.csv', cmap='gray', vmin=None, vmax=None)[source]

Bases: object

A tkinter based GUI to look at fact events in the camera view.

dataset

array like with shape (num_events, 1440) – the data you want to plot into the pixels

label

str – the label for the colormap

clickedcolour

a matplotlib conform colour represantation – the coulour for clicked pixel [default: red]

mapfile

str – path/to/fact/pixelmap.csv [default pixel-map.csv]

cmap

str or matplotlib colormap instance – the colormap to use for plotting the ‘dataset’ [default: gray]

vmin

float – the minimum for the colorbar, if None min(dataset[event]) is used [default: None]

vmax

float – the maximum for the colorbar, if None max(dataset[event]) is used [default: None]

init_plot()[source]
next()[source]
on_key_event(event)[source]
onpick(event)[source]
previous()[source]
quit()[source]
redraw(event)[source]
save()[source]
update()[source]

Submodules

fact.plotting.analysis module

fact.plotting.analysis.plot_excess_rate(binned_runs, outputfile=None)[source]

Create an excess rate plot from given data

Parameters:
  • binned_runs (pd.DataFrame) – Binned data as returned by fact.analysis.bin_runs
  • outputfile (path) – if not None, the plot is saved to this file
Returns:

  • ax_excess (matplotlib.axes.Axes) – the matplotlib Axes for the excess rate plot
  • ax_significance (matplotlib.axes.Axes) – the matplotlib Axes for the significance plot

fact.plotting.core module

fact.plotting.core.camera(data, ax=None, cmap='gray', vmin=None, vmax=None, pixelcoords=None, edgecolor='k', linewidth=None, picker=False)[source]
Parameters:
  • data (array like with shape 1440) – the data you want to plot into the pixels
  • ax (a matplotlib.axes.Axes instace or None) – The matplotlib axes in which to plot. If None, plt.gca() is used
  • cmap (str or matplotlib colormap instance) – the colormap to use for plotting the ‘dataset’ [default: gray]
  • vmin (float) – the minimum for the colorbar, if None min(data) is used [default: None]
  • vmax (float) – the maximum for the colorbar, if None max(data) is used [default: None]
  • pixelcoords (the coordinates for the pixels in form [x-values, y-values]) – if None, the package resource is used [default: None]
  • edgecolor (any matplotlib color) – the color around the pixel
  • picker (bool) – if True then the the pixel are made clickable to show information
fact.plotting.core.mark_pixel(pixels, color='g', ax=None, linewidth=None)[source]

surrounds pixels given by pixels with a border

fact.plotting.core.onpick(event)[source]
fact.plotting.core.pixelids(ax=None, size=None, pixelcoords=None, *args, **kwargs)[source]

plot the chids into the pixels

fact.plotting.utils module

fact.plotting.utils.calc_linewidth(ax=None)[source]

calculate the correct linewidth for the fact pixels, so that the patches fit nicely together

Parameters:ax (matplotlib Axes instance) – the axes you want to calculate the size for
Returns:linewidth
Return type:float
fact.plotting.utils.calc_text_size(ax=None)[source]

fact.plotting.viewer module

class fact.plotting.viewer.Viewer(dataset, label, clickedcolour='r', mapfile='pixel-map.csv', cmap='gray', vmin=None, vmax=None)[source]

Bases: object

A tkinter based GUI to look at fact events in the camera view.

dataset

array like with shape (num_events, 1440) – the data you want to plot into the pixels

label

str – the label for the colormap

clickedcolour

a matplotlib conform colour represantation – the coulour for clicked pixel [default: red]

mapfile

str – path/to/fact/pixelmap.csv [default pixel-map.csv]

cmap

str or matplotlib colormap instance – the colormap to use for plotting the ‘dataset’ [default: gray]

vmin

float – the minimum for the colorbar, if None min(dataset[event]) is used [default: None]

vmax

float – the maximum for the colorbar, if None max(dataset[event]) is used [default: None]

init_plot()[source]
next()[source]
on_key_event(event)[source]
onpick(event)[source]
previous()[source]
quit()[source]
redraw(event)[source]
save()[source]
update()[source]