simetrix.LegacyCurveData

class simetrix.LegacyCurveData

Bases: GraphObject

Deprecated, for new code see CurveData. Represents the data held within a specific curve.

A curve contains X-Y data vectors that can be accessed using the division(index: int) function. In many cases a curve may only contain a single division, but cases such as Monte-Carlo analysis there will be multiple divisions (in the case of Monte-Carlo analysis a division for each simulation run in the analysis). Each division will contain a full set of corresponding X and Y data.

Methods

division(index)

Returns the X-Y data vector for the given division index.

numberDivisions()

Returns the number of divisions this contains.

prop(propertyName)

Returns the property with the name given.

properties()

Returns the set of properties for this object.

setPropertyValue(propertyName, propertyValue)

Sets a property value for an object.

Attributes

id

Returns the ID of the object.

type

Returns the object type.

valid

Returns True if the GraphObject is valid.

division(index: int) AbstractXYDataVector

Returns the X-Y data vector for the given division index.

Indexes start from 0, with a valid index being one in the range 0 <= index < numberDivisions().

The first division can be obtained using ‘division(0)’.

Parameters:

index (int) – Division index to obtain.

Returns:

X-Y data vector at the given division index, or None if the index is invalid.

Return type:

AbstractXYDataVector

property id: int

Returns the ID of the object. This can be used to pass to a native SIMetrix script function.

numberDivisions() int

Returns the number of divisions this contains.

Returns:

Number of divisions this contains.

Return type:

int

prop(propertyName: str) GraphProperty

Returns the property with the name given. Can also use property().

Some properties have a symbolic value denoted by enclosing the value with ‘%’ characters. The property method will return the resolved value instead of the symbolic value if the name is prefixed with the ‘@’ character. For example:

print(curve.prop('@Label').Value)

The Label property usually has the value %DefaultLabel% which is what would be returned by the method if the ‘@’ character were omitted. The resolved value is the value of the DefaultLabel property.

properties() list[GraphProperty]

Returns the set of properties for this object.

Example

Print the name and data type for all properties belonging to the current graph.

import simetrix as sx

graph = sx.currentGraph()

props= graph.properties()

for p in props :
    print(p.name, p.type)
setPropertyValue(propertyName: str, propertyValue: str | float)

Sets a property value for an object.

As explained in GraphProperty GraphProperty obejcts can have one of five data types. However, writeable properties can only be scalar string or scalar real valued. Hence this method can only accept real or string data for the property value.

Example

import simetrix as sx

# Get the current graph
graph = sx.currentGraph()

# Get the first curve available
curve = graph.curves()[0]

# Change the curve colour to green
curve.setPropertyValue('RGBColour', 32768)
property type: GraphObjectType

Returns the object type.

property valid: bool

Returns True if the GraphObject is valid.

A GraphObject obtained from the GraphProperty of another GraphObject will not necessarily be valid. The following example obtains the MainCursor property of the current graph. This will be an invalid object if cursors are not enabled.

import simetrix as sx

graph = sx.currentGraph()

mainCursor = graph.prop('MainCursor')

if mainCursor.value.valid :
    print("Cursors are enabled")
else :
    print("Cursors are not enabled")