Exception in NISTMultilineTRL

21 views
Skip to first unread message

Serhat Erdoğan

unread,
Sep 2, 2022, 11:50:03 AM9/2/22
to scikit-rf
Hi all,

Today I realized that I was using an earlier version of skrf (0.16.0) and updated to the latest version. Some things broke after this update. I can no longer use NISTMultilineTRL in my code.

I am trying to run a TRL calibration with multiple lines. Below is the list of structures that I input to the NISTMultilineTRL class:
[2-Port Network: 'D001.3.7_ms_to_ms_100um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'Reflect', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'D001.3.7_ms_to_ms_200um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'D001.3.7_ms_to_ms_250um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'D001.3.7_ms_to_ms_300um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'D001.3.7_ms_to_ms_400um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j], 2-Port Network: 'D001.3.7_ms_to_ms_600um', 1.0-170.0 GHz, 1691 pts, z0=[50.+0.j 50.+0.j]]

I also have the line lengths as a numpy array of the following format:
array([1.0e-04, 2.0e-04, 2.5e-04, 3.0e-04, 4.0e-04, 6.0e-04])

And I create the cal object using the following code:

cal = skrf.calibration.NISTMultilineTRL(measured, Grefls = [-1], l=l, er_est=7)

I do not use switch terms because this TRL is a secondary calibration therefore switch terms are already accounted for.

When I try to access the error network I get the following exception:
cal.error_ntwk[0].plot_s_db(1,0)

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\skrf\calibration\calibration.py:515, in Calibration.coefs(self) 514 try: --> 515 return self._coefs 516 except(AttributeError): AttributeError: 'NISTMultilineTRL' object has no attribute '_coefs' During handling of the above exception, another exception occurred: IndexError Traceback (most recent call last) Input In [48], in <cell line: 1>() ----> 1 cal.error_ntwk[0].plot_s_db(1,0) File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\skrf\calibration\calibration.py:906, in Calibration.error_ntwk(self) 893 @property 894 def error_ntwk(self): 895 """ 896 The calculated error Network or Network[s]. 897 (...) 903 904 """ 905 return error_dict_2_network( --> 906 self.coefs, 907 frequency = self.frequency, 908 is_reciprocal= self.is_reciprocal) File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\skrf\calibration\calibration.py:517, in Calibration.coefs(self) 515 return self._coefs 516 except(AttributeError): --> 517 self.run() 518 return self._coefs File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\skrf\calibration\calibration.py:3133, in NISTMultilineTRL.run(self) 3131 if self.ref_plane != 0: 3132 try: -> 3133 shift1 = exp(-2*gamma[m]*self.ref_plane[0]) 3134 shift2 = exp(-2*gamma[m]*self.ref_plane[1]) 3135 except TypeError: IndexError: invalid index to scalar variable.


I would appreciate any help regarding this issue. This happened right after I updated the skrf package so I am assuming during a recent release something got broken.

Best,
Serhat

Serhat Erdoğan

unread,
Sep 2, 2022, 11:51:59 AM9/2/22
to scikit-rf
Below is the error message with a more readable formatting:

Serhat Erdoğan

unread,
Sep 2, 2022, 12:03:26 PM9/2/22
to scikit-rf
Upon further testing I noticed that the issue is caused by line lengths being a numpy array.

When I make it a python list, it seems to be working fine. However, converting the numpy array to list before inputting it to the calibration still does not work. That's because after converting numpy array to a list, the elements of the list are of type numpy.float64 rather than python float, which causes issues in the code. It might be worth fixing this. 

Julien Hillairet

unread,
Sep 6, 2022, 3:26:46 PM9/6/22
to scikit-rf
Dear Serhat,

Could open an issue on GitHub with a minimal example leading to the error ?

Many thanks,

Julien
Reply all
Reply to author
Forward
0 new messages