mjhoptics / ray-optics

geometric ray tracing for optical systems
BSD 3-Clause "New" or "Revised" License
263 stars 54 forks source link

module 'rayoptics.elem.elements' has no attribute 'DummyInterface' #133

Closed lindeMAX closed 4 months ago

lindeMAX commented 9 months ago

Hi, i just wanted to try out some stuff but as soon as a new optical model is to be created it throws the error message used for the title.

I reduced the script to the following:

from rayoptics.environment import *
opm = OpticalModel()

For some reason this here works flawless:

from rayoptics.elem.elements import DummyInterface

Here is the complete error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[17], line 1
----> 1 opm = OpticalModel()

File ~/pythen_env/lib/python3.11/site-packages/rayoptics/optical/opticalmodel.py:135, in OpticalModel.__init__(self, radius_mode, specsheet, **kwargs)
    132 if kwargs.get('do_init', True):
    133     # need to do this after OpticalSpec is initialized
    134     self.seq_model.update_model()
--> 135     elements_from_sequence(self.ele_model,
    136                            self.seq_model,
    137                            self.part_tree)

File ~/pythen_env/lib/python3.11/site-packages/rayoptics/elem/parttree.py:362, in elements_from_sequence(ele_model, seq_model, part_tree)
    360 num_eles = len(eles)
    361 if num_eles == 0:
--> 362     process_airgap(
    363         ele_model, seq_model, part_tree,
    364         i, g, z_dir, ifc, g_tfrm, add_ele=True)
    365 else:
    366     if buried_reflector is True:

File ~/pythen_env/lib/python3.11/site-packages/rayoptics/elem/parttree.py:484, in process_airgap(ele_model, seq_model, part_tree, i, g, z_dir, s, g_tfrm, add_ele)
    482 if add_dummy:
    483     sd = s.surface_od()
--> 484     di = elements.DummyInterface(s, sd=sd, tfrm=g_tfrm, idx=i,
    485                                  label=dummy_label)
    486     part_tree.add_element_to_tree(di, tag=dummy_tag)
    487     ele_model.add_element(di)

AttributeError: module 'rayoptics.elem.elements' has no attribute 'DummyInterface'

Btw.: I installed ryoptics (version 0.8.5) via pip

Kind regards

mjhoptics commented 9 months ago

Hello @lindeMAX, I looked at your report and I'm afraid I can't reproduce the issue. I tried both pip-based virtualenvs and conda envs without a problem. It might be worth uninstalling rayoptics and installing again, just to clean the slate, so to speak. Sorry for the delay in responding. Mike Hayford

mjhoptics commented 4 months ago

closed because unreproducible