silx.gui.plot.stats.statshandler¶
-
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
QTableWidgetItemwhich 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 beStatelements.- 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)[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
- Returns
list of formatted statistics (as str)
- Return type
dict