Submodule ringfit¶
This module fit multiple circle in sparse matrix
- LordOfRings.ringfit.load_data(list_events, maxhits=64)¶
load_data gives the coordinates of the ones in the sparse matrix associated to the name of the file .txt in a dictionary.
- 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).
- Returns
- dictionary
Dictionary with keys the name of .txt files and with values given by the x,y coordinates of the relative event in a list (i.e. if X, Y are the coordinates arrays so in the dictionary we obtain [X, Y]).
- LordOfRings.ringfit.multi_ring_fit(dict_events, maxhits=64, ptolemy_threshold=0.2, triplet_threshold=10, means=False, meanthr=2, rsearch=0, drsearch=0, GPU=True)¶
multi_ring_fit executes multiple circle fits on arbitrary number of events and gives the values predicted by the alghoritm.
- Parameters
- dict_eventsdictionary
Dictionary whose keys are the name of .txt files and whose values are the x, y coordinates of the relative event in a list. This format is the output of the function LordOfRing.ringfit.load_data.
- maxhitsint
Maximum number of points per event (i.e. the maximum number of ones in each sparse matrix). Is a good practice to keep this value as a multiple of 2 if GPU is True (it will define the number of thread per block). Default is 64.
- triplet_thresholdfloat
Minimum distance between two points of the same triplet. Default is 10.
- ptolemy_thresholdfloat
Maximum value of the difference defined by the Ptolemy theorem: the points for which this difference is greater than ptolemy_threshold are excluded by the fit algorithm. Default is 0.2.
- meansboolean
If True find similar circle from each event and mean them. This remove duplicate circles. Default is False.
- meanthrfloat
Two circle are similar if their radius and center’s coordinates difference ( evaluated separately ) are less then meanthr. Default is 2.
- rsearchfloat
The radius that will be searched in the data after the fit, if zero the fourth argument returned by the function will be an empty numpy array. If zero no radius will be searched. Default is 0.
- drsearchfloat
The error on the radius rsearch, the function will return all the events having a fitted radius in (rsearch - drsearch, rsearch + drsearch). Default is 0.
- GPUboolean
If True execute the fit on the GPU, if False run a python iterative routine for the fit task. Default is True.
- Returns
- ( 2d numpy-array, 2d numpy-array, 2d numpy-array, 1d numpy-array )
- [float, float, float, string]
The radius, X center, Ycenter of all the events in three array. These values are distributed in different row, one for each event. Last array contain the names of the events with the radius in the range searched with rsearch, drsearch founded by the algoritm.