cihologramas / pyoptools

Python tools for optical design
GNU General Public License v3.0
136 stars 45 forks source link

Error on Thorlabs catalog #141

Open ramezquitao opened 1 year ago

ramezquitao commented 1 year ago

While correcting FreeCAD-pyOpTools to work with the new part catalogs in JSON, I found that some cylindrical lenses have the Width and Length inverted. For example, the cylindrical lens LJ1014L1, that according to the Thorlabs catalog has a size of H = 16.00 mm, L = 18.0 mm, but when importing the lens it gives:

L=library.Thorlabs["LJ1014L1"]
print("Size=",L.size)

Size= [9, 8]

that means H=18 and L=16 mm, which is wrong.

Testing the same code with another reference (LJ1125L2) that according to the Thorlabs catalog has a size of H = 20.00 mm, L = 40.0 mm, gives

L=library.Thorlabs["LJ1125L2"]
print("Size=",L.size)

Size= [10, 20]

That is the correct answer (H=20, L=40).

It seems that some lenses are just wrong in the thorlabs catalog, and this could be corrected in the pyoptools catalog. But how do we avoid to introduce wrong data again in the catalog, if the lens data is re imported from the Thorlabs catalog file?

@rdgraham what do you think?

rdgraham commented 1 year ago

Interesting finding.

I checked the raw zmx data, and indeed it seems the order of the values for the SQAP (presumably means square aperture) entry is not consistent for these parts.

Although since we are guessing at the details of an undocumented file format, there is a chance that it isn't actually 'wrong'. Zemax might import it correctly, due to either a bug or just a weird file format. Unfortunately, I don't have access to zemax myself to verify.

What I noticed that there are some additional entries for the surfaces that were are not using;

both of these have a number corresponding only to the height in the first position, and that is consistent at least for these two examples.

I think some further investigation is needed to see what is going on. Would be helpful to see if this is a unique case or if there are others.

I have pasted below the relevant parts of the raw data:

From python zemax_import.py Thorlabs_10-2022.ZMF -d -p LJ1014L1 :

SURF 1
  COMM LJ1014L1
  STOP
  TYPE TOROIDAL
  FIMP 

  CURV 7.621951219512194953E-02
  PARM 0 0
  PARM 1 0
  PARM 2 0
  PARM 3 0
  PARM 4 0
  PARM 5 0
  PARM 6 0
  PARM 7 0
  PARM 8 0
  XDAT 1 0.000000000000E+00 0 0 1.000000000000E+00 0.000000000000E+00 0 ""
  XDAT 2 1.000000000000E+02 0 0 1.000000000000E+00 0.000000000000E+00 0 ""
  DISZ 4.7199999999999998
  GLAS N-BK7
  DIAM 8 1 0 0 1 ""
  MEMA 8 0 0 0 1 ""
  SQAP 8 9 0

and for python zemax_import.py Thorlabs_10-2022.ZMF -d -p LJ1125L2

SURF 1
  COMM LJ1125L2
  STOP
  TYPE TOROIDAL
  FIMP 

  CURV 4.837929366231250028E-02
  PARM 0 0
  PARM 1 0
  PARM 2 0
  PARM 3 0
  PARM 4 0
  PARM 5 0
  PARM 6 0
  PARM 7 0
  PARM 8 0
  XDAT 1 0.000000000000E+00 0 0 1.000000000000E+00 0.000000000000E+00 0 ""
  XDAT 2 1.000000000000E+02 0 0 1.000000000000E+00 0.000000000000E+00 0 ""
  DISZ 4.5700000000000003
  GLAS N-BK7
  DIAM 10 1 0 0 1 ""
  MEMA 10 0 0 0 1 ""
  SQAP 20 10 0
ramezquitao commented 1 year ago

I have an old PDF with description of the zmx file format, yow can download it from http://diaxen.ssji.net/zmx_format.pdf . In this PDF there is no information about the MEMA entry. I will keep looking to se if we can find a better description of the zmx format.

rdgraham commented 1 year ago

Thank you for posting. I don't believe this information is publicly available anymore, and could be useful.

It seems to be incomplete, but at least it establishes that there is a defined order for the SQAP parameters.