Module audian.statisticsanalyzer

Classes

class StatisticsAnalyzer (browser, source_name='filtered')

Base class for analyzing selected regions.

Classes inheriting the Analyzer class need to reimplement the analyze() function. Their constructor takes an instance of the DataBrowser as the only argument. See class PlainAnalyzer as an example.

The constructor adds columns to the table where analysis results are stored (make_column() function) and initializes event markers to be plotted on top of traces or into specific panels (make_trace_events() and make_panel_events() functions).

The analyze() function then stores analysis results into the table (store() function) and plots event markers (set_events() and add_events() functions).

Parameters

browser : DataBrowser
Instance of the data browser.
name : str
Name of the analyzer implementation.
source_name : str
Source trace on which the analyzer will work on.

Attributes

browser : DataBrowser
Instance of the data browser.
name : str
Name of the analyzer implementation.
source_name : str
Source trace on which the analyzer will work on.
source : BufferedData
Trace on which the analyzer will work on. You rarely need to access the full source trace, since analyze() provides all the traces of the selected region.
data : thunderlab.TableData
The table storing the analysis results.
events : dict of list of pyqtgraph.ScatterPlotItem
Dictionary of the plot items for plotting event markers.

Methods

  • analyze(): Analysis function.
  • traces(): Names of all available data traces.
  • trace(): Full data trace of a given name
  • make_column(): Make a column for the table collecting the analysis results.
  • store(): Store analysis results in table.
  • make_trace_events(): Prepare events for plotting on top of a specific trace.
  • make_panel_events(): Prepare events for plotting in a specific panel.
  • set_events(): Plot event markers.
  • add_events(): Plot additional event markers.
Expand source code
class StatisticsAnalyzer(Analyzer):
    
    def __init__(self, browser, source_name='filtered'):
        super().__init__(browser, 'statistics', source_name)
        nd = int(-np.floor(np.log10(self.source.ampl_max/4e4)))
        if nd < 0:
            nd = 0
        us = self.source.unit
        self.make_column(f'{self.source_name} mean', us, f'%.{nd}f')
        self.make_column(f'{self.source_name} stdev', us, f'%.{nd}f')

        
    def analyze(self, t0, t1, channel, traces):
        source = traces[self.source_name][1]
        self.store(np.mean(source), np.std(source))

Ancestors

Inherited members