Photonics

Photonics

Topics related to Lumerical and more.

Inverse design y branch visulizaing initial geometry

    • noumanzia
      Subscriber

      Hi,

      How can I visualize the polygon in the python environment of Lumerical when I am making y splitter geometry. Should I use matplotlib to plot the polygon ?

    • Taylor Robertson
      Ansys Employee


      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
      ...
      def shape_function(params):
      ...
      return polygon_points
      ...
      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):
      ...
      return
      ...
      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
    • noumanzia
      Subscriber
      Thank you! I will check that and get back if there is still an issue.
Viewing 2 reply threads
  • The topic ‘Inverse design y branch visulizaing initial geometry’ is closed to new replies.