def readLastReferencePosition(self):
        """
        get last reference position
        """

        Save = saveClass(config)
        self.config = Save.readLastConfig(calcDict)
    def setGoalCenter(self, mirror):
        if not self.Save:
            self.Save = saveClass()

        if not self.Save.readLastConfig(calcDict):
            calcDict[mirror]["GoalPixel_X"] = float(
                calcDict[mirror]["GoalCenter_X"])
            calcDict[mirror]["GoalPixel_Y"] = float(
                calcDict[mirror]["GoalCenter_Y"])
    def newCenter(self):
        """
        write current center as reference too file and dictionary
        """

        self.Save = saveClass(config)
        self.Save.writeNewCenter(calcDict)

        for i in range(2):
            self.setCenterValue(i)
    def __init__(self, parent=None):

        super(MyWindow, self).__init__(parent)

        # load GUI from .ui file (created in QtDesigner)
        self.ui = uic.loadUi('GUI\\Beamstabilization_V2.ui', self)

        # Variables used for Tracking Initialization Status and GUI Choices
        self.status = "StandBy"
        self.ui.setWindowTitle("Beamstabilization")
        self.log = None
        self.config = False
        self.mirror = None
        self.b_align = False
        self.newStart = 0
        self.blog = 0
        self.b_centerLine = 1

        # read last reference position
        self.Save = saveClass(config)
        if self.Save.readLastConfig(calcDict):
            self.config = True

        self.correct = Correction()

        # Initialize GUI plots and images

        self.init_ui()
        self.Setting = GUISettings()
        self.Setting.guirestore(
            self.ui,
            QtCore.QSettings('./GUI/saved.ini', QtCore.QSettings.IniFormat))

        # Connect Buttons with Function calls
        self.readLastReferencePosition()
        self.btn_Exit.clicked.connect(self.close)
        self.btn_Start.clicked.connect(self.startAligning)
        self.btn_setCenter.clicked.connect(self.newCenter)
        self.btn_showCenter.clicked.connect(self.displayCenterLine)
        self.line_thresholdPercentage.returnPressed.connect(
            self.getThresholdPercentage)
        self.btn_moveMirror.clicked.connect(self.moveSingleMirror)
        self.btn_FitValue.toggled.connect(self.fitCenter)

        # show GUI
        self.show()

        # start Main function
        self.Main()