A Python API method that executes Lumerical script command(s) in an active Lumerical session opened via the Python API.
Syntax |
Description |
---|---|
lumapi.eval('line1; line2;...') |
When called in Python, this function will execute the Lumerical script commands in an active Lumerical session. The lines have to be complete, and it may contain multiple lines separated by a semicolon. |
This script command can be used to assign or construct variables that will later be passed to Python. This function returns no data, but can access data that is in the Lumerical workspace. The eval() method may also be used to run Lumerical script files (lsf) in your path, or functions in your workspace. For script files in another directory consider using feval - Script command.
with lumapi.FDTD(hide = True) as fdtd:
test = fdtd.eval('z = 1 +1i;')
print(test)
print('Complex number z is returned as ',type(fdtd.getv('z')),str(fdtd.getv('z')))
Returns
None
Complex number z is returned as <class 'numpy.ndarray'> [[1.+1.j]]
Note: Previous versions of the API employed the getevalScript() method. Although this syntax still functions it will not continue to be supported. For more information on this deprecated technique of driving Lumerical's tools from Python see the Session Management -Python API.
|