finesse.element module

class finesse.element.ModelElement(*args, **kwargs)[source]

Bases: object

Base for any object which can be an element of a Model.

When added to a model it will attempt to call the method _on_add so that the element can do some initialisation if required.

Parameters

namestr

Name of newly created model element.

property default_parameter_name[source]

The default parameter to assume when the component is directly referenced.

This is used for example in kat script when the component is directly referenced in an expression, instead of the model parameter, e.g. ‘l1’ instead of ‘l1.P.’

Returns

str

The name of the default model parameter.

None

If there is no default.

property has_model[source]

Returns true if this element has been associated with a Model.

info(eval_refs=False)[source]

Element information.

Parameters

eval_refsbool

Whether to evaluate symbolic references to their numerical values. Defaults to False.

Returns

str

The formatted info.

info_parameter_table()[source]

Info parameter table.

This provides a table with useful fields in addition to those contained in parameter_table().

Returns

str

The formatted extra info table.

None

If there are no info parameters.

property name[source]

Name of the element.

Returns

str

The name of the element.

parameter_table(eval_refs=False, return_str=False)[source]

Model parameter table.

Parameters

eval_refsbool

Whether to evaluate symbolic references to their numerical values. Does not have effect when return_str is False. Defaults to False.

return_strbool

Return str representation instead of finesse.utilities.tables.Table Necessary when setting eval_refs to True. Defaults to False.

Returns

finesse.utilities.tables.Table

The formatted parameter info table.

str

String representation of the table, if ‘return_str’ is True

None

If there are no parameters.

property parameters[source]

Returns a list of the parameters available for this element.

property ref[source]

Reference to the default model parameter, if set.

Returns

ParameterRef

Reference to the default model parameter, if set.

Raises

ValueError

If there is no default model parameter set for this element.

unparse() str[source]

Unparse this model element to katscript

Returns

str

Katscript representing this element