Hello,
I cannot change the position of an object. If I try changing the z position, it gives an error.
path = ImagingPath()
path.append(Space(d=10))
path.append(Lens(f=5, diameter=3))
path.append(Space(d=3))
path.append(Aperture(diameter=3))
path.append(Space(d=17))
path.display(ObjectRays(5, 0.1, z=2),
removeBlocked=False)
AttributeError Traceback (most recent call last)
Cell In[10], line 7
5 path.append(Aperture(diameter=3))
6 path.append(Space(d=17))
----> 7 path.display(ObjectRays(5, 0.1, z=2),
8 removeBlocked=False)
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/imagingpath.py:1007, in ImagingPath.display(self, rays, raysList, removeBlocked, comments, onlyPrincipalAndAxialRays, limitObjectToFieldOfView, interactive, filePath)
1004 else:
1005 self.figure.designParams['showObjectImage'] = True
-> 1007 self.figure.display(raysList=raysList, comments=comments, title=self.label,
1008 backend='matplotlib', display3D=False, interactive=interactive, filepath=filePath)
1010 savedDesignParams = self.figure.designParams
1011 self.figure = Figure(opticalPath=self)
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:537, in Figure.display(self, raysList, comments, title, backend, display3D, interactive, filepath)
533 def display(self, raysList, comments=None, title=None, backend='matplotlib',
534 display3D=False, interactive=True, filepath=None):
535 self.raysList = raysList
--> 537 self.setLinesFromRaysList()
539 self.setPrincipalAndAxialRays()
540 self.setGraphicsFromOpticalPath()
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:223, in Figure.setLinesFromRaysList(self)
221 def setLinesFromRaysList(self):
222 for rays in self.raysList:
--> 223 rayTrace = self.rayTraceLines(rays=rays)
225 instance = type(rays).name
226 if instance == 'ObjectRays':
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:402, in Figure.rayTraceLines(self, rays, lineWidth)
400 ray.z = -abs(ray.z)
401 manyRayTraces = forwardRayTraces
--> 402 manyRayTraces.extend(backwardRayTraces)
403 else:
404 manyRayTraces = self.path.traceMany(rays)
AttributeError: 'RayTraces' object has no attribute 'extend'
Perhaps something changed after this thread from 2020? #230
Thank you!
Hello,
I cannot change the position of an object. If I try changing the z position, it gives an error.
path = ImagingPath()
path.append(Space(d=10))
path.append(Lens(f=5, diameter=3))
path.append(Space(d=3))
path.append(Aperture(diameter=3))
path.append(Space(d=17))
path.display(ObjectRays(5, 0.1, z=2),
removeBlocked=False)
AttributeError Traceback (most recent call last)
Cell In[10], line 7
5 path.append(Aperture(diameter=3))
6 path.append(Space(d=17))
----> 7 path.display(ObjectRays(5, 0.1, z=2),
8 removeBlocked=False)
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/imagingpath.py:1007, in ImagingPath.display(self, rays, raysList, removeBlocked, comments, onlyPrincipalAndAxialRays, limitObjectToFieldOfView, interactive, filePath)
1004 else:
1005 self.figure.designParams['showObjectImage'] = True
-> 1007 self.figure.display(raysList=raysList, comments=comments, title=self.label,
1008 backend='matplotlib', display3D=False, interactive=interactive, filepath=filePath)
1010 savedDesignParams = self.figure.designParams
1011 self.figure = Figure(opticalPath=self)
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:537, in Figure.display(self, raysList, comments, title, backend, display3D, interactive, filepath)
533 def display(self, raysList, comments=None, title=None, backend='matplotlib',
534 display3D=False, interactive=True, filepath=None):
535 self.raysList = raysList
--> 537 self.setLinesFromRaysList()
539 self.setPrincipalAndAxialRays()
540 self.setGraphicsFromOpticalPath()
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:223, in Figure.setLinesFromRaysList(self)
221 def setLinesFromRaysList(self):
222 for rays in self.raysList:
--> 223 rayTrace = self.rayTraceLines(rays=rays)
225 instance = type(rays).name
226 if instance == 'ObjectRays':
File ~/opt/anaconda3/envs/raytracing/lib/python3.13/site-packages/raytracing/figure.py:402, in Figure.rayTraceLines(self, rays, lineWidth)
400 ray.z = -abs(ray.z)
401 manyRayTraces = forwardRayTraces
--> 402 manyRayTraces.extend(backwardRayTraces)
403 else:
404 manyRayTraces = self.path.traceMany(rays)
AttributeError: 'RayTraces' object has no attribute 'extend'
Perhaps something changed after this thread from 2020? #230
Thank you!