rayopt icon indicating copy to clipboard operation
rayopt copied to clipboard

Library.get_all: material None/None/sk16 not found

Open antonysigma opened this issue 11 months ago • 5 comments

Hi I like the rayopt library and the integration with the scipy.optimize for lens curvature optimization. However, when I run the tutorial Triplet.ipynb in the rayopt-notebook repo, it fails to retrieve the material Schott/SK4. What is missing in the installation?

Reference: https://github.com/quartiq/rayopt-notebooks/blob/master/triplet.ipynb

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-ab0625f0217a> in <module>
     55 """
     56 
---> 57 s = system_from_text(text, columns.split(),
     58     description=description)
     59 s.object.angle = np.deg2rad(20)

~/Projects/raytracing/venv/lib/python3.8/site-packages/rayopt/formats.py in system_from_text(text, *args, **kwargs)
     83     n = max(len(l) for l in array)
     84     array = [l for l in array if len(l) == n]
---> 85     return system_from_array(array, *args, **kwargs)
     86 
     87 

~/Projects/raytracing/venv/lib/python3.8/site-packages/rayopt/formats.py in system_from_array(data, columns, shifts, material_map, **kwargs)
     74             mat = try_get(line, columns, "material")
     75             mat = material_map.get(mat, mat)
---> 76             m = Material.make(mat)
     77             el.material = m
     78     return s

~/Projects/raytracing/venv/lib/python3.8/site-packages/rayopt/material.py in make(cls, name)
    116         from .library import Library
    117         lib = Library.one()
--> 118         return lib.get("material", name, catalog, source)
    119 
    120     def __str__(self):

~/Projects/raytracing/venv/lib/python3.8/site-packages/rayopt/library.py in get(self, *args, **kwargs)
    118 
    119     def get(self, *args, **kwargs):
--> 120         for k in self.get_all(*args, **kwargs):
    121             return k
    122 

~/Projects/raytracing/venv/lib/python3.8/site-packages/rayopt/library.py in get_all(self, typ, name, catalog, source, **kwargs)
    132         res = res.order_by(Typ.name)
    133         if not res.count():
--> 134             raise KeyError("{} {}/{}/{} not found".format(
    135                 typ, source, catalog, name))
    136         for item in res:

KeyError: 'material None/None/sk16 not found'

antonysigma avatar Aug 14 '23 23:08 antonysigma