Photonics

Photonics

Topics related to Lumerical and more.

readdata script not working in Lumerical 2024 R2.3

TAGGED: 

    • johannes.haataja
      Subscriber

      I believe the readdata script command is not working properly, or more precily, cannot read decimals and scientific notation.

      For instance using the example testfile.txt:

      Time Value
      0.0 3.2e-6
      1.0 2.8e10
      2.0 4.1e5
      3.0 3.3 

      provided on the documentation page of readdata results in:

      M=readdata("testfile.txt");
      ?M;
      result: 
      0  3  
      1  2  
      2  4  
      3  3

      I'm hoping someone could verify the issue (and I hope Ansys will fix the command ASAP).

    • Kirill
      Ansys Employee

      Hello johannes.haataja,

      I've just checked the script in Lumerical 2024 R2.3. Here is my result:

      M = readdata("testfile.txt");
      ?M;
      

      Result:
      0    3.2e-06
      1    2.8e+10
      2    410000
      3    3.3

      As a debugging step, try to write data to the file and then read it back form it.

      Best regards,

      Kirill

    • johannes.haataja
      Subscriber

       

      Much obliged Kirill for your help, 
        I don’t know why I get different behavious. I’ve replicated the issue on Lumerical 2024 R2.2 and R2.3 on two different Ubuntu systems.

      Manipulating elements of M inside Lumerical to have 

       

      0  3.2e-06  
      1  2.8e+10  
      2  410000  
      3  3.3 

       

      then using write function

       

      write('writetest.txt',num2str(M),'overwrite');
      M2 = readdata('writetest.txt');
      ?M2;
      result: 
      0  3  
      1  2  
      2  410000  
      3  3


      Perhaps as temporary solution, I'll multiply the values of my data file by some large enough prefactor and then divide M by the same prefactor to get the desired outcome.

    • Kirill
      Ansys Employee

      Hello johannes.haataja,

      1. Check if the data is being saved correctly. What output do you get in writetest.txt when you open it manually in a text editor? Also consider formatting the data while saving it to the file; see format and num2str functions.

      2. I’m not sure if this is relevant in your case, but you can use MATLAB (.mat) files to save and load data. Check out the matlabsave / matlabload functions.

      3. The Lumerical Data File (LDF) format might be another option; consider the loaddata / savedata functions.

      4. Double-check the System Requirements and Ubuntu Linux installation guide.

      Best regards,
      Kirill

Viewing 3 reply threads
  • You must be logged in to reply to this topic.