silx.gui.plot.stats.statshandler
#
This module containts the classes relative to the management of statistics display.
- class StatFormatter(formatter='{0:.3f}', qItemClass=<class 'silx.gui.plot.stats.statshandler._FloatItem'>)[source]#
Class used to apply format on
Stat
- Parameters:
formatter – the formatter. Defined as str.format()
qItemClass – the class inheriting from
QTableWidgetItem
which will be used to display the result of the statistic computation.
- class StatsHandler(statFormatters)[source]#
Give create:
Stats object which will manage the statistic computation
Associate formatter and
Stat
- Parameters:
statFormatters – Stat and optional formatter. If elements are given as a tuple, elements should be (
Stat
, formatter). Otherwise should beStat
elements.- Return type:
List or tuple
- add(stat, formatter=None)[source]#
Add a stat to the list.
- Parameters:
stat (StatBase)
formatter (Union[None,StatFormatter])
- format(name, val)[source]#
Apply the format for the name statistic and the given value
- Parameters:
name (str) – the name of the associated statistic
val – value before formatting
- Returns:
formatted value
- calculate(item, plot, onlimits, roi=None, data_changed=False, roi_changed=False)[source]#
compute all statistic registered and return the list of formatted statistics result.
- Parameters:
item – item for which we want to compute statistics
plot – plot containing the item
onlimits – True if we want to compute statistics on visible data only
roi – region of interest for statistic calculation
- Type:
bool
- Type:
Union[None,:class:_RegionOfInterestBase]
- Returns:
list of formatted statistics (as str)
- Return type:
dict