Skip to content

Commit

Permalink
Merge branch 'devel' into co_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
albertmena authored May 13, 2024
2 parents 3df1bb5 + 6415252 commit c37448f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
11 changes: 6 additions & 5 deletions xmipp3/protocols/protocol_compare_reprojections.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from pyworkflow import VERSION_1_1
from pyworkflow.protocol.params import (PointerParam, StringParam, FloatParam, BooleanParam, IntParam)
from pyworkflow.utils.path import cleanPath
from pyworkflow.utils.path import cleanPath, cleanPattern
from pwem.protocols import ProtAnalysis3D
from pwem.objects import (SetOfClasses2D, Image, SetOfAverages, SetOfParticles)
import pwem.emlib.metadata as md
Expand Down Expand Up @@ -133,7 +133,7 @@ def produceResiduals(self, fnAngles, Ts):
xdim = self._getDimensions()
args = "-i %s -o %s --ref %s --optimizeAngles --optimizeShift --max_shift %d --oprojections %s --sampling %f" \
% (fnAngles, anglesOutFn, fnVol, floor(xdim*0.05), projectionsOutFn, Ts)
self.fnResiduals = self._getExtraPath("residuals.stk")
self.fnResiduals = self._getExtraPath("residuals.mrcs")
if self.doEvaluateResiduals:
args += " --oresiduals %s" % self.fnResiduals

Expand All @@ -143,13 +143,13 @@ def produceResiduals(self, fnAngles, Ts):
args += "--optimizeGray --max_gray_scale 0.95 "
self.runJob("xmipp_angular_continuous_assign2", args)

if self.doEvaluateResiduals:
self._computeResiduals(fnVol)
# if self.doEvaluateResiduals:
# self._computeResiduals(fnVol)

def evaluateResiduals(self):
# Evaluate each image
fnAutoCorrelations = self._getExtraPath("autocorrelations.xmd")
stkAutoCorrelations = self._getExtraPath("autocorrelations.stk")
stkAutoCorrelations = self._getExtraPath("autocorrelations.mrcs")
stkResiduals = self.fnResiduals
anglesOutFn = self._getExtraPath("anglesCont.xmd")
self.runJob("xmipp_image_residuals", " -i %s -o %s --save_metadata_stack %s"
Expand Down Expand Up @@ -277,6 +277,7 @@ def _computeResiduals(self, fnVol):
cleanPath(fnNewParticles)
if os.path.exists(mrcsresiduals):
cleanPath(mrcsresiduals)
cleanPattern(self._getExtraPath("residual_part*.stk"))

# --------------------------- INFO functions --------------------------------------------
def _summary(self):
Expand Down
5 changes: 4 additions & 1 deletion xmipp3/protocols/protocol_convert_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _defineParams(self, form):
This definition is also used to generate automatically the GUI.
"""
# Defining condition string for x, y, z coords
coordsCondition = 'setSize and not vol'
coordsCondition = 'setSize and not vol and not isinstance(pdbObj, SetOfAtomStructs)'

# Defining parallel arguments
form.addParallelSection(threads=4, mpi=1)
Expand Down Expand Up @@ -254,6 +254,9 @@ def _validate(self):
if self.numberOfMpi > 1:
errors.append('MPI cannot be selected, because Scipion is going to drop support for it. Select threads instead.')

if isinstance(self.pdbObj.get(), SetOfAtomStructs) and not self.size.hasValue():
errors.append('Please set size when using SetOfAtomStructs as input')

return errors

# --------------------------- UTLIS functions --------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions xmipp3/protocols/protocol_extract_particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def readPartsFromMics(self, micList, outputParts):
# adding the variance and Gini coeff. value of the mic zone
setXmippAttributes(p, row, md.MDL_SCORE_BY_VAR)
setXmippAttributes(p, row, md.MDL_SCORE_BY_GINI)
setXmippAttributes(p, row, md.MDL_LOCAL_AVERAGE)
if row.containsLabel(md.MDL_ZSCORE_DEEPLEARNING1):
setXmippAttributes(p, row, md.MDL_ZSCORE_DEEPLEARNING1)

Expand Down
12 changes: 8 additions & 4 deletions xmipp3/protocols/protocol_generate_reprojections.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import os

from pyworkflow import VERSION_2_0
from pyworkflow.protocol.params import PointerParam
from pyworkflow.protocol.params import PointerParam, BooleanParam
from pyworkflow.utils.path import cleanPath
from pwem.protocols import ProtAnalysis3D
from pwem.objects import Image
Expand Down Expand Up @@ -60,6 +60,9 @@ def _defineParams(self, form):
form.addParam('inputVolume', PointerParam, label="Volume to compare images to", important=True,
pointerClass='Volume',
help='Volume to be used for class comparison')
form.addParam('ignoreCTF', BooleanParam, default=True, label='Ignore CTF',
help='By ignoring the CTF you will create projections more similar to what a person expects, '
'while by using the CTF you will create projections more similar to what the microscope sees')
form.addParallelSection(threads=0, mpi=8)

#--------------------------- INSERT steps functions --------------------------------------------
Expand Down Expand Up @@ -96,9 +99,10 @@ def produceProjections(self, fnAngles, Ts):
fnVol = self._getTmpPath("volume.vol")
anglesOutFn = self._getExtraPath("anglesCont.stk")
projectionsOutFn = self._getExtraPath("projections.stk")
args = "-i %s -o %s --ref %s --oprojections %s --sampling %f " \
"--max_angular_change 90" % (fnAngles, anglesOutFn, fnVol,
projectionsOutFn, Ts)
args = "-i %s -o %s --ref %s --oprojections %s --sampling %f " %\
(fnAngles, anglesOutFn, fnVol, projectionsOutFn, Ts)
if self.ignoreCTF:
args += " --ignoreCTF "
self.runJob("xmipp_angular_continuous_assign2", args)
fnNewParticles = self._getExtraPath("images.stk")
if os.path.exists(fnNewParticles):
Expand Down

0 comments on commit c37448f

Please sign in to comment.