Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several compatibility issue #30

Open
maxime-rey opened this issue Mar 28, 2019 · 1 comment
Open

Several compatibility issue #30

maxime-rey opened this issue Mar 28, 2019 · 1 comment

Comments

@maxime-rey
Copy link

Hello,
I think there are some minor changes to do that hopefully may help others in the future and a problem for which I haven't found the solution. All I did for these errors to occur was to test the "Example 1: Basic functions introduction" from the website of opticspy.


• If you have the message No module named 'aperture' , the problem comes from the version installed, you installed the python 2 version and are using it as a python 3.
-- "pip install" installed the Python 2 version. I don't know how it works but it may need to be updated.
-- on http://opticspy.org/, the link to download it is also for Python2 (even though in this case it's more obvious that it's 2)
Solution → clone the repo on git and run python setup.py install (or replace python by python3 if you have python 2 as default).

No module named 'lens'
Solution → go into opticspy/ray_tracing/codev.py and replace import lens by from . import lens.

No module named glass
Solution → go into the file from which you installed if you cloned and in ray_tracing/ you should find a folder glass_database. Copy it and paste it where opticspy has been installed (it should be written on the error message)

• Now this is the error for which I didn't find the solution. When trying to trace the rays with draw.draw_system(New_Lens), the error local variable 'verts' referenced before assignment is returned. The source of the problem is the following. It's in /opticspy/ray_tracing/draw.py in draw_surface(r, x0, d1, d2).

      27         verts = [[verts_1[-1][0],d2/2]] + verts_1[::-1] + verts_2[1:] + [[verts_2[-1][0],-d2/2]]
      28     codes.append(Path.MOVETO)
--->  29     for j in range(len(verts)-1):
      30         codes.append(Path.LINETO) 

I tried to rename it and reassign a value before in case there was a problem with a global variable which had the same name but it doesn't seems to be it.


I hope this message belongs here, isn't too long and will be helpful for some !

@FabioGentile88
Copy link

FabioGentile88 commented Mar 29, 2019

I had a similar problem. When prompting dict_list = trace.trace_draw_ray(New_Lens) draw.draw_system(New_Lens)
I got the error AttributeError: module 'trace' has no attribute 'trace_draw_ray' I solved the problem (inspired from your very post, so yes your message was useful! 👍 ) modifying import trace into from . import trace in draw.py .
Maybe is still some doggy library importing issue?! [Hope it helps]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants