ipkiss3.all.device_sim.MacroOutput

class ipkiss3.all.device_sim.MacroOutput

Running solver specific commands (a Macro) during the simulation phase.

Generated files can be retrieved afterwards through get_result.

This macro can be used to return information from the solver directly.

Macros defined using MacroOutput are run in the simulation phase. This is different from running macros in the simulation setup (see the setup_macros attribute). The macro commands should generate a file (or multiple files).

If all you need is an SMatrix, then you can use SMatrixOutput.

Parameters:
commands: list and List with type restriction, allowed types: <class β€˜str’>, required

list of tool-specific commands to execute

filepath: str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters, required

path where the output is supposed to be written to, relative to project directory. Can be a file as well as a directory

name: str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters, required

Identifies the output

Examples

>>> # This example is specific to Ansys Lumerical MODE,
>>> # but MacroOutput can also be used for the other solvers we support.
>>> simjob = i3.device_sim.LumericalEMESimulation(
>>>     geometry=geometry,
>>>     outputs=[
>>>         i3.device_sim.MacroOutput(
>>>             name='macro-output',
>>>             # filepath must correspond with the file used in the commands.
>>>             filepath='test.txt',
>>>             # The commands below are tool-specific
>>>             commands=[
>>>                 'a=linspace(0, 4, 5);',
>>>                 'write("test.txt",num2str(a), "overwrite");'
>>>             ]
>>>         )
>>>     ],
>>> )
>>> # get_result will execute the code and take care of copying the file when required.
>>> fpath = simjob.get_result('macro-ouput')
>>> print(open(fpath).read())
# expected output:
# 0
# 1
# 2
# 3
# 4