Skip to content

Commit

Permalink
Merge pull request #185 from I2PC/fixes
Browse files Browse the repository at this point in the history
dose filter, removing extract stacks: fixed for merging base
  • Loading branch information
albertmena authored May 29, 2024
2 parents aa81664 + 8901c01 commit 76891ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 459 deletions.
1 change: 0 additions & 1 deletion xmipptomo/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from .protocol_dose_filter import XmippProtDoseFilter
from .protocol_filter_coordinates_by_map import XmippProtFilterCoordinatesByMap
from .protocol_crop_tomograms import XmippProtCropTomograms
from .protocol_extract_particlestacks import XmippProtExtractParticleStacks
from .protocol_extract_subtomos import XmippProtExtractSubtomos
from .protocol_flexalign import XmippProtTsFlexAlign
from .protocol_peak_high_contrast import XmippProtPeakHighContrast
Expand Down
17 changes: 12 additions & 5 deletions xmipptomo/protocols/protocol_dose_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import pwem.emlib.metadata as md
import pwem.emlib as emlib
from pwem.protocols import EMProtocol
from pyworkflow.utils import getExt

from tomo.protocols.protocol_base import ProtTomoImportFiles
from tomo.protocols import ProtTomoBase
Expand All @@ -42,6 +43,8 @@
SCIPION_IMPORT = 0
FIXED_DOSE = 1

EXT_MRCS = '.mrcs'


class XmippProtDoseFilter(ProtTomoImportFiles, EMProtocol, ProtTomoBase):
"""
Expand All @@ -61,13 +64,13 @@ def _defineParams(self, form):
params.PointerParam,
pointerClass='SetOfTiltSeries',
important=True,
label='Input set of tilt-series to be filtered.')
label='Tilt-series to be filtered.')

form.addParam('initialDose',
params.FloatParam,
default=0.0,
expertLevel=params.LEVEL_ADVANCED,
label='Initial dose (e/sq A)',
label='Initial dose (e/A^2)',
help='Dose applied before any of the images in the input file were taken; this value will be '
'added to all the prior dose values, however they were obtained.')

Expand All @@ -93,12 +96,16 @@ def doseFilterStep(self, tsObjId):

firstItem = ts.getFirstItem()

fnMd = 'image_and_dose.xmd'
fnMd = self._getExtraPath(tsId, 'image_and_dose.xmd')
mdDose = md.MetaData()
idx = 1
for ti in ts:
doseValue = ti.getAcquisition().getAccumDose()
fn = ti.getFileName()
ext = getExt(fn)
if ext == '.mrc' or ext == '.map':
fn = fn+':mrcs'

strimg = str(idx) + '@' + fn
idx = idx + 1

Expand All @@ -110,8 +117,8 @@ def doseFilterStep(self, tsObjId):
mdDose.write(fnMd)

params = ' -i %s ' % fnMd
params += ' -o %s ' % (os.path.join(extraPrefix, os.path.splitext(os.path.basename(ts.getFileName()))[0] + '.mrcs'))
params += ' --sampling %s' % self.inputSetOfTiltSeries.get().getSamplingRate()
params += ' -o %s ' % (os.path.join(extraPrefix, os.path.splitext(os.path.basename(ts.getFileName()))[0] + EXT_MRCS))
params += ' --sampling %s ' % self.inputSetOfTiltSeries.get().getSamplingRate()
params += ' --voltage %f ' % ts.getAcquisition().getVoltage()

self.runJob('xmipp_tomo_tiltseries_dose_filter', params)
Expand Down
Loading

0 comments on commit 76891ac

Please sign in to comment.