January 27, 2022 at 8:59 pm
It is important to avoid any self-intersecting geometries, and so checking the shape of geometry is important. Using matplotlib is the easiest way. Something like the following python code would work for FunctionDefinedGeometry.
import matplotlib.pyplot as plt
points = shape_function(initial_parameters)
x , y =points[:,0], points[:,1]
plt.plot(x, y, 'b-')
plt.show If you are using ParameterizedGeometry then you will need to use lumapi to start a session and have the lumerical GUI draw the structure. Maybe copy your function to a new file, and add a main. That is what I would do anyway.
def func(params, fdtd_handle, only_update = True):
if __name__ == "__main__":
with lumapi.FDTD() as fdtd:
fdtd.eval('coupler;') #Set-up script in same directory
params = np.array([()] ) # Test params
func(params, fdtd) #Eval your function
input('Press enter..') #Wait so you can inspect the design