def createSplitStacks(self):
		self.splitStacks = {}
		self.splitStacks['left'] = "particles.left.mrc"
		self.splitStacks['right'] = "particles.right.mrc"
		if not os.path.isfile(self.splitStacks['left']):
			pass
		elif not os.path.isfile(self.splitStacks['right']):	
			pass
		elif apFile.fileSize(self.splitStacks['left']) < 100:	
			pass
		elif apFile.fileSize(self.splitStacks['right']) < 100:	
			pass
		else:
			apDisplay.printMsg("split stacks already exist, skipping this step")
			return	
							
		apDisplay.printColor("Step 1A: Splitting input stack %s into two parts"
			%(self.params['inputstack']), "purple")
		oddfile, evenfile = apImagicFile.splitStackEvenOdd(self.params['inputstack'], 
			rundir=self.params['rundir'], msg=True)

		apDisplay.printColor("Step 1B: Converting odd particles from %s into Left MRC stack %s"
			%(oddfile, self.splitStacks['left']), "purple")
		imagic2mrc.imagic_to_mrc(oddfile, self.splitStacks['left'])
		apFile.removeStack(oddfile)

		apDisplay.printColor("Step 1C: Converting even particles from %s into Right MRC stack %s"
			%(evenfile, self.splitStacks['right']), "purple")
		imagic2mrc.imagic_to_mrc(evenfile, self.splitStacks['right'])
		apFile.removeStack(evenfile)
		
		return
    def createSplitStacks(self):
        self.splitStacks = {}
        self.splitStacks['left'] = "particles.left.mrc"
        self.splitStacks['right'] = "particles.right.mrc"
        if not os.path.isfile(self.splitStacks['left']):
            pass
        elif not os.path.isfile(self.splitStacks['right']):
            pass
        elif apFile.fileSize(self.splitStacks['left']) < 100:
            pass
        elif apFile.fileSize(self.splitStacks['right']) < 100:
            pass
        else:
            apDisplay.printMsg(
                "split stacks already exist, skipping this step")
            return

        apDisplay.printColor(
            "Step 1A: Splitting input stack %s into two parts" %
            (self.params['inputstack']), "purple")
        oddfile, evenfile = apImagicFile.splitStackEvenOdd(
            self.params['inputstack'], rundir=self.params['rundir'], msg=True)

        apDisplay.printColor(
            "Step 1B: Converting odd particles from %s into Left MRC stack %s"
            % (oddfile, self.splitStacks['left']), "purple")
        imagic2mrc.imagic_to_mrc(oddfile, self.splitStacks['left'])
        apFile.removeStack(oddfile)

        apDisplay.printColor(
            "Step 1C: Converting even particles from %s into Right MRC stack %s"
            % (evenfile, self.splitStacks['right']), "purple")
        imagic2mrc.imagic_to_mrc(evenfile, self.splitStacks['right'])
        apFile.removeStack(evenfile)

        return
def convertImagicStackToMrcStack(infile,outfile):
        # 2D ImagicFile data block generated by EMAN is y-flipped from the original mrc.
        # Therefore, we need flip it back.
        imagic2mrc.imagic_to_mrc(infile,outfile,yflip=True)
def convertImagicStackToMrcStack(infile, outfile):
    # 2D ImagicFile data block generated by EMAN is y-flipped from the original mrc.
    # Therefore, we need flip it back.
    imagic2mrc.imagic_to_mrc(infile, outfile, yflip=True)