Photonics

Photonics

Topics related to Lumerical and more.

simple question regarding S-parameter data extraction coding.

    • jeong hee yun
      Subscriber
      I am writing code to automate S-parameter matrix sweep simulation using Port1 and Port2.
       
      The code written so far is as follows.
       
      deletesweep("s-parameter sweep");
      addsweep(3);
      setsweep("s-parameter sweep", "name", "S sweep");
      setsweep("s-parameter sweep", "Excite all ports", 0);
      runsweep("S sweep");
      S_parameters = getsweepresult("S sweep","S parameters");
      visualize(S_parameters);
       
       
      However, in the visualize result window, I want to select the unit of 'scalar opration' of 'S11, S12, S21, S22 result values' as 'abs^2' instead of 'Re' and save the data as a text file, but I don't know how
    • Amrita Pati
      Ansys Employee

      Hi Jeong Hee,

      I think you can not specify the operation in visualize using script. Either you have to create a new dataset with the squared values, and then visualize that dataset. Or you can simply plot the square values using the plot script command and then use write to save the values into a text file. I wrote a sample script to plot data and write them into text file, that might be useful for your case:

      S_para= getsweepresult("S-parameters","S parameters");
      lambda = S_para.lambda;
      S_11_2 = abs(S_para.S11)^2; #_2 after S_11 is just to indicate that it's squared
      S_12_2 = abs(S_para.S12)^2;
      S_21_2 = abs(S_para.S21)^2;
      S_22_2 = abs(S_para.S22)^2;

      plot(lambda,S_11_2);
      holdon;
      plot(lambda,S_12_2);
      plot(lambda,S_21_2);
      plot(lambda,S_22_2);
      holdoff;

      write("S_param.txt","S11_2: "+ num2str(S_11_2));
      write("S_param.txt","S12_2: "+ num2str(S_12_2));
      write("S_param.txt","S21_2: "+ num2str(S_21_2));
      write("S_param.txt","S22_2: "+ num2str(S_22_2));

       

      Here's a screenshot of the figure window and the created text file:

       

      Let me know if you have any questions.

       

      Regards,
      Amrita

       

      • jeong hee yun
        Subscriber

        Sorry for the late reply. It really helped me a lot. Thank you for your kind reply!

Viewing 1 reply thread
  • You must be logged in to reply to this topic.