Some issues with loading text files

script
interconnect
modulator
smatrix
sparameter

#1

I have been trying to use “Electrical N Port S-Parameter” and “Optical Modulator Measured” to make a compact model for electroabsorption modulator lately. There are some issues that are not addressed really well by INTERCONNECT.

In either “Electrical N Port S-Parameter” or “Optical Modulator Measured”, under standard, there is “s parameters” or “measurement” that shows the data loaded from the text files. Both field are officially read only. To me this sounds unnecessary and inconvenient. Here is the reason. Let’s say I want to make customized components based on some user defined S parameters. If I want to do this entirely based on INTERCONNECT, I would have to use INTERCONNECT to write the s parameter file and then load it back in. This seems to be a quite round-about way of solving the problem, not to mention that writing and loading take quite a bit of simulation time. Instead, the user should be able to directly input the data in “s parameters” or “measurement” as a direct one-step approach.

Actually, for some elements like “Optical Modulator Measured” or “Optical S-Parameter”, the “s parameters” and “measurement” are actually addressable by “set” command, which is very convenient for me. They are only officially “read only” according to the manual. But for element like “Electrical N Port S-Parameter”, such field is indeed read only.

Since I have to, in some case, write text file using INTERCONNECT command, I often face the scenario of having to write a matrix of data into a .s2p file using num2str. num2str generates tab separated column, which cannot seems to be recognized by INTERCONNECT. I have attached two identical .s2p files, one generated by MATLAB with space separated column, the other generated by INTERCONNECT with tab separated column. Only the former works. I have change the extention to .txt because KX does not allow me to upload the .s2p file. Simply change it back to .s2p after you download it.

Is there a way of generating large text data file containing space separated column without using for loop? If not, can we add this feature in the future release?

EAM_electrical.txt (91.6 KB)

EAM_s.txt (139.8 KB)


#2

Hi @z_zhang,

Regarding your questions:

The ‘s parameter’ tab under the ‘Electrical N Port S-Parameter’ element is indeed read only and it is only for the purpose of showing and checking the data. On the other hand, the ‘measurement’ table for the ‘Optical Modulator Measured’ is editable (the same for the ‘s parameters’ table for the ‘Optical 1xN S Parameter’ and ‘Optical S Parameter’ elements). If you set the ‘load from file’ to ‘true’ and load the file, then in order to modify the table, you have to set the ‘load from file’ to ‘false’ again. If you don’t want to load a file to the element to start with, you can directly modify the table of the s-parameters.

Some of the s-parameter files come from component level simulations, such as the example Grating coupler 2D-FDTD and Ring resonator MODE. For the ‘Optical Modulator Measured’ element in particular, the loaded in data is either ‘effective index versus voltage’ or ‘absorption & phase versus voltage’, which is usually created by DEVICE plus MODE simulations.

Given that we are developing the automation API, I agree to your point that the communication through files (for the saving and the loading processes) is time consuming, and it would be great if the elements can read in matrix directly. I will definitely elevate this aspect up to the developer team and keep you in the loop for the outcomes.

This is a bug in this element and we have quickly fixed it. The fixed version will be in the next minor release, and I will let you know when it is available.

To compromise for this by now, I’d rather do a ‘replacestring’ in the file instead of using the for loops to write to it in the first place. You can also do a replace in the text editor, that would also work.

Thank you for raising these problems up, I hope this could help :slight_smile:


#3

Thanks for the kind reply!

Is there an example of using DEVICE and MODE to obtain the absorption and phase shift of the modulator? I would like to try this way and compare with our experimental result.


#4

You are welcome. The Travelling Wave Modulator is a good example using DEVICE and MODE for the effective index versus voltage data. The example also considers small signal and RF effects so the steps is a little bit long, but it should be very easy to follow. Let me know if you have any difficulties reading it :slight_smile:


#5

I am trying to use the replacestring command to replace the tabs with space. What is the tab character in Lumerical scripting language?


#6

It’s the same as all other string writings, ‘\t’ for tab and ’ ’ for space. Use ‘num2str’ first to get the string and then replace all ‘\t’ by ’ '. Let me know if you have any difficulties implementing this :slight_smile:


#7

I might be wrong. But I don’t think INTERCONNECT recognizes “\t”.


#8

Hi @z_zhang,

You are right that our script command doesn’t recognize ‘\t’ for tab. And the actually ‘Tab’ button can only be recognized in the ‘Script Prompt’ but not in the ‘Script File Editor’. Sorry about the misleading information I gave before. I’ve reported this bug. I am pretty sure the inconsistency between the ‘Script Prompt’ and ‘Script File Editor’ problem will be addressed soon, but not so sure about when we can finish adding more character recognitions to the script since there are more to concern behind the scene. I will let you know when the bug is fixed.

By now, please try to replace the string in the text editor. After all, I was informed that the ‘Electrical N Port S Parameter’ element now treats tab and space indifferently. As soon as the next minor release is out, you don’t need to worry about this problem any more.

Sorry about all the inconvenience :pensive: