Garchupiter / Kraken-Optical-Simulator

Python - Exact ray tracing library
GNU General Public License v3.0
62 stars 12 forks source link

Pup.FieldX and Pup.FieldY Limitations (Large Field of View Optical Systems) #13

Open danieleceUL opened 2 months ago

danieleceUL commented 2 months ago

Hi all:-

I am wondering whether anyone has gotten this issue before. I am modelling an 80+ degrees Field of View lens and I am trying to do ray-tracing on it past the 80 degrees point from the aperture stop. Everything works well up until 40 degrees. At this value and past this, I get errors or noise in outputs despite the lens being visibly drawn by the tool past this field of view. When I input Pup.FieldX= 40, Pup.FieldX= 40 or greater values to any lens design, I get the following error:


AxisError Traceback (most recent call last) /tmp/ipykernel_1579/2513054998.py in 9 Pupil.FieldX = 40 10 Pupil.FieldY = 40 ---> 11 X, Y, Z, P2V = Kos.Phase(Pupil) 12 X.shape, Y.shape, Z.shape 13 print("Peak to valley: ", P2V)

~/python3.7/site-packages/KrakenOS/PhaseCalc.py in Phase(PUPIL) 149 print('All_Rays: ', All_Rays, 'Shape: ', All_Rays.shape) 150 axis = 1 --> 151 AR = (np.sum(All_Rays,axis) - All_Rays[:,0]) - All_Rays[:,-1]*2 152 153

<__array_function__ internals> in sum(*args, **kwargs) ~/python3.7/site-packages/numpy/core/fromnumeric.py in sum(a, axis, dtype, out, keepdims, initial, where) 2246 2247 return _wrapreduction(a, np.add, 'sum', axis, dtype, out, keepdims=keepdims, -> 2248 initial=initial, where=where) 2249 2250 ~/python3.7/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs) 85 return reduction(axis=axis, out=out, **passkwargs) 86 ---> 87 return ufunc.reduce(obj, axis, dtype, out, **passkwargs) 88 89 AxisError: axis 1 is out of bounds for array of dimension 1 > From my investigation, there are problems with the _'AR'_ variable where it should be of shape (721,17) not (721,) which is one dimensional. Visibly the rays are not being drawn past this point unfortunately. Do you think anyone would know why this is? Just to give you an idea, I'm trying to do an optical system that can be traced like this: ![image](https://github.com/Garchupiter/Kraken-Optical-Simulator/assets/113525778/c20c9b2f-d419-4150-a69d-8fdaca6c4528) Source: https://www.cloudynights.com/topic/666428-lens-designreverse-engineering/page-2
Garchupiter commented 2 months ago

Hi,

Thank you for reaching out and detailing the issue you're encountering with your lens model.

To assist you better, could you please share the file you are working on? Having access to your model will help me understand the specific setup and errors more clearly. Additionally, if you could provide any screenshots or further details about the errors and noise you're observing, that would be immensely helpful.

Looking forward to your response.

Best regards,

Joel H. V.

El 5 jun 2024, a las 5:23 a.m., Dan-Boltzmann @.***> escribió:

Hi all:-

I am wondering whether anyone has gotten this issue before. I am modelling an 80+ degrees Field of View lens and I am trying to do ray-tracing on it past the 80 degrees point from the aperture stop. Everything works well up until 40 degrees. At this value and past this, I get errors or noise in outputs despite the lens being visibly drawn by the tool past this field of view. When I input Pup.FieldX= 40, Pup.FieldX= 40 or greater values to any lens design, I get the following error:

Dr. Joel Herrera Vázquez Observatorio Astronómico Nacional Instituto de Astronomía de la UNAM (Sede Ensenada B.C.)

Tel. (646) 1 74 45 80 Ext.426

danieleceUL commented 2 months ago

Dear Joel H. V.:-

I very much appreciate your quick reply and your willingness to help out! I wasn't able to attach my jupyter notebook files of the fisheye design here so I will send this on to you via your email attached in the README. Hopefully, you will find our design interesting and perhaps there is a solution to this mysterious ray-tracing and PSF generation problem.

Best Regards, Daniel Jakab, Github: danieleceUL