-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into fix_test_score_coordinates
- Loading branch information
Showing
15 changed files
with
164 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# ************************************************************************** | ||
# * | ||
# * Authors: J.L. Vilas ([email protected]) | ||
# * | ||
# * Unidad de Bioinformatica of Centro Nacional de Biotecnologia , CSIC | ||
# * | ||
# * This program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 3 of the License, or | ||
# * (at your option) any later version. | ||
# * | ||
# * This program is distributed in the hope that it will be useful, | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# * GNU General Public License for more details. | ||
# * | ||
# * You should have received a copy of the GNU General Public License | ||
# * along with this program; if not, write to the Free Software | ||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
# * 02111-1307 USA | ||
# * | ||
# * All comments concerning this program package may be sent to the | ||
# * e-mail address '[email protected]' | ||
# * | ||
# ************************************************************************** | ||
from pyworkflow.tests import BaseTest, setupTestProject | ||
from tomo.protocols.protocol_import_coordinates import IMPORT_FROM_EMAN | ||
import tomo.protocols | ||
|
||
from xmipptomo.protocols.protocol_cltomo import XmippProtCLTomo | ||
from xmipptomo.protocols.protocol_extract_subtomos import XmippProtExtractSubtomos | ||
|
||
## Tomogram type constants for particle extraction | ||
#OUTPUTATTRIBUTE = 'Subtomograms' | ||
|
||
class TestXmippProtCLTomoBase(BaseTest): | ||
@classmethod | ||
def setUpClass(cls): | ||
setupTestProject(cls) | ||
|
||
@classmethod | ||
def setData(cls, projectData='tomo-em'): | ||
from tomo.tests import DataSet | ||
cls.dataset = DataSet.getDataSet(projectData) | ||
cls.tomogram = cls.dataset.getFile('tomo1') | ||
cls.coords3D = cls.dataset.getFile('overview_wbp.txt') | ||
cls.coords3D_Large = cls.dataset.getFile('overview_wbp_large.txt') | ||
cls.inputSetOfSubTomogram = cls.dataset.getFile('subtomo') | ||
cls.smallTomogram = cls.dataset.getFile('coremask_normcorona.mrc') | ||
|
||
|
||
class TestXmippProtCLtomo(TestXmippProtCLTomoBase): | ||
""" | ||
This prepares the protocols to perform the necessary tests. | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
setupTestProject(cls) | ||
TestXmippProtCLtomo.setData() | ||
|
||
def _runImportCoordinatesAndTomograms(self): | ||
protImportTomogram = self.newProtocol(tomo.protocols.ProtImportTomograms, | ||
filesPath=self.tomogram, | ||
samplingRate=5) | ||
|
||
self.launchProtocol(protImportTomogram) | ||
|
||
protImportCoordinates3d = self.newProtocol(tomo.protocols.ProtImportCoordinates3D, | ||
auto=IMPORT_FROM_EMAN, | ||
filesPath=self.coords3D, | ||
importTomograms=protImportTomogram.Tomograms, | ||
filesPattern='', boxSize=32, | ||
samplingRate=5) | ||
|
||
self.launchProtocol(protImportCoordinates3d) | ||
self.assertSetSize(protImportTomogram.Tomograms, 1, | ||
"There was a problem with tomogram output") | ||
self.assertSetSize(protImportCoordinates3d.outputCoordinates, 5, | ||
"There was a problem with coordinates 3d output") | ||
|
||
protTomoExtraction = self.newProtocol(XmippProtExtractSubtomos, | ||
tomograms=protImportTomogram.Tomograms, | ||
coords=protImportCoordinates3d.outputCoordinates, | ||
invertContrast=True, | ||
boxSize=32) | ||
|
||
self.launchProtocol(protTomoExtraction) | ||
self.assertSetSize(getattr(protTomoExtraction, 'Subtomograms'), 5, | ||
"There was a problem with SetOfSubtomogram output") | ||
|
||
return protTomoExtraction | ||
|
||
def _runXmippCLtomo(self): | ||
protTomoExtraction = self._runImportCoordinatesAndTomograms() | ||
protCLTomo = self.newProtocol(XmippProtCLTomo, inputVolumes=protTomoExtraction.Subtomograms) | ||
|
||
self.launchProtocol(protCLTomo) | ||
|
||
|
||
return protCLTomo | ||
|
||
|
||
class TestXmippProtCLtomo(TestXmippProtCLtomo): | ||
""" | ||
This class check if CLtomos in Xmipptomo works properly. | ||
""" | ||
|
||
def test_CLtomo(self): | ||
protCLTomo = self._runXmippCLtomo() | ||
msg = "There was a problem with CLtomo" | ||
self.assertIsNotNone(protCLTomo.outputClasses, msg) | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,11 +23,10 @@ | |
# * e-mail address '[email protected]' | ||
# * | ||
# ************************************************************************** | ||
from os.path import exists, join, split | ||
|
||
from pyworkflow.tests import BaseTest, DataSet, setupTestProject | ||
from tomo.protocols import ProtImportTomograms | ||
from xmipptomo.protocols import XmippProtCropTomograms | ||
from xmipptomo.protocols.protocol_crop_tomograms import SUFIXCROPPED | ||
|
||
|
||
class TestReSizeBase(BaseTest): | ||
|
@@ -55,16 +54,15 @@ def setUpClass(cls): | |
cls.protImportTomos = cls.runImportTomograms(cls.tomos, 16.14) | ||
|
||
def testCropTomogramsSamplingRate(self): | ||
Rrb = XmippProtCropTomograms() | ||
crop = self.newProtocol(XmippProtCropTomograms, | ||
objLabel='crop tomos', | ||
inputSet=self.protImportTomos.Tomograms, | ||
xcrop0=100, | ||
xcropF=900, | ||
ycrop0=100, | ||
ycropF=900, | ||
zcrop0=10, | ||
zcropF=100) | ||
objLabel='crop tomos', | ||
inputSet=self.protImportTomos.Tomograms, | ||
xcrop0=100, | ||
xcropF=900, | ||
ycrop0=100, | ||
ycropF=900, | ||
zcrop0=10, | ||
zcropF=100) | ||
self.launchProtocol(crop) | ||
|
||
self.assertTrue(crop) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,10 @@ | |
# * e-mail address '[email protected]' | ||
# * | ||
# ************************************************************************** | ||
from os.path import exists, join, split | ||
|
||
from pyworkflow.tests import BaseTest, DataSet, setupTestProject | ||
from tomo.protocols import ProtImportTomograms | ||
from xmipptomo.protocols import XmippProtResizeTomograms, XmippProtResizeTiltSeries | ||
from xmipptomo.protocols.protocol_crop_resize_base import XmippProtResizeBase | ||
import os | ||
from xmipptomo.protocols import XmippProtResizeTomograms | ||
|
||
|
||
class TestReSizeBase(BaseTest): | ||
|
@@ -49,51 +47,49 @@ def runImportTomograms(cls, pattern, samplingRate): | |
|
||
|
||
class TestReSizeTomograms(TestReSizeBase): | ||
_objLabel = 'Resize tomos' | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
setupTestProject(cls) | ||
TestReSizeBase.setData() | ||
cls.protImportTomos = cls.runImportTomograms(cls.tomos, 16.14) | ||
|
||
def testReSizeTomogramsSamplingRate(self): | ||
Rrb = XmippProtResizeTomograms() | ||
protResizeTomos = XmippProtResizeTomograms() | ||
reSize = self.newProtocol(XmippProtResizeTomograms, | ||
objLabel='Resize tomos', | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption = Rrb.RESIZE_SAMPLINGRATE, | ||
resizeSamplingRate = 32.28) | ||
objLabel=self._objLabel, | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption=protResizeTomos.RESIZE_SAMPLINGRATE, | ||
resizeSamplingRate=32.28) | ||
self.launchProtocol(reSize) | ||
self.assertTrue(reSize) | ||
self.assertSetSize(reSize.outputSetOfTomograms, 2, | ||
"resize has failed in the samplingrate option probably related with the use " | ||
"of a SetOfTomograms (processing the second tomogram)") | ||
|
||
|
||
def testReSizeTomogramsFactor(self): | ||
Rrb = XmippProtResizeTomograms() | ||
protResizeTomos = XmippProtResizeTomograms() | ||
reSize = self.newProtocol(XmippProtResizeTomograms, | ||
objLabel='Resize tomos', | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption = Rrb.RESIZE_FACTOR, | ||
resizeFactor = 0.5) | ||
objLabel=self._objLabel, | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption=protResizeTomos.RESIZE_FACTOR, | ||
resizeFactor=0.5) | ||
self.launchProtocol(reSize) | ||
self.assertTrue(reSize) | ||
self.assertSetSize(reSize.outputSetOfTomograms, 2, | ||
"resize has failed in the Factor option probably related with the use " | ||
"of a SetOfTomograms (processing the second tomogram)") | ||
|
||
|
||
def testReSizeTomogramsPiramid(self): | ||
Rrb = XmippProtResizeTomograms() | ||
protResizeTomos = XmippProtResizeTomograms() | ||
reSize = self.newProtocol(XmippProtResizeTomograms, | ||
objLabel='Resize tomos', | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption = Rrb.RESIZE_PYRAMID, | ||
resizeLevel = 0) | ||
objLabel=self._objLabel, | ||
inputSet=self.protImportTomos.Tomograms, | ||
resizeOption=protResizeTomos.RESIZE_PYRAMID, | ||
resizeLevel=0) | ||
self.launchProtocol(reSize) | ||
self.assertTrue(reSize) | ||
self.assertSetSize(reSize.outputSetOfTomograms, 2, | ||
"Resize has failed in the pyramid option probably related with the use " | ||
"of a SetOfTomograms (processing the second tomogram)") | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.