pliers.extractors.MetricExtractor

class pliers.extractors.MetricExtractor(functions=None, var_names=None, subset_idx=None, **kwargs)[source]

Bases: Extractor

Extracts summary metrics from SeriesStim using numpy, scipy or custom

functions

Parameters
  • functions (str, functions or list) – function, string referring to absolute import path for a function (e.g. ‘numpy.mean’) or lambda. Function must operate on 1-dimensional numpy arrays and return a scalar. A list of functions or import strings may also be passed.

  • var_names (list) – optional list of custom alias names for each metric

  • subset_idx (list) – subset of Series index labels to compute metric on.

  • kwargs – named arguments for function call

__init__(functions=None, var_names=None, subset_idx=None, **kwargs)[source]
transform(stim, *args, **kwargs)

Executes the transformation on the passed stim(s).

Parameters
  • stims (str, Stim, list) –

    One or more stimuli to process. Must be one of:

    • A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)

    • A Stim instance of any type.

    • An iterable of stims, where each element is either a string or a Stim.

  • validation (str) –

    String specifying how validation errors should be handled. Must be one of:

    • ’strict’: Raise an exception on any validation error

    • ’warn’: Issue a warning for all validation errors

    • ’loose’: Silently ignore all validation errors

  • args – Optional positional arguments to pass onto the internal _transform call.

  • kwargs – Optional positional arguments to pass onto the internal _transform call.