Пример #1
0
 def calcPixSize(self):
     if self.useEst:
         inputEst = self.inputEst.get().getOutputLog()
         input_params = parseMagCorrInput(inputEst)
         newPix = input_params[3]
         return newPix
     else:
         return self.newPix.get()
Пример #2
0
    def _getParams(self):
        inputMics = self.inputCoords.get().getMicrographs()
        mic_x, mic_y, _ = inputMics.getFirstItem().getDim()

        if self.useEst:
            inputEst = self.inputEst.get().getOutputLog()
            input_params = parseMagCorrInput(inputEst)
            ang = input_params[0]
            major_scale = input_params[1]
            minor_scale = input_params[2]

        else:
            ang = self.angDist.get()
            major_scale = self.scaleMaj.get()
            minor_scale = self.scaleMin.get()

        return [mic_x, mic_y, ang, major_scale, minor_scale]
Пример #3
0
    def _processMovie(self, movie):
        inputMovies = self.inputMovies.get()
        outputMovieFn = self._getAbsPath(self._getOutputMovieName(movie))
        logFn = self._getAbsPath(self.getOutputLog(movie))

        self._createLink(movie)
        self._argsMagDistCor()

        params = {'movieFn': self._getMovieFn(movie),
                  'outputMovieFn': outputMovieFn,
                  'logFn': logFn,
                  'nthr': self.numberOfThreads.get(),
                  'doGain': 'YES' if self.doGain else 'NO',
                  'doResample': 'YES' if self.doResample else 'NO'
                  }

        if self.useEst:
            inputEst = self.inputEst.get().getOutputLog()
            input_params = parseMagCorrInput(inputEst)
            params['angDist'] = input_params[0]
            params['scaleMaj'] = input_params[1]
            params['scaleMin'] = input_params[2]

        else:
            params['angDist'] = self.angDist.get()
            params['scaleMaj'] = self.scaleMaj.get()
            params['scaleMin'] = self.scaleMin.get()

        if self.doGain:
            params['gainFile'] = inputMovies.getGain()

        if self.doResample:
            params['newX'] = self.newX.get()
            params['newY'] = self.newY.get()

        self._storeSummary(movie)

        try:
            self.runJob(self._program % params, self._args % params)
        except:
            print("ERROR: Distortion correction for movie %s failed\n"
                  % movie.getFileName())
Пример #4
0
 def _storeSummary(self):
     if self.getAttributeValue('useEst', False):
         inputFn = self.getAttributeValue('inputEst', None).getOutputLog()
         input_params = parseMagCorrInput(inputFn)
         self.summaryVar.set("The following magnification distortion parameters "
                             "were used for correction:\n\n"
                             "Distortion Angle: *%0.2f* degrees\n"
                             "Major Scale: *%0.3f*\n"
                             "Minor Scale: *%0.3f*\n"
                             % (input_params[0],
                                input_params[1],
                                input_params[2]))
     else:
         self.summaryVar.set("The following magnification distortion parameters "
                             "were used for correction:\n\n"
                             "Distortion Angle: *%0.2f* degrees\n"
                             "Major Scale: *%0.3f*\n"
                             "Minor Scale: *%0.3f*\n"
                             % (self.getAttributeValue('angDist', 1.0),
                                self.getAttributeValue('scaleMaj', 1.0),
                                self.getAttributeValue('scaleMin', 1.0)))
Пример #5
0
 def _storeSummary(self, movie):
     """ Implement this method if you want to store the summary. """
     if self.getAttributeValue('useEst', False):
         inputFn = self.getAttributeValue('inputEst', None).getOutputLog()
         input_params = parseMagCorrInput(inputFn)
         self.summaryVar.set("The following magnification distortion parameters "
                             "were used for correction:\n\n"
                             "Distortion Angle: *%0.2f* degrees\n"
                             "Major Scale: *%0.3f*\n"
                             "Minor Scale: *%0.3f*\n"
                             "Corrected pixel size: *%0.3f* A"
                             % (input_params[0], input_params[1],
                                input_params[2], input_params[3]))
     else:
         self.summaryVar.set("The following magnification distortion parameters "
                             "were used for correction:\n\n"
                             "Distortion Angle: *%0.2f* degrees\n"
                             "Major Scale: *%0.3f*\n"
                             "Minor Scale: *%0.3f*\n"
                             "Corrected pixel size: *%0.3f* A"
                             % (self.getAttributeValue('angDist', 1.0),
                                self.getAttributeValue('scaleMaj', 1.0),
                                self.getAttributeValue('scaleMin', 1.0),
                                self.newPix.get()))