Skip to content

Commit

Permalink
Merge pull request #46 from scipion-em/devel
Browse files Browse the repository at this point in the history
3.1.2
  • Loading branch information
fede-pe committed Nov 17, 2023
2 parents 8082c66 + 4f66405 commit 90a1d1b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
3.1.2: fix tlt and defocus files do not correspond to the tilt series
3.1.1: fix reconstruction protocol trigger if no alignment exists
3.1:
- fix defocus shift: should be passed in a file for ctf correction, and as a param for reconstruction
Expand Down
2 changes: 1 addition & 1 deletion novactf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import pwem


__version__ = '3.1.1'
__version__ = '3.1.2'
_references = ["Turonova2017"]
NOVACTF_HOME = 'NOVACTF_HOME'

Expand Down
33 changes: 19 additions & 14 deletions novactf/protocols/protocol_tomoDefocus.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# *
# *****************************************************************************

import os
from glob import glob

from pyworkflow import BETA
Expand Down Expand Up @@ -130,41 +129,44 @@ def _insertAllSteps(self):
def convertInputStep(self, tsObjId):
ts = self.getInputTs()[tsObjId]
tsId = ts.getTsId()
self.info("Generating tlt file and defocus file for %s (id %s)" % (tsId, tsObjId))

ctfTomoSeries = self.getCtfTomoSeriesFromTsId(tsId)

tmpPrefix = self._getTmpPath(tsId)
extraPrefix = self._getExtraPath(tsId)

# Create the folders for the tilt series
path.makePath(tmpPrefix)
path.makePath(extraPrefix)

firstItem = ts.getFirstItem()

# Generate angle file
angleFilePath = os.path.join(tmpPrefix,
firstItem.parseFileName(extension=".tlt"))
angleFilePath = self.getTltFileName(tsId)

self.info("Generating %s" % angleFilePath)
ts.generateTltFile(angleFilePath)

# Generate defocus file
defocusFilePath = os.path.join(extraPrefix,
firstItem.parseFileName(extension=".defocus"))
defocusFilePath = self.getDefocusFileName(tsId)

imodUtils.generateDefocusIMODFileFromObject(ctfTomoSeries, defocusFilePath)

def getTltFileName(self, tsId):
return self._getTmpPath(tsId, tsId + ".tlt")

def getDefocusFileName(self,tsId):
return self._getExtraPath(tsId, tsId + ".defocus")

def computeDefocusStep(self, tsObjId):
ts = self.getInputTs()[tsObjId]
tsId = ts.getTsId()

tmpPrefix = self._getTmpPath(ts.getTsId())
extraPrefix = self._getExtraPath(tsId)

firstItem = ts.getFirstItem()

ih = ImageHandler()
xDim, yDim, _, _ = ih.getDimensions(firstItem.getFileName() + ":mrc")

defocusFilePath = os.path.join(extraPrefix,
firstItem.parseFileName(extension=".defocus"))
defocusFilePath = self.getDefocusFileName(tsId)

if self.tomoShift.get() > 0.01:
defocusShift = self.tomoThickness.get() / 2 + self.tomoShift.get()
Expand All @@ -176,7 +178,7 @@ def computeDefocusStep(self, tsObjId):
'InputProjections': firstItem.getFileName(),
'FullImage': str(xDim) + "," + str(yDim),
'Thickness': self.tomoThickness.get(),
'TiltFile': os.path.join(tmpPrefix, firstItem.parseFileName(extension=".tlt")),
'TiltFile': self.getTltFileName(tsId),
'CorrectionType': "phaseflip" if self.correctionType.get() == 0 else "multiplication",
'DefocusFileFormat': "imod",
'CorrectAstigmatism': self.correctAstigmatism.get(),
Expand Down Expand Up @@ -217,7 +219,10 @@ def triggerReconstructionProtocolStep(self):
project = manager.loadProject(self.getProject().getName())

applyAlignment = self.getInputTs().getFirstItem().getFirstItem().hasTransform()
protTomoReconstruction = ProtNovaCtfTomoReconstruction(applyAlignment=applyAlignment)

label = self.getObjLabel() + " - REC"
protTomoReconstruction = ProtNovaCtfTomoReconstruction(applyAlignment=applyAlignment,
objLabel=label)
protTomoReconstruction.protTomoCtfDefocus.set(self)
protTomoReconstruction.numberOfThreads.set(self.numberOfThreads.get())
protTomoReconstruction.numberOfMpi.set(self.numberOfMpi.get())
Expand Down
4 changes: 1 addition & 3 deletions novactf/protocols/protocol_tomoReconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ def processIntermediateStacksStep(self, tsObjId, counter):

tsId = ts.getTsId()
tmpPrefix = self._getTmpPath(tsId)
extraPrefixPreviousProt = self.protTomoCtfDefocus.get()._getExtraPath(tsId)

defocusFilePath = os.path.join(extraPrefixPreviousProt,
firstItem.parseFileName(extension=".defocus_"))
defocusFilePath = self.protTomoCtfDefocus.get().getDefocusFileName(tsId) + "_"
tltFilePath = os.path.join(tmpPrefix, firstItem.parseFileName(extension=".tlt"))
outputFilePath = os.path.join(tmpPrefix, firstItem.parseFileName(extension=".mrc_"))

Expand Down

0 comments on commit 90a1d1b

Please sign in to comment.