HarrisonKramer / optiland

Lens design, optimization, and analysis in Python
https://optiland.readthedocs.io/
MIT License
24 stars 4 forks source link

No Surface modules found in 0.1.4 #4

Closed edavidfs closed 3 hours ago

edavidfs commented 3 hours ago

First of all congratulations for this project, it is perfectly documented. It is a pleasure to learn optics with it.

In the last update, the package is incomplete. I have tested in a new virtual environment with pip install and the internal modules like “surfaces” is not found. When importing the module “optics” an error occurs:

  > from optiland import optic

  ModuleNotFoundError                       Traceback (most recent call last)
  Cell In[1], line 1
  ----> 1 from optiland import optic

  File [~/.local/share/virtualenvs/jupyterlab-test-bdrxnWjE/lib/python3.11/site-packages/optiland/optic.py:11](.....)
        9 import numpy as np
       10 from optiland.fields import Field, FieldGroup
  ---> 11 from optiland.surfaces import SurfaceGroup, ObjectSurface
       12 from optiland.wavelength import WavelengthGroup
       13 from optiland.paraxial import Paraxial

  ModuleNotFoundError: No module named 'optiland.surfaces'

I think it is because these files are now modules, and they are not indicated in the pyproject.toml. I don't know if it is correct to add these modules in the toml files as:

[tool.setuptools]
packages = ["optiland", "database", 
    "optiland.analysis",
    "optiland.geometries",
    "optiland.materials",
    "optiland.optimization",
    "optiland.rays",
    "optiland.samples",
    "optiland.surfaces",
    "optiland.tolerancing", 
    ]

In a clean commit I have added it, compiled optiland and installed in a clean project and it works.

I hope it will be of help to this excellent project

HarrisonKramer commented 3 hours ago

Thanks for reporting this!

I confirmed the issue in a clean environment. I implemented your suggestion in commit eb297458ff and confirmed that it solved the issue. The commit is rolled into v0.1.5, which is now published on pypi.

Thanks again, and please let me know if you find another issue or have any other remarks or suggestions.