lmlib.statespace.cost.ConstrainMatrix#

class lmlib.statespace.cost.ConstrainMatrix(cost)#

Bases: object

Constrain Matrix Generator

Builder class to set up matrix H as a linear constraint for the squared error minimization

Parameters

cost (CompositeCost, CostSegment) – CompositeCost or CostSegment

Methods

__init__(cost)

constrain(indices, value)

Add constrain

constrain_by_labels(label_1, label_2, value)

Add constrain by labels

digest()

Reruns a "snapshot" of the constraint matrix with the applied constrains

print_table()

Prints the actual table of constraints to the console

Attributes

TSLM_TYPES

Two Sided Line Model Types.

TSLM_TYPES = ('free', 'continuous', 'straight', 'horizontal', 'left horizontal', 'right horizontal', 'peak', 'step')#

Two Sided Line Model Types. see REF

Type

tuple of string

constrain(indices, value)#

Add constrain

I.e. Apply a dependency between two indices. See example below.

Parameters
  • indices (array_like of shape(2,)) – indices to apply a dependency

  • value

Returns

s – self

Return type

ConstrainMatrix

constrain_by_labels(label_1, label_2, value)#

Add constrain by labels

I.e. Apply a dependency between two indices. See example below.

Parameters
  • label_1 (str) – label of first state variable index to apply a dependency

  • label_2 (str) – label of second state variable index to apply a dependency

  • value (int, float) – dependency value

Returns

s – self

Return type

ConstrainMatrix

digest()#

Reruns a “snapshot” of the constraint matrix with the applied constrains

Returns

H – Constrain Matrix

Return type

numpy.ndarray of shape(N, M)

print_table()#

Prints the actual table of constraints to the console