Skip to content

Commit 32c1e1d

Browse files
committed
fixed a mistake in the output format. The first entry in the output of Superpose3D() is now a number instead of a rank-0 tensor. The previous behavior (rank-0 tensor) was a mistake which my automated tests failed to catch. Changing this might break backward compatibility for some users.
1 parent f2f4218 commit 32c1e1d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def Superpose3D(X, # <-- Nx3 array of coords for the "frozen" point cloud
8181

8282
url='https://github.com/jewettaij/superpose3d',
8383

84-
download_url='https://github.com/jewettaij/superpose3d/archive/v1.1.1.zip',
84+
download_url='https://github.com/jewettaij/superpose3d/archive/v1.2.0.zip',
8585

86-
version='1.1.1',
86+
version='1.2.0',
8787

8888
install_requires=[
8989
'numpy',

superpose3d/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def Superpose3D(aaXf_orig, # <-- coordinates for the "frozen" object
6868
aWeights = np.array(aWeights).reshape(N,1)
6969
aCenter_f = np.sum(aaXf_orig * aWeights, axis=0)
7070
aCenter_m = np.sum(aaXm_orig * aWeights, axis=0)
71-
sum_weights = np.sum(aWeights, axis=0)
71+
sum_weights = np.sum(aWeights)
7272

7373
# Subtract the centers-of-mass from the original coordinates for each object
7474
""" # old code (using for-loops)

test_superpose3d.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ def test_superpose3d():
2222
w = [1.0, 1.0, 1.0, 1.0]
2323
result = Superpose3D(X, xscshift, w, True)
2424
# Does the RMSD returned in result[0] match the RMSD calculated manually?
25-
R = np.matrix(result[1]) # rotation matrix
26-
T = np.matrix(result[2]).transpose() # translation vector (3x1 matrix)
27-
c = result[3] # scalar
25+
R = np.array(result[1]) # rotation matrix
26+
T = np.array(result[2]).transpose() # translation vector (3x1 matrix)
27+
c = result[3] # scalar
2828
if len(X) > 0:
29-
_x = np.matrix(xscshift).transpose()
30-
_xprime = c*R*_x + T
29+
_x = np.array(xscshift).transpose()
30+
# _xprime = c*R*_x + T <-- syntax is depreciated
31+
_xprime = c*np.matmul(R,_x) + np.outer(T, np.array([1]*len(X)))
3132
xprime = np.array(_xprime.transpose()) # convert to length 3 numpy array
3233
else:
3334
xprime = np.array([])

0 commit comments

Comments
 (0)