WaveformLibrary

WaveformLibrary#

class WaveformLibrary#

Bases: MmParameter

WaveformLibrary stores serialized Waveform objects and their parameters.

Each row represents a waveform template associated with a WaveformListID, the waveform Type (class name), SamplingRate, JSON-encoded Parameter table describing named parameters, and optional modulation links referencing entries in WaveformListLibrary.

Schema (columns, types, defaults):

Column

Type

Default

WaveformListID

int64

1

Type

string

ConstantWave

SamplingRate

double

1000

Parameter

table

None

AmplitudeModulation

double

0

FrequencyModulation

double

0

PhaseModulation

double

0

Foreign keys:

Join conditions:

(none; view WaveformParameters is created for JSON expansion)

Flags:

Property

Value

IsIncludeDefaultEntry

false

IsFirstColumnUnique

false

IsTriggerJoinOnRight

false

IsTriggerJoinOnLeft

false

Constructor Summary
WaveformLibrary()#
Method Summary
checkVariableBound(varID)#

Return dependent waveform lists for a given variable ID.

Scans Parameter JSON for occurrences of VariableID and returns unique WaveformListID values that reference it.

Parameters:

varID (double) – Target variable ID

Returns:

Dependent WaveformListID values

Return type:

double or []

createView()#

Create the SQLite view used to expand JSON parameters per row.

Creates/ensures the WaveformParameters view which flattens the JSON-encoded Parameter column into a rowset with columns ID (pointing to this table), Name, VariableID, and DefaultValue. Idempotent: only creates the view if it does not already exist. Used by readParameter() to join with VariableList and resolve current values.

defineSchema()#
loadEntry(id)#

Instantiate a Waveform object from a database row.

Calls readParameter() and constructs the waveform class with parameter assignment, resolving optional modulation lists from WaveformListLibrary.

Parameters:

id (double) – Row ID to load

Returns:

Waveform instance populated from the database

Return type:

Waveform

readParameter(id)#

Read waveform parameters with variable resolution.

Returns a struct combining base waveform fields with a parameter table where variable links are resolved against VariableList.

Parameters:

id (double) – Row ID

Returns:

Struct with fields Type, SamplingRate, modulation IDs, and a Parameter table containing columns Name, DefaultValue, VariableID, Value.

Return type:

struct

saveEntry(wf, wflID, wfID)#

Save a Waveform object into the database.