Skip to content

Commit

Permalink
Merge pull request #86 from scipion-em/devel
Browse files Browse the repository at this point in the history
Release 3.1.21
  • Loading branch information
pconesa authored Nov 15, 2023
2 parents f0b01ef + 72abae4 commit f94f9b5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 36 deletions.
42 changes: 15 additions & 27 deletions dynamo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
# *
# **************************************************************************
import os.path
from os.path import join
from os.path import join, dirname
import subprocess
import pwem
import pyworkflow
import pyworkflow.utils as pwutils
from .constants import *

__version__ = '3.1.20'
__version__ = '3.1.21'
_logo = "icon.png"
_references = ['CASTANODIEZ2012139']

Expand Down Expand Up @@ -106,28 +106,16 @@ def defineBinaries(cls, env):
cudaMsgs.append(msg)
useGpu = False

SW_EM = env.getEmFolder()
dyn_folder = 'dynamo-%s' % DEFAULT_VERSION

compile_cuda = "echo ' > %s' && " % preMsgs
if useGpu:
compile_cuda += "cd %s/%s/cuda && make clean && ./config.sh && " \
"make all && " \
"touch cuda_compiled && " % (SW_EM, dyn_folder)
compile_cuda += "echo ' > %s'" % cudaMsgs
commands = [(compile_cuda, '%s/%s/cuda/cuda_compiled' % (SW_EM, dyn_folder))]

env.addPackage('dynamo',
version='1.146',
tar='dynamo-1.146.tar.gz',
commands=commands,
default=False)

# Dynamo 1.1.532
commands = [("cd cuda && make clean && ./config.sh %s && make all && touch cuda_compiled" % os.path.dirname(pwem.Config.CUDA_LIB), 'cuda/cuda_compiled')]
env.addPackage('dynamo', version='1.1.532',
commands = "./dynamo_setup_linux.sh " # OpenMP commands
if useGpu:
# Cuda commands
commands += (f"&& cd cuda && ./config.sh {dirname(pwem.Config.CUDA_LIB)} && make clean && make motors && "
f"make extended && touch cuda_compiled")
commands = [(commands, 'cuda/cuda_compiled')]
env.addPackage(DYNAMO_PROGRAM, version=DYNAMO_VERSION_1_1_532,
tar='dynamo-v-1.1.532_MCR-9.9.0_GLNXA64_withMCR.tar',
createBuildDir = True,
createBuildDir=True,
commands=commands,
default=True)

Expand All @@ -140,11 +128,11 @@ def checkDynamoVersion(cls):
# Check the installed binary version
dynamoVer = cls.getHome().split('-')[-1].replace('v', '')
if int(dynamoVer.replace('.', '')) < MINIMUM_VERSION_NUM:
msg = ['The Dynamo version pointed by variable %s '
'(%s) is not supported --> %s.\n\n'
'Please, update the variable value or comment it in %s' %
(DYNAMO_HOME, dynamoVer, DYNAMO_VERSION_1_1_532,
pyworkflow.Config.SCIPION_CONFIG)]
msg = ['The Dynamo version pointed by variable %s '
'(%s) is not supported --> %s.\n\n'
'Please, update the variable value or comment it in %s' %
(DYNAMO_HOME, dynamoVer, DYNAMO_VERSION_1_1_532,
pyworkflow.Config.SCIPION_CONFIG)]
return msg

@classmethod
Expand Down
1 change: 0 additions & 1 deletion dynamo/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

DYNAMO_PROGRAM = 'dynamo'
DYNAMO_HOME = 'DYNAMO_HOME'
DYNAMO_VERSION_1_146 = '1.146'
DYNAMO_VERSION_1_1_532 = '1.1.532'
DEFAULT_VERSION = DYNAMO_VERSION_1_1_532
MINIMUM_VERSION_NUM = int(DYNAMO_VERSION_1_1_532.replace('.', ''))
Expand Down
8 changes: 4 additions & 4 deletions dynamo/convert/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def dynTableLine2Subtomo(inLine, subtomo, subtomoSet=None, tomo=None, coordSet=N
subtomoSet.append(subtomo)


def readDynCoord(tableFile, coord3DSet, tomo):
def readDynCoord(tableFile, coord3DSet, tomo, scaleFactor=1):
with open(tableFile) as fhTable:
for nline in fhTable:
coordinate3d = Coordinate3D()
Expand All @@ -160,9 +160,9 @@ def readDynCoord(tableFile, coord3DSet, tomo):
z = nline[25]
groupId = nline[21]
coordinate3d.setVolume(tomo)
coordinate3d.setX(float(x), const.BOTTOM_LEFT_CORNER)
coordinate3d.setY(float(y), const.BOTTOM_LEFT_CORNER)
coordinate3d.setZ(float(z), const.BOTTOM_LEFT_CORNER)
coordinate3d.setX(float(x) * scaleFactor, const.BOTTOM_LEFT_CORNER)
coordinate3d.setY(float(y) * scaleFactor, const.BOTTOM_LEFT_CORNER)
coordinate3d.setZ(float(z) * scaleFactor, const.BOTTOM_LEFT_CORNER)
coordinate3d.setGroupId(int(groupId))
coordinate3d.setMatrix(A)
coord3DSet.append(coordinate3d)
Expand Down
8 changes: 4 additions & 4 deletions dynamo/protocols/protocol_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from pyworkflow.protocol import PointerParam, EnumParam, IntParam, BooleanParam
from pyworkflow.utils import removeExt
from tomo.constants import BOTTOM_LEFT_CORNER, TR_DYNAMO
from tomo.objects import SetOfSubTomograms, SubTomogram
from tomo.objects import SetOfSubTomograms, SubTomogram, Coordinate3D, Tomogram
from dynamo import Plugin, VLL_FILE
from dynamo.convert import matrix2eulerAngles
from tomo.protocols import ProtTomoBase
Expand Down Expand Up @@ -123,10 +123,10 @@ def _initialize(self):
# Get the intersection between the tomograms and coordinates provided (this covers possible subsets made)
inTomos = self.getInputTomograms()
inCoords = self.inputCoordinates.get()
coordsPresentTomoIds = inCoords.getUniqueValues(['_tomoId'])
tomosPresentTsIds = inTomos.getUniqueValues(['_tsId'])
coordsPresentTomoIds = inCoords.getUniqueValues([Coordinate3D.TOMO_ID_ATTR])
tomosPresentTsIds = inTomos.getUniqueValues([Tomogram.TS_ID_FIELD])
commonTomoIds = list(set(coordsPresentTomoIds).intersection(set(tomosPresentTsIds)))
self.tomoTsIdDict = {tomo.getTsId(): tomo for tomo in inTomos if tomo.getTsId() in commonTomoIds}
self.tomoTsIdDict = {tomo.getTsId(): tomo.clone() for tomo in inTomos if tomo.getTsId() in commonTomoIds}
self.coordsFileName = self._getExtraPath('coords.txt')
self.anglesFileName = self._getExtraPath('angles.txt')
# Calculate the scale factor
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3'

# Specify Framework
'Framework :: Scipion :: 3'
],
)

0 comments on commit f94f9b5

Please sign in to comment.