Esempio n. 1
0
 def subPlot(self):
     kt = KnifeTest(getCurrentLens(), getCurrentAngle(),
                    getCurrentWavelength(),
                    getDesignWavelength())  # New knife test
     kt.setKnife(CurrentKnife, CurrentKnifeAngle,
                 CurrentKnifeShift)  # Set knife
     kt.setWire(CurrentWire)
     kt.setReference(getReferencePointOption())
     kt.getImage().draw()  # make and plot image
     plt.title(getCurrentLens().title)
Esempio n. 2
0
    def lensPlot(self):
        """
        The default lens plot
        """
        self.figure.clear()  # Clear current figure
        panel = self.figure.add_subplot(111)
        panel.axis('equal')

        # plot data
        getCurrentLens().draw(planes=False)
        plt.grid()
        plt.xlabel("Optical Axis")
        plt.ylabel("Height")
        plt.title("Diagram of lens " + getCurrentLens().title)
        self.canvas.draw()
Esempio n. 3
0
 def subPlot(self):
     global CurrentWaveFront
     wa = WaveFrontAnalysis(getCurrentLens(), getDesignWavelength())
     CurrentWaveFront = wa.fitZernike(getCurrentAngle(),getDefaultWavelength(),ZernikeOrder,\
                                      getReferencePointOption())
     self.interferometer.setWaveFront(CurrentWaveFront)
     self.displayPlot()
Esempio n. 4
0
 def infoButtonClicked(self):
     """
     Lens Information button.
     """
     m = MessageBox("Lens Information",
                    getCurrentLens().getInfo(),
                    parent=self)
     m.setWindowTitle("Information")
     m.show()
Esempio n. 5
0
    def __init__(self, itext="None", dtext="None", parent=None):
        super(MessageBox, self).__init__(parent)

        self.setIcon(QMessageBox.Information)
        self.setText(getCurrentLens().title)
        self.setInformativeText(itext)
        self.setWindowTitle("Message")
        self.setDetailedText(dtext)
        self.setStandardButtons(QMessageBox.Ok)
Esempio n. 6
0
    def subPlot(self):
        """
        Method to set up the spot analysis, and trace the rays. This need to be called
        if any of the geometry of the sytsem changes.
        """

        # Make a new SpotAnalysis object (which will trace the rays)
        self.spot = SpotAnalysis(getCurrentLens(),getCurrentAngle(),getReferencePointOption(),\
                                 getCurrentWavelength(),getDesignWavelength())
        self.updatePlane()
Esempio n. 7
0
    def updatePlane(self):
        """
        Method to update the position of the spot plane only. ((rays are not retraced))

        """
        self.figure.clear()
        self.spot.draw(getPlaneShift())  # Update plot
        pos = self.spot.plane.getPoint().z  # Get poistion of plane
        plt.title(getCurrentLens().title)
        plt.xlabel("Shift : {0:5.4f} Plane at : {1:7.4f}".format(
            getPlaneShift(), pos))
        self.canvas.draw()
Esempio n. 8
0
    def subPlot(self):
        """
        Method to do the actual plot, automatically called
        """
        panel = self.figure.add_subplot(111)
        panel.axis('equal')

        u = getCurrentAngle()
        pencil = RayPencil().addBeam(getCurrentLens(),u,"vl",\
                                               wavelength=getCurrentWavelength()).addMonitor(RayPath())

        #
        #        Set the output plane (being the back focal plane)
        op = getCurrentLens().backFocalPlane()

        #         Propagate pencil through lens and one to back plane
        pencil *= getCurrentLens()  # Through lens
        pencil *= op  # To plane

        # plot data
        getCurrentLens().draw(True, True)
        op.draw()
        pencil.draw()
        plt.grid()
        plt.xlabel("Optical Axis")
        plt.ylabel("Height")
        plt.title("Diagram of lens " + getCurrentLens().title)
Esempio n. 9
0
 def subPlot(self):
     """
     Method to do the actual plot (called automatically
     """
     wa = WaveFrontAnalysis(getCurrentLens(), getDesignWavelength())
     wa.drawAberrationPlot(getCurrentAngle(), getCurrentWavelength())
Esempio n. 10
0
    def __init__(self, lens=None, parent=None):
        super(AbberationViewer, self).__init__(lens, parent)

        if getCurrentLens() != None:
            self.plot()
Esempio n. 11
0
    def __init__(self, lens=None, parent=None):
        super(PltMainWindow, self).__init__(parent)

        # Set size of panel
        self.resize(PanelSize[0], PanelSize[1])
        #  If lens given then set current lens, if not use default lens.
        if lens != None:
            setCurrentLens(lens)

        #     Setup components for plt window
        self.figure = plt.figure()
        self.canvas = FigureCanvas(self.figure)
        toolbar = NavigationToolbar(self.canvas, self)
        self.menubar = self.menuBar()
        self.menubar.setNativeMenuBar(False)

        #      Set up basic menu items
        fileMenu = self.menubar.addMenu("File")
        fileAction = QAction("New Lens", self)
        fileAction.triggered.connect(self.fileButtonClicked)
        fileMenu.addAction(fileAction)
        plotAction = QAction("Replot", self)
        plotAction.triggered.connect(self.plot)
        fileMenu.addAction(plotAction)
        lensAction = QAction("Show Lens", self)
        lensAction.triggered.connect(self.lensPlot)
        fileMenu.addAction(lensAction)
        infoAction = QAction("Lens Info", self)
        infoAction.triggered.connect(self.infoButtonClicked)
        fileMenu.addAction(infoAction)
        exitAction = QAction("Exit", self)
        exitAction.triggered.connect(self.exitButtonClicked)
        fileMenu.addAction(exitAction)

        #      Setup central panel

        layout = QVBoxLayout()
        layout.addWidget(toolbar)
        layout.addWidget(self.canvas)
        panel = QWidget()
        panel.setLayout(layout)
        self.setCentralWidget(panel)

        #      Setup basic options menu (common to all intrefaces)
        optionMenu = self.menubar.addMenu("Options")
        waveAction = QAction("Wavelength", self)
        waveAction.triggered.connect(self.waveButtonClicked)
        optionMenu.addAction(waveAction)
        angleAction = QAction("Angle", self)
        optionMenu.addAction(angleAction)
        angleAction.triggered.connect(self.angleButtonClicked)
        irisAction = QAction("Iris", self)
        optionMenu.addAction(irisAction)
        irisAction.triggered.connect(self.irisButtonClicked)
        referenceAction = QAction("Reference Point", self)
        referenceAction.triggered.connect(self.referenceButtonClicked)
        optionMenu.addAction(referenceAction)

        # Do a default plot of the lens if one exits
        if getCurrentLens() == None:
            self.fileButtonClicked()
        else:
            self.lensPlot()
Esempio n. 12
0
 def valueChange(self):
     global IrisRatio
     self.irisRatio = self.irisDial.value() / 100.0
     self.irisLabel.setText("Iris : " + str(self.irisRatio))
     IrisRatio = self.irisRatio
     getCurrentLens().setIris(self.irisRatio)