forked from pool/python-python-sofa
- Add python-sofa-pr4-scipy1_6.patch gh#spatialaudio/python-sofa#4 - Switch to Github Source Archive for the example notebook to test with pytest --nbval - Skip python36 build: With NumPy 1.20, python36-numpy is no longer available in Tumbleweed (NEP 29) OBS-URL: https://build.opensuse.org/request/show/877789 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-python-sofa?expand=0&rev=7
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From 5b1cd60f886ec227bcdc34a2ffa560eb0ccbbb33 Mon Sep 17 00:00:00 2001
|
|
From: Ben Greiner <code@bnavigator.de>
|
|
Date: Mon, 8 Mar 2021 17:52:21 +0100
|
|
Subject: [PATCH] scipy.spatial.transform.Rotation.from_dcm has been renamed to
|
|
.from_matrix
|
|
|
|
---
|
|
src/sofa/spatial/coordinates.py | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/sofa/spatial/coordinates.py b/src/sofa/spatial/coordinates.py
|
|
index 7d08ab0..c41d2d3 100644
|
|
--- a/src/sofa/spatial/coordinates.py
|
|
+++ b/src/sofa/spatial/coordinates.py
|
|
@@ -22,7 +22,15 @@
|
|
import numpy as np
|
|
|
|
# for coordinate transformations
|
|
-from scipy.spatial.transform import Rotation ## requires scipy 1.2.0
|
|
+from scipy.spatial.transform import Rotation
|
|
+
|
|
+
|
|
+try:
|
|
+ # SciPy >=1.4
|
|
+ R_from_matrix = Rotation.from_matrix
|
|
+except AttributeError:
|
|
+ # SciPy >=1.2, < 1.6
|
|
+ R_from_matrix = Rotation.from_dcm
|
|
|
|
|
|
def sph2cart(alpha, beta, r):
|
|
@@ -107,7 +115,7 @@ def _rotation_from_view_up(view, up):
|
|
view = np.repeat(view, ulen, axis=0)
|
|
up = np.repeat(up, vlen, axis=0)
|
|
y_axis = np.cross(up, view)
|
|
- return Rotation.from_dcm(np.moveaxis(np.asarray([view, y_axis, up]), 0, -1))
|
|
+ return R_from_matrix(np.moveaxis(np.asarray([view, y_axis, up]), 0, -1))
|
|
|
|
|
|
def _get_object_transform(ref_object):
|