Submodule performance

This module evaluates the performance of the algorithim and print the results in a fashionable way.

LordOfRings.performance.get_true_value(list_event)

get_true_value return radius and center with the index of the membership of that circle to some event.

Parameters
list_eventslist of str

List of .txt files that contain the sparse matrix of each events. These files are contained in the folder ./data/.

Returns
(1d numpy-array, 2d numpy-array)

The first array contains the events names repeated as many time as the number of circle in the relative event. The second array contains the center position (xc, yc) and the radius of the events whose names is stored in the first output of this function.

LordOfRings.performance.hist_error(list_event, rr, xc, yc, bins=None, ax=None, label=None, error_threshold=50, **kwargs)

hist_error plot the histogram of the percentage error of the fits against the true values given in the toy dataset created by LordOfRings.generator.

Parameters
list_eventslist of str

List of .txt files that contain the sparse matrix of each events. These files are contained in the folder ./data/.

rr2d numpy-array [float]

The radii predicted by the multiring alghoritm in the format described in the return of the function ‘LordOfRings.ringfit.multi_ring_fit’.

xc2d numpy-array [float]

The x coordinates of the center predicted by the multiring alghoritm in the format described in the return of the function ‘LordOfRings.ringfit.multi_ring_fit’.

yc2d numpy-array [float]

The y coordinates of the center predicted by the multiring alghoritm in the format described in the return of the function ‘LordOfRings.ringfit.multi_ring_fit’.

binsint or None

Number of bins in the histogram, if None it is computed with the sturges rule.

axmatplotlib.axes or None

axes contain the histogram, if None a new ax is created.

error_thresholdfloat (lower than 100)

maximum percentage error for which a it is considered to match a real radius.

**kwargsdictionary

matplotlib.axes arguments.

Returns
(matplotlib.axes, float)

The axes that contain the histogram of the logarithm of the errors and the number of circle predicted (i.e. “matched” circles) divided by the total number of circle in all the events of list_event.

LordOfRings.performance.speed_test(list_events, maxhits=64, step=8, ax=None)

This function compare the speed of the GPU code against the non-GPU code as the number of events varies. The result are written in a matplotlib axes.

Parameters
list_eventslist of str

List of .txt files that contain the sparse matrix of each events. These files are contained in the folder ./data/.

maxhitsint

Maximum number of points per event (i.e. the maximum number of ones in each sparse matrix).

stepint

Number of events added each iteration.

axmatplotlib axes

The final plot will be added in this axes. If None a new ax is created.

Returns
matplotlib axes

The ax with the plot.