Get a variable from an active Lumerical session. The variable can be a string, real/complex numbers, matrix, cell or struct.
Syntax
returnedVariable = lumapi.getv(varname)
Parameters
Field |
Type |
Description |
---|---|---|
varname |
str |
Lumerical variable name of the variable to obtain. |
Returns
Field |
Type |
Description |
---|---|---|
returnedVariable |
/ |
Retrieved Python variable, see below on how types are converted between the Lumerical and Python workspaces. |
Variable Translation
A quick reference guide for translated datatypes is shown in the table below, see the Knowledge Base article on Passing Data for more information on how types are converted.
Lumerical | Python |
String | str |
Real | float |
Complex | np.array |
Matrix | np.array |
Cell array | list |
Struct | dict |
Dataset | dict |
Example
Putting a string from Python to Lumerical, then retrieving it and printing its type.
with lumapi.FDTD(hide = True) as fdtd: Lumerical = 'Lumerical Inc' fdtd.putv('Lum_str',Lumerical) print(type(fdtd.getv('Lum_str')),str(fdtd.getv('Lum_str')))
Returns
<class 'str'> Lumerical Inc
See Also
Python API overview, Lumerical Python API Reference, Passing Data – Python API