Class MeanAverageValue

Computes the Mean Absolute Value (MAV) feature for each channel in a windowed input signal.

JSON configuration

Use these block entries inside a pipeline configuration. Input names must match other blocks in that pipeline; device addresses and file paths must match your setup.

JSON configuration:

{
  "MAV": {
    "Type": "MeanAverageValue",
    "Inputs": [ "SlidingWindow1" ],
    "DesiredRate": 100,
    "Path": "C:/Data/session1"
  }
}

Params: None.

How Type, Inputs and Params work · Block catalogue and parameter reference

Inheritance
MeanAverageValue
Inherited Members
Namespace: MOSAIC.Models.FlowControl
Assembly: MOSAIC.dll
Syntax
public class MeanAverageValue : BaseBlock, INotifyPropertyChanged, INotifyPropertyChanging, ISubscriber, IPublisher, IBaseBlockProps, IJsonExportable, IDisposable, IAsyncDisposable
Remarks

Formula: MAV = (1/N) × Σ|x[i]| where N is the window size.

Input: A MathNet.Numerics.LinearAlgebra.Matrix<T> of double where rows represent samples and columns represent channels (typically produced by an upstream SlidingWindow block).

Output: A MathNet.Numerics.LinearAlgebra.Vector<T> of double containing one MAV value per channel, published to all downstream subscribers.

Note: This block computes a single fixed metric. For switchable metrics (RMS, IEMG, VAR, etc.), use MetricsExtractor instead.

CSV logging: When a Path is specified, Dumper automatically logs the output vector via Publish(object).

Constructors

MeanAverageValue(string, double)

Initializes a new MeanAverageValue block.

Declaration
public MeanAverageValue(string name, double desiredRate = 0)
Parameters
Type Name Description
string name

Display name of the block.

double desiredRate

Desired processing rate in Hz (typically inherited).

Properties

ConfigSummary

Gets a human-readable summary of the current configuration.

Declaration
public string ConfigSummary { get; }
Property Value
Type Description
string

Description

Gets the formula description for display in the UI.

Declaration
public string Description { get; }
Property Value
Type Description
string

DumpFilePrefix

Recordings from this block are named <block>_mav.csv.

Declaration
protected override string DumpFilePrefix { get; }
Property Value
Type Description
string
Overrides
BaseBlock.DumpFilePrefix

JsonTypeName

Block type identifier for JSON serialization. Override for a custom name.

Declaration
protected override string JsonTypeName { get; }
Property Value
Type Description
string
Overrides
BaseBlock.JsonTypeName

OutputChannels

Gets the number of output channels, determined from the column count of the first input matrix.

Declaration
public int OutputChannels { get; private set; }
Property Value
Type Description
int

Visualization

This block's visualization, or null when it has none.

Declaration
protected override BlockVisualization? Visualization { get; }
Property Value
Type Description
BlockVisualization
Overrides
BaseBlock.Visualization
Remarks

Blocks own their scope as a public Viz property rather than inheriting one, so the base class has no way to reach it. Overriding this is what lets the rate below be wired up automatically. With correct publication metadata, the bundle derives the time axis for one vector per publication or fixed-size contiguous sample packets from the feed shape.

When a plot needs a rate that publication frequency and feed shape cannot express (for example, variable-sized packets or overlapping windows), declare it with Viz.UpdateSignalRate. An explicit declaration wins over the derived rate. A block with several bundles must configure each one; this hook exposes only one bundle.

Viz

Visualization helper for binding the MAV output to the UI scope.

Declaration
public BlockVisualization? Viz { get; }
Property Value
Type Description
BlockVisualization

WindowSize

Gets the window size (row count) from the most recent input matrix.

Declaration
public int WindowSize { get; private set; }
Property Value
Type Description
int

Methods

ConfigureInput(IServiceProvider, JsonModel)

Creates a MeanAverageValue from a JSON pipeline definition.

Declaration
public static MeanAverageValue ConfigureInput(IServiceProvider sp, JsonModel m)
Parameters
Type Name Description
IServiceProvider sp

Service provider for dependency injection.

JsonModel m

JSON model containing configuration.

Returns
Type Description
MeanAverageValue

A configured MeanAverageValue instance.

Dispose()

Releases visualization and base class resources (including CSV dumper if configured).

Declaration
public override void Dispose()
Overrides
BaseBlock.Dispose()

OnReceive(object, object?)

Processes an incoming windowed matrix and publishes the computed MAV vector.

Declaration
protected override void OnReceive(object sender, object? value)
Parameters
Type Name Description
object sender

The upstream block.

object value

Expected to be a MathNet.Numerics.LinearAlgebra.Matrix<T> of double (rows = samples, columns = channels). Non-matrix inputs are rejected and reported through ReportError(string, Exception?); activity status remains automatic.

Overrides
BaseBlock.OnReceive(object, object)

Implements

INotifyPropertyChanged
INotifyPropertyChanging
ISubscriber
IPublisher
IBaseBlockProps
IJsonExportable
IDisposable
IAsyncDisposable

Search documentation

Start typing to search the documentation.