Esempio n. 1
0
    def __init__(self, theargs):
        """Constructor that takes one parameter which should contain
        a whole bunch of attributes as defined below

        :param theargs: Object with the following attributes set
                        theargs.outputdirectory
                        theargs.inputmrcfile
                        theargs.begintilt
                        theargs.endtilt
                        theargs.tiltshift
                        theargs.cores
                        theargs.mpiexec
                        theargs.nummarkers
                        theargs.bottommarkersize
                        theargs.topmarkersize
                        theargs.markernoise
                        theargs.aparam
                        theargs.markera
                        theargs.shrinkage
                        theargs.projmaxangle
                        theargs.numrotations
                        theargs.rotatinoangles
                        theargs.etspecbin
        :raises AttributeError: if the above attributes are not set
        """
        self._outdir = theargs.outputdirectory
        self._workdir = os.getcwd()
        self._inputmrc = os.path.abspath(theargs.inputmrcfile)
        self._begintilt = theargs.begintilt
        self._endtilt = theargs.endtilt
        self._tiltshift = theargs.tiltshift
        self._cores = theargs.cores
        self._mpiexec = theargs.mpiexec
        self._nummarkers = theargs.nummarkers
        self._bottommarkersize = theargs.bottommarkersize
        self._topmarkersize = theargs.topmarkersize
        self._markernoise = theargs.markernoise
        self._aparam = theargs.aparam
        self._markera = theargs.markera
        self._shrinkage = theargs.shrinkage
        self._projmaxangle = theargs.projmaxangle

        self._rawrotationangles = None
        if theargs.numrotations is not "":
            logger.info("Numrotations set to: " + theargs.numrotations)
            self._rawrotationlist = util.get_evenly_distributed_rotations(int(theargs.numrotations))
        else:
            self._rawrotationangles = theargs.rotationangles

        if theargs.etspecbin == "":
            self._etspecbin = theargs.etspecbin
        else:
            self._etspecbin = os.path.abspath(theargs.etspecbin)
Esempio n. 2
0
    def test_get_evenly_distributed_rotations(self):

        rots = util.get_evenly_distributed_rotations(1)
        self.assertEqual(len(rots), 0)

        rots = util.get_evenly_distributed_rotations(2)
        self.assertEqual(len(rots), 1)
        self.assertEqual(rots[0], 90.0)

        rots = util.get_evenly_distributed_rotations(4)
        self.assertEqual(len(rots), 3)
        self.assertEqual(rots[0], 45.0)
        self.assertEqual(rots[1], 90.0)
        self.assertEqual(rots[2], 135.0)

        rots = util.get_evenly_distributed_rotations(8)
        self.assertEqual(len(rots), 7)
        self.assertEqual(rots[0], 22.5)
        self.assertEqual(rots[6], 157.5)

        rots = util.get_evenly_distributed_rotations(16)
        self.assertEqual(len(rots), 15)
        self.assertEqual(rots[0], 11.25)
        self.assertEqual(rots[14], 168.75)

        rots = util.get_evenly_distributed_rotations(180)
        self.assertEqual(len(rots), 179)
        self.assertEqual(rots[0], 1.0)
        self.assertEqual(rots[178], 179.0)