Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
width=0.1, fc='g', ec='g',
head_length=arrowHeight, head_width=arrowWidth,
length_includes_head=True)
axes.arrow(position, -size-arrowSize, 0, arrowSize,
width=0.1, fc='g', ec='g',
head_length=arrowHeight, head_width=arrowWidth,
length_includes_head=True)
""" Synonym of Matrix: Element
We can use a mathematical language (Matrix) or optics terms (Element)
"""
Element = Matrix
Group = MatrixGroup
OpticalPath = ImagingPath
def drawBeamTrace(self, axes, beam):
""" Draw beam trace corresponding to input beam
Because the laser beam diffracts through space, we cannot
simply propagate the beam over large distances and trace it
(as opposed to rays, where we can). We must split Space()
elements into sub elements to watch the beam size expand.
We arbitrarily split Space() elements into 100 sub elements
before plotting.
"""
highResolution = ImagingPath()
for element in self.elements:
if isinstance(element, Space):
for i in range(100):
highResolution.append(Space(d=element.L/100,
n=element.frontIndex))
else:
highResolution.append(element)
beamTrace = highResolution.trace(beam)
(x, y) = self.rearrangeBeamTraceForPlotting(beamTrace)
axes.plot(x, y, 'r', linewidth=1)
axes.plot(x, [-v for v in y], 'r', linewidth=1)
def ImagingPath(self):
return ImagingPath(elements=self.elements, label=self.label)
self.fanNumber = 9 # number of rays in fan
self.rayNumber = 3 # number of points on object
# Constants when calculating field stop
self.precision = 0.001
self.maxHeight = 10000.0
# Display properties
self.showObject = True
self.showImages = True
self.showEntrancePupil = True
self.showElementLabels = True
self.showPointsOfInterest = True
self.showPointsOfInterestLabels = True
self.showPlanesAcrossPointsOfInterest = True
super(ImagingPath, self).__init__(elements=elements, label=label)