ezmsg.sigproc.math.add#

Add 2 signals or add a constant to a signal.

Classes

class Add(*args, settings=None, **kwargs)[source]#

Bases: Unit

Add two signals together.

Assumes compatible/similar axes/dimensions and aligned time spans. Messages are paired by arrival order (oldest from each queue).

Parameters:

settings (Settings | None)

INPUT_SIGNAL_A = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
INPUT_SIGNAL_B = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
OUTPUT_SIGNAL = OutputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>](self.num_buffers=32, self.force_tcp=False)#
async initialize()[source]#

Runs when the Unit is instantiated. This is called from within the same process this unit will live. This lifecycle hook can be overridden. It can be run as async functions by simply adding the async keyword when overriding.

Return type:

None

async on_a(msg)[source]#
Parameters:

msg (AxisArray)

Return type:

None

async on_b(msg)[source]#
Parameters:

msg (AxisArray)

Return type:

None

async output()[source]#
Return type:

AsyncGenerator

class AddProcessor[source]#

Bases: object

Processor that adds two AxisArray signals together.

This processor maintains separate queues for two input streams and adds corresponding messages element-wise. It assumes both inputs have compatible shapes and aligned time spans.

__init__()[source]#
property state: AddState#
push_a(msg)[source]#

Push a message to queue A.

Parameters:

msg (AxisArray)

Return type:

None

push_b(msg)[source]#

Push a message to queue B.

Parameters:

msg (AxisArray)

Return type:

None

class AddState(queue_a=<factory>, queue_b=<factory>)[source]#

Bases: object

State for Add processor with two input queues.

Parameters:
queue_a: Queue[AxisArray]#
queue_b: Queue[AxisArray]#
__init__(queue_a=<factory>, queue_b=<factory>)#
Parameters:
Return type:

None

class ConstAdd(*args, settings=None, **kwargs)[source]#

Bases: BaseTransformerUnit[ConstAddSettings, AxisArray, AxisArray, ConstAddTransformer]

Unit wrapper for ConstAddTransformer.

Parameters:

settings (Settings | None)

SETTINGS#

alias of ConstAddSettings

class ConstAddSettings(value: float = 0.0)[source]#

Bases: Settings

Parameters:

value (float)

value: float = 0.0#

Number to add to the input data.

__init__(value=0.0)#
Parameters:

value (float)

Return type:

None

class ConstAddTransformer(*args, settings=None, **kwargs)[source]#

Bases: BaseTransformer[ConstAddSettings, AxisArray, AxisArray]

Add a constant value to input data.

Parameters:

settings (SettingsType)

class ConstAddSettings(value: float = 0.0)[source]#

Bases: Settings

Parameters:

value (float)

value: float = 0.0#

Number to add to the input data.

__init__(value=0.0)#
Parameters:

value (float)

Return type:

None

class ConstAddTransformer(*args, settings=None, **kwargs)[source]#

Bases: BaseTransformer[ConstAddSettings, AxisArray, AxisArray]

Add a constant value to input data.

Parameters:

settings (SettingsType)

class ConstAdd(*args, settings=None, **kwargs)[source]#

Bases: BaseTransformerUnit[ConstAddSettings, AxisArray, AxisArray, ConstAddTransformer]

Unit wrapper for ConstAddTransformer.

Parameters:

settings (Settings | None)

SETTINGS#

alias of ConstAddSettings

class AddState(queue_a=<factory>, queue_b=<factory>)[source]#

Bases: object

State for Add processor with two input queues.

Parameters:
queue_a: Queue[AxisArray]#
queue_b: Queue[AxisArray]#
__init__(queue_a=<factory>, queue_b=<factory>)#
Parameters:
Return type:

None

class AddProcessor[source]#

Bases: object

Processor that adds two AxisArray signals together.

This processor maintains separate queues for two input streams and adds corresponding messages element-wise. It assumes both inputs have compatible shapes and aligned time spans.

__init__()[source]#
property state: AddState#
push_a(msg)[source]#

Push a message to queue A.

Parameters:

msg (AxisArray)

Return type:

None

push_b(msg)[source]#

Push a message to queue B.

Parameters:

msg (AxisArray)

Return type:

None

class Add(*args, settings=None, **kwargs)[source]#

Bases: Unit

Add two signals together.

Assumes compatible/similar axes/dimensions and aligned time spans. Messages are paired by arrival order (oldest from each queue).

Parameters:

settings (Settings | None)

INPUT_SIGNAL_A = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
INPUT_SIGNAL_B = InputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>]()#
OUTPUT_SIGNAL = OutputStream:unlocated[<class 'ezmsg.util.messages.axisarray.AxisArray'>](self.num_buffers=32, self.force_tcp=False)#
async initialize()[source]#

Runs when the Unit is instantiated. This is called from within the same process this unit will live. This lifecycle hook can be overridden. It can be run as async functions by simply adding the async keyword when overriding.

Return type:

None

async on_a(msg)[source]#
Parameters:

msg (AxisArray)

Return type:

None

async on_b(msg)[source]#
Parameters:

msg (AxisArray)

Return type:

None

async output()[source]#
Return type:

AsyncGenerator