Measurer Builder

The measurer_builder module defines the plug-in infrastructure shared by all measurers. Every measurer must inherit from BaseClass and implement the required interface; MeasurerFactory() discovers and instantiates the correct subclass at runtime from a plain string name.

Measurer BaseClass

MeasurerFactory

ecosound.measurements.measurer_builder.MeasurerFactory(measurer_name, *args, **kwargs)[source]

Measurer Factory.

Loads the measurer class defined by measurer_name. Each measurer class must be added to the __init__.py file.

For example : from .measurer1 import Measurer1

where Measurer1 is the name of the measurer class to load from the .py file measurer1

Parameters:
  • measurer_name (str) – Name of the measurer class.

  • *args (any) – Input arguments for the measurer selected.

  • **kwargs (any) – Keyword arguments for the measurer selected.

Raises:

ValueError – If measurer_name doesn’t correspond to any of the measurers available.

Return type:

Measurer object