Photonics

Photonics

Topics related to Lumerical and more.

Cannot figure out options of getresult command (pythonAPI)

    • Alex Lambertz
      Subscriber
      Hi, I want to extract the field values from a monitor using the pythonAPI and getresult command. When you follow the procedure in the nanowire example here, in the fourth code snippet the E field is returned with E = fdtd.getresult("profile", "E"), which is an ndarray. When the profile is being plotted, the data is accessed with the following line in the second to last code snippet: ## show the field intensity profile Ey = E["E"][:,:,0,0,1] It is nowhere explained what these indices / parameters / options do! Neither on the getresult script command page nor in the function itself! E["E"][:,:,0,0,1] has five "dimensions" so to speak, where the first two give the x,y coordinates apparently, and by trial and error I found the fourth should be the wavelength / frequency index. What are the remaining two parameters "0" at position 3 and "1" at position 5? in getdata or geteletric for example, there is an 'option' optional parameter that has to do with symmetry and boundary conditions, what do they do here and how could I find this out by myself? Thanks for your help, Alex    
    • Guilin Sun
      Ansys Employee

      It is unfortunate that there is no description for the matrix. Usually the field components will have the following dimensions:

      x,y,z,f or t, m

      where m=1 is for Ex, 2 for Ey and 3 for Ez. This is not very common. In FDTD its self the most often used is:

      in frequency domain it is x,y,z,f

      in time domain it is x,y,z,t

      In python it may allow the dimension index begins at 0. I am not sure for this.

       

    • Guilin Sun
      Ansys Employee

      Please refer to this article: https://optics.ansys.com/hc/en-us/articles/360041401434-Passing-Data-Python-API

       

    • Alex Lambertz
      Subscriber

      Hi Guilin,

       Thank you so much, that makes sense! I can also confirm that the index in python does in fact begin at 0.

      The link you sent in the second reply I had visited before, but for me it does not give clear overview of what the components are in the dataset and how they can be accessed from python.
      Maybe it would be great to have a more general overview of the dataset structure somewhere in the knowledge base / in the help()-function of each of these methods.

       

      In my view, the issue can be closed / marked solved!

       

      All the best,

      Alex

       

    • Guilin Sun
      Ansys Employee

      Thank you Alex for the suggestion. I will pass it to the team.

    • Thomas Martineau
      Ansys Employee

      Hi Alex,

      Please note that this forum is for Speos and Zemax topics, for Lumerical please use the Photonics one.

      Thanks

Viewing 5 reply threads
  • The topic ‘Cannot figure out options of getresult command (pythonAPI)’ is closed to new replies.