cihologramas / pyoptools

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

Materials defined as aliases can be pulled from any catalog #137

Closed ramezquitao closed 1 year ago

ramezquitao commented 1 year ago

The process to retrieve a material from the wrong catalog should give an error. This happens with all the materials defined in the catalogs, but when the material is defined as an alias behavior is not correct. Any aliased material can be retrieved from any library.

As an example, the BK7 material is defined as an alias, so it can be retrieved from the library material using:

In [2]: material["BK7"]
Out[2]: <pyoptools.raytrace.mat_lib.mat_eq.Sellmeier_2 at 0x7fda893ef2e0>

But if we try to retrieve it it from an specific catalog (schott or ami in this example) it should give an error, as the material "BK7" it is not defined in those catalogs. Instead, the library is returning the aliased material:

In [3]: material.schott["BK7"]
Out[3]: <pyoptools.raytrace.mat_lib.mat_eq.Sellmeier_2 at 0x7fda8a8ff340>

In [4]: material.ami["BK7"]
Out[4]: <pyoptools.raytrace.mat_lib.mat_eq.Sellmeier_2 at 0x7fda8a8ff910>

This problem happen with all aliased materials.