xmipp3.base module

class xmipp3.base.HelicalFinder[source]

Bases: object

Base class for protocols that find helical symmetry

runCoarseSearch(fnVol, dihedral, heightFraction, z0, zF, zStep, rot0, rotF, rotStep, Nthr, fnOut, cylinderInnerRadius, cylinderOuterRadius, height, Ts)[source]
runFineSearch(fnVol, dihedral, fnCoarse, fnFine, heightFraction, z0, zF, rot0, rotF, cylinderInnerRadius, cylinderOuterRadius, height, Ts)[source]
runSymmetrize(fnVol, dihedral, fnParams, fnOut, heightFraction, cylinderInnerRadius, cylinderOuterRadius, height, Ts)[source]
class xmipp3.base.ProjMatcher[source]

Bases: object

Base class for protocols that use a projection

produceAlignedImagesStep(volumeIsCTFCorrected, fn, images)[source]
projMatchStep(volume, angularSampling, symmetryGroup, images, fnAngles, Xdim)[source]
class xmipp3.base.XmippProtocol[source]

Bases: object

This class groups some common functionalities that share some Xmipp protocols, like converting steps.

convertInputToXmipp(inputName, xmippClass, resultFn)[source]

This step can be used whenever a conversion is needed. It will receive the inputName and get this attribute from self, invoke the convert function and check the result files if conversion was done (otherwise the input was already in Xmipp format).

classmethod getCondaEnv(**kwargs)[source]

Returns the environ corresponding to the condaEnv of the protocol. kwargs can contain:

  • ‘env’: Any environ (the xmipp one is the default)
  • ‘_conda_env’: An installed condaEnv name

> _conda_env preference: kwargs > protocol default > general default


Retrieve the converted input, it can be the case that it is the same as input, when not conversion was done.

classmethod getModel(*modelPath, **kwargs)[source]
Returns the path to the models folder followed by
the given relative path.

…/xmipp/models/myModel/myFile.h5 <= getModel(‘myModel’, ‘myFile.h5’)

NOTE: it raise and exception when model not found, set doRaise=False
in the arguments to skip that raise, especially in validation asserions!
validateDLtoolkit(errors=None, **kwargs)[source]

Validates if the deepLearningToolkit is installed. Additionally, it assert if a certain models is present when kwargs are present, following:

  • _conda_env: The conda env to be load
    (default: the protocol._conda_env or CONDA_DEFAULT_ENVIRON)
  • assertModel: if models should be evaluated or not (default: True).
  • errorMsg: a custom message error (default: ‘’).
  • model: a certain model name/route/list (default: no model assert) + model=’myModel’: asserts if myModel exists + model=(‘myModel’, ‘myFile.h5’): asserts is myModel/myFile.h5 exists + model=[‘myModel1’, ‘myModel2’, (‘myModel3’, ‘myFile3.h5’)]: a combination
usage (3 examples):
errors = validateDLtoolkit(errors, doAssert=self.useModel.get(),

errors = validateDLtoolkit(model=(“myModel2”, “myFile.h5”))

errors = validateDLtoolkit(doAssert=self.mode.get()==PREDICT,

model=(“myModel3”, “subFolder”, “model.h5”), errorMsg=”myModel3 is required for the “

“prediction mode”)
class xmipp3.base.XmippSet(itemClass)[source]

Bases: object

Support class to store sets in Xmipp base on a MetaData.


Add a new item to the set, the item can be of a base class (EM) and will be try to convert it to the respective _itemClass.

convert(xmippSetClass, filename)[source]

Convert from a generic set to a xmippSetClass. In particular a filename is requiered to store the result MetaData. It is also asummed that this class have a .copyInfo method.


Return the Class of the items in the Set.

write(filename, mode)[source]
xmipp3.base.findRow(md, label, value)[source]

Query the metadata for a row with label=value. Params:

md: metadata to query. label: label to check value value: value for equal condition
Row object of the row found. None if no row is found with label=value
xmipp3.base.findRowById(md, value)[source]

Same as findRow, but using MDL_ITEM_ID for label.


From xmipp label to python variable type


Create a MetaData but only read the first row. This method should be used for validations of labels or metadata size, but the full metadata is not needed.


Return the path the the Xmipp installation folder if a subfolder is provided, will be concatenated to the path


Iterate over the rows of the given metadata.