Puts a variable from the local Python environment into an active Lumerical session via the Python API.
Syntax
lumapi.putv(varname, value)
Parameters
Field |
Type |
Description |
---|---|---|
varname |
str |
Desired name of the variable to be put into the Lumerical scripting workspace. Note that certain reserved constants cannot be used. |
value |
/ |
Python variable to put be put into the Lumerical scripting workspace. See below on how different types of variables are converted. Only the variable types listed below are supported, any other types will result in an error |
Returns
None
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