From 392a5c3c966e0f99833ddd8c7f08d238134194cf Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 14:39:59 +0200
Subject: [PATCH 1/7] log message added
---
novactf/protocols/protocol_tomoDefocus.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/novactf/protocols/protocol_tomoDefocus.py b/novactf/protocols/protocol_tomoDefocus.py
index 38649df..459b143 100644
--- a/novactf/protocols/protocol_tomoDefocus.py
+++ b/novactf/protocols/protocol_tomoDefocus.py
@@ -144,11 +144,14 @@ def convertInputStep(self, tsObjId):
# Generate angle file
angleFilePath = os.path.join(tmpPrefix,
firstItem.parseFileName(extension=".tlt"))
+
+ self.info("Generating %s" % angleFilePath)
ts.generateTltFile(angleFilePath)
# Generate defocus file
defocusFilePath = os.path.join(extraPrefix,
firstItem.parseFileName(extension=".defocus"))
+
imodUtils.generateDefocusIMODFileFromObject(ctfTomoSeries, defocusFilePath)
def computeDefocusStep(self, tsObjId):
From 0d11de502374a38c9b7df34044881bf9a5bdc219 Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 14:48:28 +0200
Subject: [PATCH 2/7] log message added
---
novactf/protocols/protocol_tomoDefocus.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/novactf/protocols/protocol_tomoDefocus.py b/novactf/protocols/protocol_tomoDefocus.py
index 459b143..a60fafa 100644
--- a/novactf/protocols/protocol_tomoDefocus.py
+++ b/novactf/protocols/protocol_tomoDefocus.py
@@ -128,8 +128,10 @@ def _insertAllSteps(self):
# --------------------------- STEPS functions -----------------------------
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)
From 0f461ec27c9504ac9417edf010e2b19e3c0a0c84 Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 17:21:51 +0200
Subject: [PATCH 3/7] centralising paths composition
---
novactf/protocols/protocol_tomoDefocus.py | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/novactf/protocols/protocol_tomoDefocus.py b/novactf/protocols/protocol_tomoDefocus.py
index a60fafa..7ad8814 100644
--- a/novactf/protocols/protocol_tomoDefocus.py
+++ b/novactf/protocols/protocol_tomoDefocus.py
@@ -138,38 +138,37 @@ def convertInputStep(self, tsObjId):
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()
@@ -181,7 +180,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(),
From ca60ea609714bdbbfe26558ab4cd4734b8ea6b62 Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 17:30:33 +0200
Subject: [PATCH 4/7] using getDefocusFileName(tsId) in reconstruction
---
novactf/protocols/protocol_tomoReconstruction.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/novactf/protocols/protocol_tomoReconstruction.py b/novactf/protocols/protocol_tomoReconstruction.py
index bcc33dc..6c8c3e7 100644
--- a/novactf/protocols/protocol_tomoReconstruction.py
+++ b/novactf/protocols/protocol_tomoReconstruction.py
@@ -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_"))
From 941e23620b9558ee1fadc258b66da88c7c75e58f Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 17:33:36 +0200
Subject: [PATCH 5/7] fix missing _ at the end
---
novactf/protocols/protocol_tomoReconstruction.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/novactf/protocols/protocol_tomoReconstruction.py b/novactf/protocols/protocol_tomoReconstruction.py
index 6c8c3e7..9836f96 100644
--- a/novactf/protocols/protocol_tomoReconstruction.py
+++ b/novactf/protocols/protocol_tomoReconstruction.py
@@ -184,7 +184,7 @@ def processIntermediateStacksStep(self, tsObjId, counter):
tsId = ts.getTsId()
tmpPrefix = self._getTmpPath(tsId)
- defocusFilePath = self.protTomoCtfDefocus.get().getDefocusFileName(tsId)
+ defocusFilePath = self.protTomoCtfDefocus.get().getDefocusFileName(tsId) + "_"
tltFilePath = os.path.join(tmpPrefix, firstItem.parseFileName(extension=".tlt"))
outputFilePath = os.path.join(tmpPrefix, firstItem.parseFileName(extension=".mrc_"))
From 6407c95143701c0907b8cc6be57ff7100b09ad10 Mon Sep 17 00:00:00 2001
From: pconesa
Date: Fri, 11 Aug 2023 18:36:58 +0200
Subject: [PATCH 6/7] set reconstruction name this time
---
novactf/protocols/protocol_tomoDefocus.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/novactf/protocols/protocol_tomoDefocus.py b/novactf/protocols/protocol_tomoDefocus.py
index 7ad8814..769f378 100644
--- a/novactf/protocols/protocol_tomoDefocus.py
+++ b/novactf/protocols/protocol_tomoDefocus.py
@@ -221,7 +221,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())
From 7967d29de09c2432dcebe98f25e5d62f8f43d994 Mon Sep 17 00:00:00 2001
From: Grigory Sharov
Date: Sat, 12 Aug 2023 13:56:20 +0100
Subject: [PATCH 7/7] add changelog
---
CHANGES.txt | 1 +
novactf/__init__.py | 2 +-
novactf/protocols/protocol_tomoDefocus.py | 6 ++----
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index d5c0e17..fdf8886 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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
diff --git a/novactf/__init__.py b/novactf/__init__.py
index b66fcf6..ad2ad5f 100644
--- a/novactf/__init__.py
+++ b/novactf/__init__.py
@@ -27,7 +27,7 @@
import pwem
-__version__ = '3.1.1'
+__version__ = '3.1.2'
_references = ["Turonova2017"]
NOVACTF_HOME = 'NOVACTF_HOME'
diff --git a/novactf/protocols/protocol_tomoDefocus.py b/novactf/protocols/protocol_tomoDefocus.py
index 769f378..f5db4fa 100644
--- a/novactf/protocols/protocol_tomoDefocus.py
+++ b/novactf/protocols/protocol_tomoDefocus.py
@@ -24,7 +24,6 @@
# *
# *****************************************************************************
-import os
from glob import glob
from pyworkflow import BETA
@@ -128,7 +127,6 @@ def _insertAllSteps(self):
# --------------------------- STEPS functions -----------------------------
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))
@@ -154,7 +152,7 @@ def convertInputStep(self, tsObjId):
imodUtils.generateDefocusIMODFileFromObject(ctfTomoSeries, defocusFilePath)
def getTltFileName(self, tsId):
- return self._getTmpPath(tsId, tsId+".tlt")
+ return self._getTmpPath(tsId, tsId + ".tlt")
def getDefocusFileName(self,tsId):
return self._getExtraPath(tsId, tsId + ".defocus")
@@ -222,7 +220,7 @@ def triggerReconstructionProtocolStep(self):
applyAlignment = self.getInputTs().getFirstItem().getFirstItem().hasTransform()
- label = self.getObjLabel() + " - REC."
+ label = self.getObjLabel() + " - REC"
protTomoReconstruction = ProtNovaCtfTomoReconstruction(applyAlignment=applyAlignment,
objLabel=label)
protTomoReconstruction.protTomoCtfDefocus.set(self)