Hello community,

here is the log from the commit of package python-python-sofa for 
openSUSE:Factory checked in at 2020-02-03 11:13:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-sofa (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-sofa.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-sofa"

Mon Feb  3 11:13:12 2020 rev:2 rq:768810 version:0.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-python-sofa/python-python-sofa.changes    
2019-07-26 12:43:41.601821669 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-python-sofa.new.26092/python-python-sofa.changes
 2020-02-03 11:13:16.665843702 +0100
@@ -1,0 +2,6 @@
+Thu Jan 30 15:24:40 UTC 2020 - Todd R <toddrme2...@gmail.com>
+
+- Update to 0.1.1
+  * Fixed issues in array accessing and coordinate system conversion.
+
+-------------------------------------------------------------------

Old:
----
  python-sofa-0.1.0.tar.gz

New:
----
  python-sofa-0.1.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-sofa.spec ++++++
--- /var/tmp/diff_new_pack.kY5Pys/_old  2020-02-03 11:13:18.033844393 +0100
+++ /var/tmp/diff_new_pack.kY5Pys/_new  2020-02-03 11:13:18.037844396 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-python-sofa
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,21 +12,22 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-python-sofa
-Version:        0.1.0
+Version:        0.1.1
 Release:        0
-License:        MIT
 Summary:        Spatially Oriented Format for Acoustics (SOFA) API for Python
-Url:            http://github.com/spatialaudio/python-sofa/
+License:        MIT
 Group:          Development/Languages/Python
+URL:            https://github.com/spatialaudio/python-sofa/
 Source:         
https://files.pythonhosted.org/packages/source/p/python-sofa/python-sofa-%{version}.tar.gz
-BuildRequires:  python-rpm-macros
 BuildRequires:  %{python_module devel}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  python-rpm-macros
 # SECTION test requirements
 BuildRequires:  %{python_module netCDF4}
 BuildRequires:  %{python_module numpy}

++++++ python-sofa-0.1.0.tar.gz -> python-sofa-0.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/PKG-INFO 
new/python-sofa-0.1.1/PKG-INFO
--- old/python-sofa-0.1.0/PKG-INFO      2019-07-03 08:54:21.000000000 +0200
+++ new/python-sofa-0.1.1/PKG-INFO      2020-01-23 12:50:21.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: python-sofa
-Version: 0.1.0
+Version: 0.1.1
 Summary: Python SOFA API
 Home-page: http://github.com/spatialaudio/python-sofa/
 Author: Jannika Lossner
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/src/python_sofa.egg-info/PKG-INFO 
new/python-sofa-0.1.1/src/python_sofa.egg-info/PKG-INFO
--- old/python-sofa-0.1.0/src/python_sofa.egg-info/PKG-INFO     2019-07-03 
08:54:21.000000000 +0200
+++ new/python-sofa-0.1.1/src/python_sofa.egg-info/PKG-INFO     2020-01-23 
12:50:21.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: python-sofa
-Version: 0.1.0
+Version: 0.1.1
 Summary: Python SOFA API
 Home-page: http://github.com/spatialaudio/python-sofa/
 Author: Jannika Lossner
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/src/sofa/__init__.py 
new/python-sofa-0.1.1/src/sofa/__init__.py
--- old/python-sofa-0.1.0/src/sofa/__init__.py  2019-05-14 13:02:10.000000000 
+0200
+++ new/python-sofa-0.1.1/src/sofa/__init__.py  2019-07-09 10:47:44.000000000 
+0200
@@ -20,7 +20,7 @@
 
 """Python SOFA API for reading, writing and creating .sofa files.
 """
-__version__ = "0.1.0"
+__version__ = "0.1.1"
 
 __all__=["access", "conventions", "datatypes", "roomtypes", "spatial", 
"Database"]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/src/sofa/access.py 
new/python-sofa-0.1.1/src/sofa/access.py
--- old/python-sofa-0.1.0/src/sofa/access.py    2019-07-02 14:34:05.000000000 
+0200
+++ new/python-sofa-0.1.1/src/sofa/access.py    2019-08-14 14:37:41.000000000 
+0200
@@ -26,17 +26,25 @@
 
 import numpy as np
 
+def filled_if_masked(array):
+    if type(array) is np.ma.MaskedArray: return array.filled()
+    return array
+
+def is_integer(val):
+    return np.issubdtype(type(val), np.integer)
+
 def get_slice_tuple(dimensions, indices=None):
     if indices == None: return tuple([slice(None) for x in dimensions])
     if "M" in indices and "I" in dimensions:
-        indices["I"] = 0 if type(indices["M"]) == int else slice(None)
+        indices["I"] = 0 if is_integer(indices["M"]) else slice(None)
     return tuple([slice(None) if x not in indices else indices[x] for x in 
dimensions])
 
 def get_default_dimension_order(dimensions, indices=None):
     if indices == None: return dimensions
     if "M" in indices and "I" in dimensions:
-        indices["I"] = 0 if type(indices["M"]) == int else slice(None)
-    return tuple([x for x in dimensions if x not in indices or 
type(indices[x]) != int])
+        indices["I"] = 0 if is_integer(indices["M"]) else slice(None)
+    dim_order = tuple([x for x in dimensions if x not in indices or not 
is_integer(indices[x])])
+    return dim_order
 
 def get_dimension_order_transposition(original, new):
     old = original
@@ -69,13 +77,13 @@
         Requested array range in regular or desired dimension order, if 
provided
     """
     sls = get_slice_tuple(dimensions, indices)
-    if dim_order == None: return array[sls]
+    if dim_order == None: return filled_if_masked(array[sls])
 
     old_dim_order = get_default_dimension_order(dimensions, indices)
     transposition = get_dimension_order_transposition(old_dim_order, dim_order)
 
-    try: return np.transpose(array[sls], transposition)
-    except: raise Exception("dimension mismatch: cannot transpose from {0} to 
{1} in order {2}".format(old_dim_order, dim_order, do))
+    try: return filled_if_masked(np.transpose(array[sls], transposition))
+    except Exception as e: raise Exception("dimension mismatch: cannot 
transpose from {0} to {1} in order {2}, error {3}".format(old_dim_order, 
dim_order, transposition, e))
     return transposed
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-sofa-0.1.0/src/sofa/conventions/MultiSpeakerBRIR.py 
new/python-sofa-0.1.1/src/sofa/conventions/MultiSpeakerBRIR.py
--- old/python-sofa-0.1.0/src/sofa/conventions/MultiSpeakerBRIR.py      
2019-05-14 11:21:16.000000000 +0200
+++ new/python-sofa-0.1.1/src/sofa/conventions/MultiSpeakerBRIR.py      
2019-07-09 10:46:50.000000000 +0200
@@ -37,7 +37,7 @@
 
         self.conditions["must have 2 Receivers"] = lambda name, info_states, 
count: name != "Receiver" or count == 2
         self.conditions["must have Listener Up and View)"] = lambda name, 
info_states, count: name != "Listener" or (not 
spatial.Coordinates.State.is_used(info_states.Up))
-        self.conditions["must have both Emitter View and Up or neither"] = 
lambda name, info_states, count: name != "Emitter" or 
(spatial.Coordinates.State.is_used(info_states.View) == 
data.spatial.Coordinates.State.is_used(info_states.Up))
+        self.conditions["must have both Emitter View and Up or neither"] = 
lambda name, info_states, count: name != "Emitter" or 
(spatial.Coordinates.State.is_used(info_states.View) == 
spatial.Coordinates.State.is_used(info_states.Up))
 
     def add_metadata(self, dataset):
         _Base.add_general_defaults(dataset)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/src/sofa/conventions/__init__.py 
new/python-sofa-0.1.1/src/sofa/conventions/__init__.py
--- old/python-sofa-0.1.0/src/sofa/conventions/__init__.py      2019-05-14 
13:43:17.000000000 +0200
+++ new/python-sofa-0.1.1/src/sofa/conventions/__init__.py      2019-07-09 
10:48:02.000000000 +0200
@@ -20,7 +20,7 @@
 
 """
 """
-__version__ = "0.1.0"
+__version__ = "0.1.1"
 
 __all__=["implemented"]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-sofa-0.1.0/src/sofa/spatial.py 
new/python-sofa-0.1.1/src/sofa/spatial.py
--- old/python-sofa-0.1.0/src/sofa/spatial.py   2019-07-02 15:20:33.000000000 
+0200
+++ new/python-sofa-0.1.1/src/sofa/spatial.py   2019-09-20 11:08:30.000000000 
+0200
@@ -52,6 +52,8 @@
     z : float or `numpy.ndarray`
         z-component of Cartesian coordinates
     """
+    r = np.where(r != 0, r, 1) # compensate missing radius entries in various 
databases
+
     x = r * np.cos(alpha) * np.sin(beta)
     y = r * np.sin(alpha) * np.sin(beta)
     z = r * np.cos(beta)
@@ -83,13 +85,13 @@
     """
     r = np.sqrt(x**2 + y**2 + z**2)
     alpha = np.arctan2(y, x)
-    beta = np.arccos(z / r)
+    beta = np.arccos(z / np.where(r != 0, r, 1))
     return alpha, beta, r
 
 def transform(u, rot, x0, invert):
     if not invert: u-=x0
     t = rot.apply(u, inverse=invert)
-    if invert: t+=x0
+    if invert: t = t + x0
     return t
 
 class Coordinates(access.ArrayVariable):
@@ -128,13 +130,14 @@
             if old_units == None: raise Exception("missing original unit for 
unit conversion")
 
             conversion = np.ones_like(coords)
+            indices = access.get_slice_tuple(dimensions, {"C":slice(2)})
             
             if (old_units in Coordinates.System.Units.Degree and new_units in 
Coordinates.System.Units.Degree) or (old_units in 
Coordinates.System.Units.Radians and new_units in 
Coordinates.System.Units.Radians):
                 return coords
             elif old_units in Coordinates.System.Units.Degree and new_units in 
Coordinates.System.Units.Radians: 
-                conversion[access.get_slice_tuple(dimensions, {"C":slice(2)})] 
= np.pi/180
+                conversion[indices] = np.pi/180
             elif old_units in Coordinates.System.Units.Radians and new_units 
in Coordinates.System.Units.Degree: 
-                conversion[access.get_slice_tuple(dimensions, {"C":slice(2)})] 
= 180/np.pi
+                conversion[indices] = 180/np.pi
             else: raise Exception("invalid angle unit in conversion from {0} 
to {1}".format(old_units, new_units))
 
             return np.multiply(coords, conversion)
@@ -304,7 +307,7 @@
 
         # get rotation of ref_object
         order = ("M","C")
-        r_pos, r_view, r_up = ref_object.get_pose(indices, order, 
Coordinates.System.Cartesian, angle_unit)
+        r_pos, r_view, r_up = ref_object.get_pose(indices, order, 
Coordinates.System.Cartesian, "rad")
         if len(r_view)!=len(r_up):
             vlen = len(r_view)
             ulen = len(r_up)
@@ -320,7 +323,8 @@
         transformed_values = None
 
         if ldim != None:
-            transformed_values = np.empty(untransformed_values.shape)
+            shape = 
tuple(np.max(np.asarray([np.asarray(untransformed_values.shape)[1:], 
np.asarray(r_pos.shape), np.asarray(r_view.shape), np.asarray(r_up.shape)]), 
axis=0))
+            transformed_values = 
np.empty((untransformed_values.shape[0],)+shape)
             for c in np.arange(untransformed_values.shape[0]): 
transformed_values[c] = transform(untransformed_values[c], rotations, r_pos, 
invert)
         else: transformed_values = transform(untransformed_values, rotations, 
r_pos, invert)
 


Reply via email to