Photonics

Photonics

Topics related to Lumerical and more.

Can I import parameters from txt file?

    • xuzhihe
      Subscriber

      Hello everyone,

      I tried to sweep the parameters. I stored these parameters in my txt file. Is it possible to import these three parameters from my local txt file? Or I have to build my own API to import local parameters? Could anyone give me a hand? I really appreciate help and patience.?

    • Kyle
      Ansys Employee

      You can import data from a text file into the Script Workspace as a matrix using the readdata command:
      Once the data is in the Script Workspace it can be set as the parameters of the sweep using script commands. For information on creating script commands to create parameter sweeps please see:
      I modified the script on that page to use values instead of ranges:
      addsweep;
      setsweep("sweep", "name", "thickness_sweep_script");
      setsweep("thickness_sweep_script", "type", "Values");
      setsweep("thickness_sweep_script", "number of points", 3);

      thickness_matrix = linspace(0, 1e-6, 3);

      para = struct;
      para.Name = "thickness";
      para.Parameter = "::model::AR structure::thickness";
      para.Type = "Length";
      para.Value_1 = thickness_matrix(1);
      para.Value_2 = thickness_matrix(2);
      para.Value_3 = thickness_matrix(3);
      para.Units = "microns";

      # add the parameter thickness to the sweep
      addsweepparameter("thickness_sweep_script", para);



    • chatte29
      Subscriber

      This is not very clear. Where are we supposed to plug these values in?

Viewing 2 reply threads
  • The topic ‘Can I import parameters from txt file?’ is closed to new replies.