def _defineParams(self, form):
        form.addSection(label='Input')
        form.addParam('inputMicrographs',
                      params.PointerParam,
                      pointerClass='SetOfMicrographs',
                      label='Input micrographs',
                      important=True,
                      help='Select the input micrographs. '
                      'If using the *Optimize* mode, just a subset of '
                      'micrographs are used to compute the FOM maps. '
                      'If in *Compute* mode, all micrographs will be '
                      'auto-picked.')
        form.addParam('ctfRelations',
                      params.RelationParam,
                      relationName=RELATION_CTF,
                      attributeName='getInputMicrographs',
                      label='CTF estimation',
                      help='Choose some CTF estimation related to the '
                      'input micrographs.')

        # From Relion 3.+, references can be 2D or 3D
        # need to add these parameters
        refCondition = 'referencesType==%s' % REF_AVERAGES
        ref3dCondition = 'referencesType==%s' % REF_VOLUME

        form.addSection('References')

        form.addParam('referencesType',
                      params.EnumParam,
                      choices=['2D', '3D'],
                      default=REF_AVERAGES,
                      display=params.EnumParam.DISPLAY_HLIST,
                      label='References',
                      help='The preferred way to autopick is '
                      'by providing 2D references images that were '
                      'obtained by 2D classification. \n'
                      'The Gaussian blob references may be useful to '
                      'kickstart a new data set.')

        # In Relion 3 it is also possible to pass a volume as reference for
        # autopicking

        form.addParam(
            'inputReferences',
            params.PointerParam,
            pointerClass='SetOfAverages',
            condition=refCondition,
            label='Input references',
            important=True,
            help='Input references (SetOfAverages) for auto-pick. \n\n'
            'Note that the absolute greyscale needs to be correct, \n'
            'so only use images with proper normalization. '
            'From Relion 3.0 it is also possible to provide a '
            '3D volume which projections will be used as '
            'references.')

        form.addParam('inputReferences3D',
                      params.PointerParam,
                      pointerClass='Volume',
                      condition=ref3dCondition,
                      label='Input references',
                      important=True,
                      help='Input volume from which 2D references will be '
                      'made by projection. Note that the absolute '
                      'greyscale needs to be correct, so only use '
                      'maps created by RELION itself from this data set.')

        form.addParam('symmetryGroup',
                      params.StringParam,
                      default='c1',
                      condition=ref3dCondition,
                      label='Symmetry',
                      help="Symmetry point group of the 3D reference. "
                      "Only projections in the asymmetric part of the "
                      "sphere will be generated.")

        form.addParam('angularSamplingDeg',
                      params.EnumParam,
                      default=0,
                      choices=ANGULAR_SAMPLING_LIST,
                      condition=ref3dCondition,
                      label='3D angular sampling (deg)',
                      help="There are only a few discrete angular samplings "
                      "possible because we use the HealPix library to "
                      "generate the sampling of the first two Euler "
                      "angles on the sphere. The samplings are approximate "
                      "numbers and vary slightly over the sphere.\n"
                      "For autopicking, 30 degrees is usually fine enough, "
                      "but for highly symmetrical objects one may need to "
                      "go finer to adequately sample the asymmetric part of "
                      "the sphere.")

        form.addParam(
            'particleDiameter',
            params.IntParam,
            default=-1,
            label='Mask diameter (A)',
            help='Diameter of the circular mask that will be applied '
            'around the templates in Angstroms. When set to a '
            'negative value, this value is estimated '
            'automatically from the templates themselves.')

        form.addParam('lowpassFilterRefs',
                      params.IntParam,
                      default=20,
                      label='Lowpass filter references (A)',
                      help='Lowpass filter that will be applied to the '
                      'references before template matching. \n'
                      'Do NOT use very high-resolution templates to '
                      'search your micrographs. \n'
                      'The signal will be too weak at high resolution '
                      'anyway, and you may find Einstein from noise...')

        form.addParam('highpassFilterMics',
                      params.IntParam,
                      default=-1,
                      label='Highpass filter (A)',
                      help='Highpass filter that will be applied to the '
                      'micrographs. This may be useful to get rid of '
                      'background ramps due to uneven ice distributions. '
                      'Give a negative value to skip the highpass '
                      'filter.  Useful values are often in the range '
                      'of 200-400 Angstroms.')

        form.addParam(
            'angularSampling',
            params.IntParam,
            default=5,
            label='Angular sampling (deg)',
            help='Angular sampling in degrees for exhaustive searches '
            'of the in-plane rotations for all references.')

        form.addParam('refsHaveInvertedContrast',
                      params.BooleanParam,
                      default=True,
                      label='References have inverted contrast?',
                      help='Set to Yes to indicate that the reference have '
                      'inverted contrast with respect to the particles '
                      'in the micrographs.')

        form.addParam('refsCtfCorrected',
                      params.BooleanParam,
                      default=True,
                      label='Are References CTF corrected?',
                      help='Set to Yes if the references were created with '
                      'CTF-correction inside RELION.\n'
                      'If set to Yes, the input micrographs should contain '
                      'the CTF information.')

        form.addParam(
            'ignoreCTFUntilFirstPeak',
            params.BooleanParam,
            default=False,
            label='Ignore CTFs until first peak?',
            help='Set this to Yes, only if this option was also used '
            'to generate the references.')

        form.addSection('Autopicking')

        group = form.addGroup('Autopick')
        group.addParam('pickingThreshold',
                       params.FloatParam,
                       default=0.25,
                       label='Picking threshold:',
                       help='Use lower thresholds to pick more particles '
                       '(and more junk probably)')

        group.addParam('interParticleDistance',
                       params.IntParam,
                       default=-1,
                       label='Minimum inter-particle distance (A):',
                       help='Particles closer together than this distance \n'
                       'will be consider to be a single cluster. \n'
                       'From each cluster, only one particle will be '
                       'picked.')

        group.addParam(
            'maxStddevNoise',
            params.FloatParam,
            default=1.1,
            label='Maximum stddev noise:',
            help='This is useful to prevent picking in carbon areas, '
            'or areas with big contamination features. Peaks in '
            'areas where the background standard deviation in '
            'the normalized micrographs is higher than this '
            'value will be ignored. Useful values are probably '
            'in the range 1.0 to 1.2. Set to -1 to switch off '
            'the feature to eliminate peaks due to high '
            'background standard deviations.')

        group.addParam(
            'minAvgNoise',
            params.FloatParam,
            default=-999,
            label='Minimum avg noise:',
            help='This is useful to prevent picking in carbon areas,'
            ' or areas with big contamination features. Peaks '
            'in areas where the background standard deviation '
            'in the normalized micrographs is higher than this'
            ' value will be ignored. Useful values are '
            'probably in the range -0.5 to 0. Set to -999 to '
            'switch off the feature to eliminate peaks due to '
            'low average background densities.')

        group = form.addGroup('Computing')
        group.addParam('shrinkFactor',
                       params.FloatParam,
                       default=0,
                       validators=[
                           params.Range(0, 1, "value should be "
                                        "between 0 and 1. ")
                       ],
                       label='Shrink factor',
                       help='This is useful to speed up the calculations, '
                       'and to make them less memory-intensive. The '
                       'micrographs will be downscaled (shrunk) to '
                       'calculate the cross-correlations, and peak '
                       'searching will be done in the downscaled FOM '
                       'maps. When set to 0, the micrographs will de '
                       'downscaled to the lowpass filter of the '
                       'references, a value between 0 and 1 will '
                       'downscale the micrographs by that factor. '
                       'Note that the results will not be exactly '
                       'the same when you shrink micrographs!')

        group.addParam('doGpu',
                       params.BooleanParam,
                       default=True,
                       label='Use GPU acceleration?',
                       help='If set to Yes, the job will try to use GPU '
                       'acceleration.')

        group.addParam('gpusToUse',
                       params.StringParam,
                       default='',
                       label='Which GPUs to use:',
                       condition='doGpu',
                       help='This argument is not necessary. If left empty, '
                       'the job itself will try to allocate available GPU '
                       'resources. You can override the default '
                       'allocation by providing a list of which GPUs '
                       '(0,1,2,3, etc) to use. MPI-processes are '
                       'separated by ":", threads by ",". '
                       'For example: "0,0:1,1:0,0:1,1"')

        form.addParam(
            'extraParams',
            params.StringParam,
            default='',
            label='Additional arguments:',
            help='In this box command-line arguments may be provided '
            'that are not generated by the GUI. This may be '
            'useful for testing developmental options and/or '
            'expert use of the program. \n'
            'The command "relion_autopick" will print a list '
            'of possible options.')

        self._defineStreamingParams(form)

        form.addParallelSection(threads=0, mpi=4)
    def _defineParams(self, form):
        form.addSection(label='Input')
        form.addParam('inputMicrographs',
                      params.PointerParam,
                      pointerClass='SetOfMicrographs',
                      label='Input micrographs',
                      important=True,
                      help='Select the input micrographs. '
                      'If using the *Optimize* mode, just a subset of '
                      'micrographs are used to compute the FOM maps. '
                      'If in *Compute* mode, all micrographs will be '
                      'auto-picked.')
        form.addParam('ctfRelations',
                      params.RelationParam,
                      relationName=RELATION_CTF,
                      attributeName='getInputMicrographs',
                      label='CTF estimation',
                      help='Choose some CTF estimation related to the '
                      'input micrographs.')

        form.addParam('runType',
                      params.EnumParam,
                      default=RUN_OPTIMIZE,
                      choices=['Optimize params', 'Pick all micrographs'],
                      display=params.EnumParam.DISPLAY_LIST,
                      label='Run type: ',
                      help='Usually, first you should use the *Optimize* mode '
                      'to compute the FOM maps for a few micrographs and '
                      'use them to tune the picking parameters using the '
                      'wizard. After that you can run the job in *Compute*'
                      ' mode and auto-pick all the micrographs. ')

        group = form.addGroup('Micrographs for optimization',
                              condition='runType==%d' % RUN_OPTIMIZE)

        group.addParam('micrographsSelection',
                       params.EnumParam,
                       default=MICS_AUTO,
                       choices=['automatic selection', 'input subset'],
                       display=params.EnumParam.DISPLAY_HLIST,
                       label='Choose micrographs by',
                       help='If you choose "automatic selection", you only '
                       'need to provide the number of microgrphs to use '
                       'and that number will be selected to cover the '
                       'defocus range. ')
        group.addParam('micrographsNumber',
                       params.IntParam,
                       default='10',
                       condition='micrographsSelection==%d' % MICS_AUTO,
                       label='Micrographs for optimization:',
                       help='Select the number of micrographs that you want'
                       'to be used for the parameters optimization. ')
        group.addParam('micrographsSubset',
                       params.PointerParam,
                       condition='micrographsSelection==%d' % MICS_SUBSET,
                       pointerClass='SetOfMicrographs',
                       label='Subset of micrographs',
                       help='Choose as input a subset of micrographs that '
                       'you have previously selected. '
                       '(Probably covering the defocus range).')

        # From Relion 2.+, it can be picked with gaussian blobs, so we
        # need to add these parameters
        refCondition = 'referencesType==%s' % REF_AVERAGES

        group = form.addGroup('References')
        group.addParam('referencesType',
                       params.EnumParam,
                       choices=['References', 'Gaussian blobs'],
                       default=REF_AVERAGES,
                       display=params.EnumParam.DISPLAY_HLIST,
                       label='References type',
                       help='You may select "Gaussian blobs" to be used as '
                       'references. The preferred way to autopick is '
                       'by providing 2D references images that were '
                       'obtained by 2D classification. \n'
                       'The Gaussian blob references may be useful to '
                       'kickstart a new data set.')

        group.addParam('gaussianPeak',
                       params.FloatParam,
                       default=0.1,
                       condition='referencesType==%s' % REF_BLOBS,
                       label='Gaussian peak value',
                       help='The peak value of the Gaussian blob. '
                       'Weaker data will need lower values.')

        pointerClassStr = 'SetOfAverages'
        # In Relion 3 it is also possible to pass a volume as reference for
        # autopicking
        if isVersion3():
            pointerClassStr += ",Volume"

        group.addParam(
            'inputReferences',
            params.PointerParam,
            pointerClass='SetOfAverages',
            condition=refCondition,
            label='Input references',
            important=True,
            help='Input references (SetOfAverages) for auto-pick. \n\n'
            'Note that the absolute greyscale needs to be correct, \n'
            'so only use images with proper normalization. '
            'From Relion 3.0 it is also possible to provide a '
            '3D volume which projections will be used as '
            'references.')

        group.addParam(
            'particleDiameter',
            params.IntParam,
            default=-1,
            label='Mask diameter (A)',
            help='Diameter of the circular mask that will be applied '
            'around the templates in Angstroms. When set to a '
            'negative value, this value is estimated '
            'automatically from the templates themselves.')

        form.addSection('References')

        form.addParam('lowpassFilterRefs',
                      params.IntParam,
                      default=20,
                      condition=refCondition,
                      label='Lowpass filter references (A)',
                      help='Lowpass filter that will be applied to the '
                      'references before template matching. \n'
                      'Do NOT use very high-resolution templates to '
                      'search your micrographs. \n'
                      'The signal will be too weak at high resolution '
                      'anyway, and you may find Einstein from noise...')

        form.addParam('highpassFilterMics',
                      params.IntParam,
                      default=-1,
                      label='Highpass filter (A)',
                      help='Highpass filter that will be applied to the '
                      'micrographs. This may be useful to get rid of '
                      'background ramps due to uneven ice distributions. '
                      'Give a negative value to skip the highpass '
                      'filter.  Useful values are often in the range '
                      'of 200-400 Angstroms.')

        form.addParam(
            'angularSampling',
            params.IntParam,
            default=5,
            label='Angular sampling (deg)',
            help='Angular sampling in degrees for exhaustive searches '
            'of the in-plane rotations for all references.')

        form.addParam('refsHaveInvertedContrast',
                      params.BooleanParam,
                      default=True,
                      label='References have inverted contrast?',
                      help='Set to Yes to indicate that the reference have '
                      'inverted contrast with respect to the particles '
                      'in the micrographs.')

        form.addParam('refsCtfCorrected',
                      params.BooleanParam,
                      default=True,
                      condition=refCondition,
                      label='Are References CTF corrected?',
                      help='Set to Yes if the references were created with '
                      'CTF-correction inside RELION.\n'
                      'If set to Yes, the input micrographs should contain '
                      'the CTF information.')

        form.addParam(
            'ignoreCTFUntilFirstPeak',
            params.BooleanParam,
            condition=refCondition,
            default=False,
            expertLevel=params.LEVEL_ADVANCED,
            label='Ignore CTFs until first peak?',
            help='Set this to Yes, only if this option was also used '
            'to generate the references.')

        form.addSection('Autopicking')

        group = form.addGroup('Autopick')
        group.addParam('pickingThreshold',
                       params.FloatParam,
                       default=0.25,
                       label='Picking threshold:',
                       help='Use lower thresholds to pick more particles '
                       '(and more junk probably)')

        group.addParam('interParticleDistance',
                       params.IntParam,
                       default=-1,
                       label='Minimum inter-particle distance (A):',
                       help='Particles closer together than this distance \n'
                       'will be consider to be a single cluster. \n'
                       'From each cluster, only one particle will be '
                       'picked.')

        group.addParam(
            'maxStddevNoise',
            params.FloatParam,
            default=1.1,
            label='Maximum stddev noise:',
            help='This is useful to prevent picking in carbon areas, '
            'or areas with big contamination features. Peaks in '
            'areas where the background standard deviation in '
            'the normalized micrographs is higher than this '
            'value will be ignored. Useful values are probably '
            'in the range 1.0 to 1.2. Set to -1 to switch off '
            'the feature to eliminate peaks due to high '
            'background standard deviations.')

        group = form.addGroup('Computing')
        group.addParam('shrinkFactor',
                       params.FloatParam,
                       default=0,
                       validators=[
                           params.Range(0, 1, "value should be "
                                        "between 0 and 1. ")
                       ],
                       label='Shrink factor',
                       help='This is useful to speed up the calculations, '
                       'and to make them less memory-intensive. The '
                       'micrographs will be downscaled (shrunk) to '
                       'calculate the cross-correlations, and peak '
                       'searching will be done in the downscaled FOM '
                       'maps. When set to 0, the micrographs will de '
                       'downscaled to the lowpass filter of the '
                       'references, a value between 0 and 1 will '
                       'downscale the micrographs by that factor. '
                       'Note that the results will not be exactly '
                       'the same when you shrink micrographs!')

        group.addParam('doGpu',
                       params.BooleanParam,
                       default=True,
                       label='Use GPU acceleration?',
                       help='If set to Yes, the job will try to use GPU '
                       'acceleration.')

        group.addParam('gpusToUse',
                       params.StringParam,
                       default='',
                       label='Which GPUs to use:',
                       condition='doGpu',
                       help='This argument is not necessary. If left empty, '
                       'the job itself will try to allocate available GPU '
                       'resources. You can override the default '
                       'allocation by providing a list of which GPUs '
                       '(0,1,2,3, etc) to use. MPI-processes are '
                       'separated by ":", threads by ",". '
                       'For example: "0,0:1,1:0,0:1,1"')

        form.addParam(
            'extraParams',
            params.StringParam,
            default='',
            label='Additional arguments:',
            help='In this box command-line arguments may be provided '
            'that are not generated by the GUI. This may be '
            'useful for testing developmental options and/or '
            'expert use of the program. \n'
            'The command "relion_autopick" will print a list '
            'of possible options.')

        form.addSection('Helix')
        form.addParam('fomLabel',
                      params.LabelParam,
                      important=True,
                      label='Helix processing is not implemented still.')

        self._defineStreamingParams(form)

        form.addParallelSection(threads=0, mpi=4)
Example #3
0
    def defineProcessParams(cls, form):
        form.addParam('windowSize',
                      params.IntParam,
                      default=1024,
                      label='Box size (px)',
                      condition='not recalculate',
                      help='Boxsize in pixels to be used for FFT, 512 or '
                      '1024 highly recommended')

        group = form.addGroup('Search limits')
        line = group.addLine('Resolution (A)',
                             condition='not recalculate',
                             help='The CTF model will be fit to regions '
                             'of the amplitude spectrum corresponding '
                             'to this range of resolution.')
        line.addParam('lowRes', params.FloatParam, default=50., label='Min')
        line.addParam('highRes', params.FloatParam, default=4., label='Max')

        line = group.addLine('Defocus search range (A)',
                             condition='not recalculate',
                             help='Select _minimum_ and _maximum_ values for '
                             'defocus search range (in A). Underfocus'
                             ' is represented by a positive number.')
        line.addParam('minDefocus',
                      params.FloatParam,
                      default=5000.,
                      label='Min')
        line.addParam('maxDefocus',
                      params.FloatParam,
                      default=90000.,
                      label='Max')
        group.addParam('stepDefocus',
                       params.FloatParam,
                       default=500.,
                       label='Defocus step (A)',
                       help='Step size for the defocus search.')

        form.addParam('astigmatism',
                      params.FloatParam,
                      default=1000.0,
                      label='Expected (tolerated) astigmatism',
                      help='Estimated astigmatism in Angstroms',
                      expertLevel=params.LEVEL_ADVANCED)

        form.addParam('plotResRing',
                      params.BooleanParam,
                      default=True,
                      label='Plot a resolution ring on a PSD file',
                      help='Whether to plot an estimated resolution ring '
                      'on the power spectrum',
                      expertLevel=params.LEVEL_ADVANCED)

        form.addHidden(params.GPU_LIST,
                       params.StringParam,
                       default='0',
                       expertLevel=params.LEVEL_ADVANCED,
                       label="Choose GPU IDs",
                       help="GPU may have several cores. Set it to zero"
                       " if you do not know what we are talking about."
                       " First core index is 0, second 1 and so on."
                       " You can use multiple GPUs - in that case"
                       " set to i.e. *0 1 2*.")

        form.addSection(label='Advanced')
        group = form.addGroup('EPA')
        group.addParam('doEPA',
                       params.BooleanParam,
                       default=True,
                       label="Do EPA",
                       help='Do Equiphase average used for output CTF file. '
                       'Only for nice output, will NOT be used for CTF '
                       'determination.')

        group.addParam('EPAsmp',
                       params.IntParam,
                       default=4,
                       condition='doEPA',
                       expertLevel=params.LEVEL_ADVANCED,
                       label="Over-sampling factor for EPA")
        group.addParam('doBasicRotave',
                       params.BooleanParam,
                       default=False,
                       condition='doEPA',
                       expertLevel=params.LEVEL_ADVANCED,
                       label="Do rotational average",
                       help='Do rotational average used for output CTF file. '
                       'Only for nice output, will NOT be used for CTF '
                       'determination.')

        group.addParam('overlap',
                       params.FloatParam,
                       default=0.5,
                       condition='doEPA',
                       expertLevel=params.LEVEL_ADVANCED,
                       label="Overlap factor",
                       help='Overlapping factor for grid boxes sampling, '
                       'for windowsize=512, 0.5 means 256 pixels overlapping.')
        group.addParam('convsize',
                       params.IntParam,
                       default=85,
                       condition='doEPA',
                       expertLevel=params.LEVEL_ADVANCED,
                       label="Boxsize for smoothing",
                       help='Boxsize to be used for smoothing, '
                       'suggested 1/5 ~ 1/20 of window size in pixel, '
                       'e.g. 99 for 512 window')

        if cls.isVersion118():
            group.addParam('smoothResL',
                           params.IntParam,
                           default=1000,
                           expertLevel=params.LEVEL_ADVANCED,
                           condition='doEPA',
                           label='Resolution for smoothing',
                           help='Provide a reasonable resolution for low '
                           'frequency background smoothing; 20 '
                           'angstrom suggested, 10-50 is proper range')

        form.addParam('bfactor',
                      params.IntParam,
                      default=150,
                      label="B-factor",
                      help='B-factors used to decrease high resolution '
                      'amplitude, A^2; suggested range 50~300 except '
                      'using REBS method  (see the paper for the details).')

        group = form.addGroup('High-res refinement')
        group.addParam('doHighRes',
                       params.BooleanParam,
                       default=False,
                       label="Do high-resolution refinement",
                       help='Whether to do High-resolution refinement or not, '
                       'very useful for selecting high quality micrographs. '
                       'Especially useful when your data has strong '
                       'low-resolution bias')
        group.addParam(
            'HighResL',
            params.FloatParam,
            default=15.0,
            condition='doHighRes',
            label="Lowest resolution",
            help='Lowest resolution  to be used for High-resolution '
            'refinement, in Angstroms')
        group.addParam(
            'HighResH',
            params.FloatParam,
            default=4.0,
            condition='doHighRes',
            label="Highest resolution",
            help='Highest resolution  to be used for High-resolution '
            'refinement, in Angstroms')
        group.addParam('HighResBf',
                       params.IntParam,
                       default=50,
                       condition='doHighRes',
                       label="B-factor",
                       help='B-factor to be used for High-resolution '
                       'refinement, in Angstroms')

        form.addParam('doValidate',
                      params.BooleanParam,
                      default=False,
                      expertLevel=params.LEVEL_ADVANCED,
                      label="Do validation",
                      help='Whether to validate the CTF determination.')

        form.addSection(label='Phase shift')
        form.addParam('doPhShEst',
                      params.BooleanParam,
                      default=False,
                      label="Estimate phase shift?",
                      help='For micrographs collected with phase-plate. '
                      'It is suggested to import such micrographs with '
                      'amplitude contrast = 0. Also, using smaller '
                      '_lowest resolution_ (e.g. 15A) and smaller '
                      '_boxsize for smoothing_ (e.g. 50 for 1024 '
                      'window size) might be better.')

        line = form.addLine('Phase shift range range (deg)',
                            condition='doPhShEst',
                            help='Select _lowest_ and _highest_ phase shift '
                            '(in degrees).')
        line.addParam('phaseShiftL',
                      params.FloatParam,
                      default=0.0,
                      condition='doPhShEst',
                      label="Min")
        line.addParam('phaseShiftH',
                      params.FloatParam,
                      default=180.0,
                      condition='doPhShEst',
                      label="Max")

        form.addParam('phaseShiftS',
                      params.FloatParam,
                      default=10.0,
                      condition='doPhShEst',
                      label="Step",
                      help='Phase shift search step. Do not worry about '
                      'the accuracy; this is just the search step, '
                      'Gctf will refine the phase shift anyway.')
        form.addParam('phaseShiftT',
                      params.EnumParam,
                      default=CCC,
                      condition='doPhShEst',
                      label='Target',
                      choices=['CCC', 'Resolution limit'],
                      display=params.EnumParam.DISPLAY_HLIST,
                      help='Phase shift target in the search: CCC or '
                      'resolution limit. Second option might generate '
                      'more accurate estimation if results are '
                      'essentially correct, but it tends to overfit high '
                      'resolution noise and might have the potential '
                      'possibility to generate completely wrong results. '
                      'The accuracy of CCC method might not be as '
                      'good, but it is more stable in general cases.')

        if cls.isVersion118():
            form.addParam('coSearchRefine',
                          params.BooleanParam,
                          default=False,
                          condition='doPhShEst',
                          label='Search and refine simultaneously?',
                          help='Specify this option to do refinement during '
                          'phase shift search. Default approach is to do '
                          'refinement after search.')
            form.addParam(
                'refine2DT',
                params.IntParam,
                validators=[
                    params.Range(1, 3, "value should be "
                                 "1, 2 or 3. ")
                ],
                default=1,
                condition='doPhShEst',
                label='Refinement type',
                help='Refinement type: 1, 2, 3 allowed.\n NOTE:  '
                'This parameter is different from Target and is'
                'optional for different types of refinement algorithm, '
                'in general cases they work similar. In challenging '
                'case, they might converge to different results, '
                'try to see which works best in your case. '
                'My suggestion is running as default first, and '
                'then try new refinement on the micrographs '
                'which failed.')

        form.addParallelSection(threads=1, mpi=1)