Please enable JavaScript to view this site.

Knowledge Base

A Python function that passes a Python map/dict to the Script Workspace of an active Lumerical session opened via the Python interoperability API. This function will translate directly to a Lumerical struct data type in the Lumerical script.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

Supported OS: Windows, Linux

 

Syntax

Description

lumapi.putStruct(handle, "struct_name", M)

When executed in Python, this function will pass a Python map/dict to a Lumerical session through an active handle. The data will be a struct type in the Lumerical script.

 

Example

The following example shows how string, double, matrix and structs defined in Python can be passed to the Lumerical Script workspace:

values = { 'greeting' : 'Hello World',                      # String data
           'pi' : 3.14,                                     # Double data
           'm' : array([[1.,2.,3.],[4.,5.,6.]], order='F'), # Matrix data
           'nested_struct' : { 'e' : 2.71 } }               # Struct data
lumapi.putStruct(handle, “struct_name”, values)

 

The following example shows how a string and list defined in Python can be passed to the Lumerical Script workspace:

values =  { ‘greeting’ : ‘Hello World’,                     # String data
            ‘my_list’ : [1, 2, 3, 4, 5] }                   # List/Cell data
lumapi.putStruct(handle, "struct_name", values)

 

See Also

lumapi.putDouble, lumapi.putMatrix, lumapi.putString, lumapi.putList, struct

Copyright Lumerical Inc. | Privacy | Site Map