def parseFileForRunParameters(self):
		''' PACKAGE-SPECIFIC FILE PARSER: if the parameters were not pickled, parse protocols script to determine ML3D params '''
		
		### parameters can be found in python protocols
		xmipp_protocol_ml3d = apXmipp.importProtocolPythonFile("xmipp_protocol_ml3d", self.params['rundir'])
		
		packageparams = {}
		packageparams['InSelFile']						= xmipp_protocol_ml3d.InSelFile
		packageparams['InitialReference']				= xmipp_protocol_ml3d.InitialReference
		packageparams['WorkingDir']						= xmipp_protocol_ml3d.WorkingDir
		packageparams['DoDeleteWorkingDir']				= xmipp_protocol_ml3d.DoDeleteWorkingDir
#		packageparams['ProjectDir']						= xmipp_protocol_ml3d.ProjectDir
#		packageparams['LogDir']							= xmipp_protocol_ml3d.LogDir
		packageparams['DoMlf']							= xmipp_protocol_ml3d.DoMlf
		packageparams['DoCorrectAmplitudes']			= xmipp_protocol_ml3d.DoCorrectAmplitudes
		packageparams['InCtfDatFile']					= xmipp_protocol_ml3d.InCtfDatFile
		packageparams['HighResLimit']					= xmipp_protocol_ml3d.HighResLimit
		packageparams['ImagesArePhaseFlipped']			= xmipp_protocol_ml3d.ImagesArePhaseFlipped
		packageparams['InitialMapIsAmplitudeCorrected'] = xmipp_protocol_ml3d.InitialMapIsAmplitudeCorrected
		packageparams['SeedsAreAmplitudeCorrected']		= xmipp_protocol_ml3d.SeedsAreAmplitudeCorrected
		packageparams['DoCorrectGreyScale']				= xmipp_protocol_ml3d.DoCorrectGreyScale
		packageparams['ProjMatchSampling']				= xmipp_protocol_ml3d.ProjMatchSampling
		packageparams['DoLowPassFilterReference']		= xmipp_protocol_ml3d.DoLowPassFilterReference
		packageparams['LowPassFilter']					= xmipp_protocol_ml3d.LowPassFilter
		packageparams['PixelSize']						= xmipp_protocol_ml3d.PixelSize
		packageparams['DoGenerateSeeds']				= xmipp_protocol_ml3d.DoGenerateSeeds
		packageparams['NumberOfReferences']				= xmipp_protocol_ml3d.NumberOfReferences
		packageparams['DoJustRefine']					= xmipp_protocol_ml3d.DoJustRefine
		packageparams['SeedsSelfile']					= xmipp_protocol_ml3d.SeedsSelfile
		packageparams['DoML3DClassification']			= xmipp_protocol_ml3d.DoML3DClassification
		packageparams['AngularSampling']				= xmipp_protocol_ml3d.AngularSampling
		packageparams['NumberOfIterations']				= xmipp_protocol_ml3d.NumberOfIterations
		packageparams['Symmetry']						= xmipp_protocol_ml3d.Symmetry
		packageparams['DoNorm']							= xmipp_protocol_ml3d.DoNorm
		packageparams['DoFourier']						= xmipp_protocol_ml3d.DoFourier
		packageparams['RestartIter']					= xmipp_protocol_ml3d.RestartIter
		packageparams['ExtraParamsMLrefine3D']			= xmipp_protocol_ml3d.ExtraParamsMLrefine3D
#		packageparams['NumberOfThreads']				= xmipp_protocol_ml3d.NumberOfThreads
#		packageparams['DoParallel']						= xmipp_protocol_ml3d.DoParallel
#		packageparams['NumberOfMpiProcesses']			= xmipp_protocol_ml3d.NumberOfMpiProcesses
#		packageparams['SystemFlavour']					= xmipp_protocol_ml3d.SystemFlavour
#		packageparams['AnalysisScript']					= xmipp_protocol_ml3d.AnalysisScript
		
		if xmipp_protocol_ml3d.Symmetry[:1] == "i":
			sym = "icos"
		else:
			sym = xmipp_protocol_ml3d.Symmetry
			sym = sym.split()[0]
		
		### set global parameters
		runparams = {}
		runparams['symmetry'] = apSymmetry.findSymmetry(sym)
		runparams['apix'] = packageparams['PixelSize']
		runparams['angularSamplingRate'] = packageparams['AngularSampling']
		runparams['NumberOfReferences'] = packageparams['NumberOfReferences']
		runparams['numiter'] = packageparams['NumberOfIterations']		
		runparams['package_params'] = packageparams
		runparams['remoterundir'] = os.path.abspath(xmipp_protocol_ml3d.ProjectDir)
		
		return runparams
    def parseFileForRunParameters(self):
        ''' PACKAGE-SPECIFIC FILE PARSER: if the parameters were not pickled, parse protocols script to determine projection-matching params '''

        ### parameters can be found in python protocols
        xmipp_protocol_projmatch = apXmipp.importProtocolPythonFile(
            "xmipp_protocol_projmatch", self.params['rundir'])

        packageparams = {}
        packageparams[
            'NumberofIterations'] = xmipp_protocol_projmatch.NumberofIterations
        packageparams['MaskFileName'] = xmipp_protocol_projmatch.MaskFileName
        packageparams['MaskRadius'] = xmipp_protocol_projmatch.MaskRadius
        packageparams['InnerRadius'] = xmipp_protocol_projmatch.InnerRadius
        packageparams['OuterRadius'] = xmipp_protocol_projmatch.OuterRadius
        packageparams['SymmetryGroup'] = xmipp_protocol_projmatch.SymmetryGroup
        packageparams[
            'FourierMaxFrequencyOfInterest'] = xmipp_protocol_projmatch.FourierMaxFrequencyOfInterest
        packageparams['SelFileName'] = xmipp_protocol_projmatch.SelFileName
        packageparams['DocFileName'] = xmipp_protocol_projmatch.DocFileName
        packageparams[
            'ReferenceFileName'] = xmipp_protocol_projmatch.ReferenceFileName
        packageparams['WorkingDir'] = xmipp_protocol_projmatch.WorkingDir
        #		packageparams['DoDeleteWorkingDir']					= xmipp_protocol_projmatch.DoDeleteWorkingDir
        #		packageparams['ContinueAtIteration']					= xmipp_protocol_projmatch.ContinueAtIteration
        packageparams['CleanUpFiles'] = xmipp_protocol_projmatch.CleanUpFiles
        #		packageparams['ProjectDir']						= xmipp_protocol_projmatch.ProjectDir
        #		packageparams['LogDir']							= xmipp_protocol_projmatch.LogDir
        packageparams[
            'DoCtfCorrection'] = xmipp_protocol_projmatch.DoCtfCorrection
        packageparams['CTFDatName'] = xmipp_protocol_projmatch.CTFDatName
        packageparams[
            'DoAutoCtfGroup'] = xmipp_protocol_projmatch.DoAutoCtfGroup
        packageparams[
            'CtfGroupMaxDiff'] = xmipp_protocol_projmatch.CtfGroupMaxDiff
        packageparams[
            'CtfGroupMaxResol'] = xmipp_protocol_projmatch.CtfGroupMaxResol
        #		packageparams['SplitDefocusDocFile']					= xmipp_protocol_projmatch.SplitDefocusDocFile
        packageparams['PaddingFactor'] = xmipp_protocol_projmatch.PaddingFactor
        packageparams[
            'WienerConstant'] = xmipp_protocol_projmatch.WienerConstant
        packageparams[
            'DataArePhaseFlipped'] = xmipp_protocol_projmatch.DataArePhaseFlipped
        packageparams[
            'ReferenceIsCtfCorrected'] = xmipp_protocol_projmatch.ReferenceIsCtfCorrected
        packageparams['DoMask'] = xmipp_protocol_projmatch.DoMask
        packageparams[
            'DoSphericalMask'] = xmipp_protocol_projmatch.DoSphericalMask
        #		packageparams['DoProjectionMatching']					= xmipp_protocol_projmatch.DoProjectionMatching
        #		packageparams['DisplayProjectionMatching']				= xmipp_protocol_projmatch.DisplayProjectionMatching
        #		packageparams['AvailableMemory']					= xmipp_protocol_projmatch.AvailableMemory
        packageparams[
            'AngSamplingRateDeg'] = xmipp_protocol_projmatch.AngSamplingRateDeg
        packageparams[
            'MaxChangeInAngles'] = xmipp_protocol_projmatch.MaxChangeInAngles
        packageparams[
            'PerturbProjectionDirections'] = xmipp_protocol_projmatch.PerturbProjectionDirections
        packageparams[
            'MaxChangeOffset'] = xmipp_protocol_projmatch.MaxChangeOffset
        packageparams['Search5DShift'] = xmipp_protocol_projmatch.Search5DShift
        packageparams['Search5DStep'] = xmipp_protocol_projmatch.Search5DStep
        packageparams[
            'DoRetricSearchbyTiltAngle'] = xmipp_protocol_projmatch.DoRetricSearchbyTiltAngle
        packageparams['Tilt0'] = xmipp_protocol_projmatch.Tilt0
        packageparams['TiltF'] = xmipp_protocol_projmatch.TiltF
        packageparams[
            'SymmetryGroupNeighbourhood'] = xmipp_protocol_projmatch.SymmetryGroupNeighbourhood
        packageparams['OnlyWinner'] = xmipp_protocol_projmatch.OnlyWinner
        packageparams[
            'MinimumCrossCorrelation'] = xmipp_protocol_projmatch.MinimumCrossCorrelation
        packageparams[
            'DiscardPercentage'] = xmipp_protocol_projmatch.DiscardPercentage
        packageparams[
            'ProjMatchingExtra'] = xmipp_protocol_projmatch.ProjMatchingExtra
        packageparams['DoAlign2D'] = xmipp_protocol_projmatch.DoAlign2D
        packageparams['Align2DIterNr'] = xmipp_protocol_projmatch.Align2DIterNr
        packageparams[
            'Align2dMaxChangeOffset'] = xmipp_protocol_projmatch.Align2dMaxChangeOffset
        packageparams[
            'Align2dMaxChangeRot'] = xmipp_protocol_projmatch.Align2dMaxChangeRot
        #		packageparams['DoReconstruction']					= xmipp_protocol_projmatch.DoReconstruction
        #		packageparams['DisplayReconstruction']					= xmipp_protocol_projmatch.DisplayReconstruction
        packageparams[
            'ReconstructionMethod'] = xmipp_protocol_projmatch.ReconstructionMethod
        packageparams['ARTLambda'] = xmipp_protocol_projmatch.ARTLambda
        packageparams[
            'ARTReconstructionExtraCommand'] = xmipp_protocol_projmatch.ARTReconstructionExtraCommand
        packageparams[
            'WBPReconstructionExtraCommand'] = xmipp_protocol_projmatch.WBPReconstructionExtraCommand
        packageparams[
            'FourierReconstructionExtraCommand'] = xmipp_protocol_projmatch.FourierReconstructionExtraCommand
        #		packageparams['DoSplitReferenceImages']					= xmipp_protocol_projmatch.DoSplitReferenceImages
        packageparams['ResolSam'] = xmipp_protocol_projmatch.ResolSam
        #		packageparams['DisplayResolution']					= xmipp_protocol_projmatch.DisplayResolution
        packageparams[
            'ConstantToAddToFiltration'] = xmipp_protocol_projmatch.ConstantToAddToFiltration
        #		packageparams['NumberOfThreads']					= xmipp_protocol_projmatch.NumberOfThreads
        #		packageparams['DoParallel']						= xmipp_protocol_projmatch.DoParallel
        #		packageparams['NumberOfMpiProcesses']					= xmipp_protocol_projmatch.NumberOfMpiProcesses
        #		packageparams['MpiJobSize']						= xmipp_protocol_projmatch.MpiJobSize
        #		packageparams['SystemFlavour']						= xmipp_protocol_projmatch.SystemFlavour
        #		packageparams['AnalysisScript']						= xmipp_protocol_projmatch.AnalysisScript

        if xmipp_protocol_projmatch.SymmetryGroup[:1] == "i":
            sym = "icos"
        else:
            sym = xmipp_protocol_projmatch.SymmetryGroup
            sym = sym.split()[0]

        ### set global parameters
        runparams = {}
        runparams['numiter'] = packageparams['NumberofIterations']
        # Mask should be in pixels of original stack. Xmipp returns pixels in terms of preped stack.
        # so orig_pix = preped_pix * (orig_boxsize / preped_boxsize).
        # This is needed in case the prepedatack was binned.
        boxscale = self.runparams['original_boxsize'] / self.runparams[
            'boxsize']
        runparams['mask'] = packageparams['MaskRadius'] * boxscale
        runparams[
            'alignmentInnerRadius'] = packageparams['InnerRadius'] * boxscale
        runparams[
            'alignmentOuterRadius'] = packageparams['OuterRadius'] * boxscale
        runparams['symmetry'] = apSymmetry.findSymmetry(sym)
        runparams['angularSamplingRate'] = packageparams['AngSamplingRateDeg']
        runparams['apix'] = packageparams['ResolSam']
        runparams['package_params'] = packageparams
        runparams['remoterundir'] = os.path.abspath(
            xmipp_protocol_projmatch.ProjectDir)
        runparams['rundir'] = self.params['rundir']

        return runparams
	def parseFileForRunParameters(self):
		''' PACKAGE-SPECIFIC FILE PARSER: if the parameters were not pickled, parse protocols script to determine projection-matching params '''

		### parameters can be found in python protocols
		xmipp_protocol_projmatch = apXmipp.importProtocolPythonFile("xmipp_protocol_projmatch", self.params['rundir'])
			
		packageparams = {}
		packageparams['NumberofIterations']					= xmipp_protocol_projmatch.NumberofIterations
		packageparams['MaskFileName']						= xmipp_protocol_projmatch.MaskFileName
		packageparams['MaskRadius']						= xmipp_protocol_projmatch.MaskRadius
		packageparams['InnerRadius']						= xmipp_protocol_projmatch.InnerRadius
		packageparams['OuterRadius']						= xmipp_protocol_projmatch.OuterRadius
		packageparams['SymmetryGroup']						= xmipp_protocol_projmatch.SymmetryGroup
		packageparams['FourierMaxFrequencyOfInterest']				= xmipp_protocol_projmatch.FourierMaxFrequencyOfInterest
		packageparams['SelFileName']						= xmipp_protocol_projmatch.SelFileName
		packageparams['DocFileName']						= xmipp_protocol_projmatch.DocFileName
		packageparams['ReferenceFileName']					= xmipp_protocol_projmatch.ReferenceFileName
		packageparams['WorkingDir']						= xmipp_protocol_projmatch.WorkingDir
#		packageparams['DoDeleteWorkingDir']					= xmipp_protocol_projmatch.DoDeleteWorkingDir
#		packageparams['ContinueAtIteration']					= xmipp_protocol_projmatch.ContinueAtIteration
		packageparams['CleanUpFiles']						= xmipp_protocol_projmatch.CleanUpFiles
#		packageparams['ProjectDir']						= xmipp_protocol_projmatch.ProjectDir
#		packageparams['LogDir']							= xmipp_protocol_projmatch.LogDir
		packageparams['DoCtfCorrection']					= xmipp_protocol_projmatch.DoCtfCorrection
		packageparams['CTFDatName']						= xmipp_protocol_projmatch.CTFDatName
		packageparams['DoAutoCtfGroup']						= xmipp_protocol_projmatch.DoAutoCtfGroup
		packageparams['CtfGroupMaxDiff']					= xmipp_protocol_projmatch.CtfGroupMaxDiff
		packageparams['CtfGroupMaxResol']					= xmipp_protocol_projmatch.CtfGroupMaxResol
#		packageparams['SplitDefocusDocFile']					= xmipp_protocol_projmatch.SplitDefocusDocFile
		packageparams['PaddingFactor']						= xmipp_protocol_projmatch.PaddingFactor
		packageparams['WienerConstant']						= xmipp_protocol_projmatch.WienerConstant
		packageparams['DataArePhaseFlipped']					= xmipp_protocol_projmatch.DataArePhaseFlipped
		packageparams['ReferenceIsCtfCorrected']				= xmipp_protocol_projmatch.ReferenceIsCtfCorrected
		packageparams['DoMask']							= xmipp_protocol_projmatch.DoMask
		packageparams['DoSphericalMask']					= xmipp_protocol_projmatch.DoSphericalMask
#		packageparams['DoProjectionMatching']					= xmipp_protocol_projmatch.DoProjectionMatching
#		packageparams['DisplayProjectionMatching']				= xmipp_protocol_projmatch.DisplayProjectionMatching
#		packageparams['AvailableMemory']					= xmipp_protocol_projmatch.AvailableMemory
		packageparams['AngSamplingRateDeg']					= xmipp_protocol_projmatch.AngSamplingRateDeg
		packageparams['MaxChangeInAngles']					= xmipp_protocol_projmatch.MaxChangeInAngles
		packageparams['PerturbProjectionDirections']				= xmipp_protocol_projmatch.PerturbProjectionDirections
		packageparams['MaxChangeOffset']					= xmipp_protocol_projmatch.MaxChangeOffset
		packageparams['Search5DShift']						= xmipp_protocol_projmatch.Search5DShift
		packageparams['Search5DStep']						= xmipp_protocol_projmatch.Search5DStep
		packageparams['DoRetricSearchbyTiltAngle']				= xmipp_protocol_projmatch.DoRetricSearchbyTiltAngle
		packageparams['Tilt0']							= xmipp_protocol_projmatch.Tilt0
		packageparams['TiltF']							= xmipp_protocol_projmatch.TiltF
		packageparams['SymmetryGroupNeighbourhood']				= xmipp_protocol_projmatch.SymmetryGroupNeighbourhood
		packageparams['OnlyWinner']						= xmipp_protocol_projmatch.OnlyWinner
		packageparams['MinimumCrossCorrelation']				= xmipp_protocol_projmatch.MinimumCrossCorrelation
		packageparams['DiscardPercentage']					= xmipp_protocol_projmatch.DiscardPercentage
		packageparams['ProjMatchingExtra']					= xmipp_protocol_projmatch.ProjMatchingExtra
		packageparams['DoAlign2D']						= xmipp_protocol_projmatch.DoAlign2D
		packageparams['Align2DIterNr']						= xmipp_protocol_projmatch.Align2DIterNr
		packageparams['Align2dMaxChangeOffset']					= xmipp_protocol_projmatch.Align2dMaxChangeOffset
		packageparams['Align2dMaxChangeRot']					= xmipp_protocol_projmatch.Align2dMaxChangeRot
#		packageparams['DoReconstruction']					= xmipp_protocol_projmatch.DoReconstruction
#		packageparams['DisplayReconstruction']					= xmipp_protocol_projmatch.DisplayReconstruction
		packageparams['ReconstructionMethod']					= xmipp_protocol_projmatch.ReconstructionMethod
		packageparams['ARTLambda']						= xmipp_protocol_projmatch.ARTLambda
		packageparams['ARTReconstructionExtraCommand']				= xmipp_protocol_projmatch.ARTReconstructionExtraCommand
		packageparams['WBPReconstructionExtraCommand']				= xmipp_protocol_projmatch.WBPReconstructionExtraCommand
		packageparams['FourierReconstructionExtraCommand']			= xmipp_protocol_projmatch.FourierReconstructionExtraCommand
#		packageparams['DoSplitReferenceImages']					= xmipp_protocol_projmatch.DoSplitReferenceImages
		packageparams['ResolSam']						= xmipp_protocol_projmatch.ResolSam
#		packageparams['DisplayResolution']					= xmipp_protocol_projmatch.DisplayResolution
		packageparams['ConstantToAddToFiltration']				= xmipp_protocol_projmatch.ConstantToAddToFiltration
#		packageparams['NumberOfThreads']					= xmipp_protocol_projmatch.NumberOfThreads
#		packageparams['DoParallel']						= xmipp_protocol_projmatch.DoParallel
#		packageparams['NumberOfMpiProcesses']					= xmipp_protocol_projmatch.NumberOfMpiProcesses
#		packageparams['MpiJobSize']						= xmipp_protocol_projmatch.MpiJobSize
#		packageparams['SystemFlavour']						= xmipp_protocol_projmatch.SystemFlavour
#		packageparams['AnalysisScript']						= xmipp_protocol_projmatch.AnalysisScript

		if xmipp_protocol_projmatch.SymmetryGroup[:1] == "i":
			sym = "icos"
		else:
			sym = xmipp_protocol_projmatch.SymmetryGroup
			sym = sym.split()[0]

		### set global parameters
		runparams = {}
		runparams['numiter'] = packageparams['NumberofIterations']
		# Mask should be in pixels of original stack. Xmipp returns pixels in terms of preped stack.
		# so orig_pix = preped_pix * (orig_boxsize / preped_boxsize). 
		# This is needed in case the prepedatack was binned.
		boxscale = self.runparams['original_boxsize'] / self.runparams['boxsize']
		runparams['mask'] = packageparams['MaskRadius'] * boxscale 
		runparams['alignmentInnerRadius'] = packageparams['InnerRadius'] * boxscale
		runparams['alignmentOuterRadius'] = packageparams['OuterRadius'] * boxscale
		runparams['symmetry'] = apSymmetry.findSymmetry(sym)
		runparams['angularSamplingRate'] = packageparams['AngSamplingRateDeg']
		runparams['apix'] = packageparams['ResolSam']
		runparams['package_params'] = packageparams
		runparams['remoterundir'] = os.path.abspath(xmipp_protocol_projmatch.ProjectDir)
		runparams['rundir'] = self.params['rundir']

		return runparams