From scipy-svn at scipy.org Sat May 1 18:26:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 1 May 2010 17:26:34 -0500 (CDT) Subject: [Scipy-svn] r6365 - in trunk: doc/release doc/source scipy/linalg scipy/linalg/tests Message-ID: <20100501222634.96EB239CAEA@scipy.org> Author: warren.weckesser Date: 2010-05-01 17:26:34 -0500 (Sat, 01 May 2010) New Revision: 6365 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/linalg.rst trunk/scipy/linalg/info.py trunk/scipy/linalg/special_matrices.py trunk/scipy/linalg/tests/test_special_matrices.py Log: ENH: linalg: Added a function to create a Leslie matrix. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-04-30 16:38:37 UTC (rev 6364) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-01 22:26:34 UTC (rev 6365) @@ -108,8 +108,8 @@ New functions and other changes in scipy.linalg ----------------------------------------------- -The functions `circulant`, `hadamard` and `cho_solve_banded` were added -to `scipy.linalg`. +The functions `cho_solve_banded`, `circulant`, `hadamard` and `leslie` +were added to `scipy.linalg`. The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. Modified: trunk/doc/source/linalg.rst =================================================================== --- trunk/doc/source/linalg.rst 2010-04-30 16:38:37 UTC (rev 6364) +++ trunk/doc/source/linalg.rst 2010-05-01 22:26:34 UTC (rev 6365) @@ -87,6 +87,7 @@ hadamard hankel kron + leslie toeplitz tri tril Modified: trunk/scipy/linalg/info.py =================================================================== --- trunk/scipy/linalg/info.py 2010-04-30 16:38:37 UTC (rev 6364) +++ trunk/scipy/linalg/info.py 2010-05-01 22:26:34 UTC (rev 6365) @@ -65,6 +65,7 @@ hadamard --- Hadamard matrix of order 2^n hankel --- Hankel matrix kron --- Kronecker product of two arrays. + leslie --- Leslie matrix toeplitz --- Toeplitz matrix tri --- Construct a matrix filled with ones at and below a given diagonal. tril --- Construct a lower-triangular matrix from a given matrix. Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-04-30 16:38:37 UTC (rev 6364) +++ trunk/scipy/linalg/special_matrices.py 2010-05-01 22:26:34 UTC (rev 6365) @@ -320,6 +320,54 @@ return H + +def leslie(f, s): + """Create a Leslie matrix. + + Parameters + ---------- + f : array-like, 1D + The "fecundity" coefficients. + s : array-like, 1D + The "survival" coefficients. The length of `s` must be one less + than the length of `f`, and it must be at least 1. + + Returns + ------- + L : ndarray, 2D + Returns a 2D numpy ndarray with shape `(n,n)`, where `n` is the + length of `f`. The array is zero except for the first row, + which is `f`, and the first subdiagonal, which is `s`. + The data type of the array will be the data type of `f[0]+s[0]`. + + Examples + -------- + >>> leslie([0.1, 2.0, 1.0, 0.1], [0.2, 0.8, 0.7]) + array([[ 0.1, 2. , 1. , 0.1], + [ 0.2, 0. , 0. , 0. ], + [ 0. , 0.8, 0. , 0. ], + [ 0. , 0. , 0.7, 0. ]]) + """ + f = np.atleast_1d(f) + s = np.atleast_1d(s) + if f.ndim != 1: + raise ValueError("Incorrect shape for f. f must be one-dimensional") + if s.ndim != 1: + raise ValueError("Incorrect shape for s. s must be one-dimensional") + if f.size != s.size + 1: + raise ValueError("Incorrect lengths for f and s. The length" + " of s must be one less than the length of f.") + if s.size == 0: + raise ValueError("The length of s must be at least 1.") + + tmp = f[0] + s[0] + n = f.size + a = np.zeros((n,n), dtype=tmp.dtype) + a[0] = f + a[range(1,n), range(0,n-1)] = s + return a + + def all_mat(*args): return map(np.matrix,args) Modified: trunk/scipy/linalg/tests/test_special_matrices.py =================================================================== --- trunk/scipy/linalg/tests/test_special_matrices.py 2010-04-30 16:38:37 UTC (rev 6364) +++ trunk/scipy/linalg/tests/test_special_matrices.py 2010-05-01 22:26:34 UTC (rev 6365) @@ -3,8 +3,8 @@ from numpy import arange, add, array, eye, all, copy from numpy.testing import * -from scipy.linalg import toeplitz, hankel, circulant, hadamard, tri, triu, tril, \ - kron, block_diag +from scipy.linalg import toeplitz, hankel, circulant, hadamard, leslie, \ + tri, triu, tril, kron, block_diag def get_mat(n): @@ -173,6 +173,23 @@ assert_raises(ValueError, hadamard, 5) +class TestLeslie(TestCase): + + def test_bad_shapes(self): + assert_raises(ValueError, leslie, [[1,1],[2,2]], [3,4,5]) + assert_raises(ValueError, leslie, [3,4,5], [[1,1],[2,2]]) + assert_raises(ValueError, leslie, [1,2], [1,2]) + assert_raises(ValueError, leslie, [1], []) + + def test_basic(self): + a = leslie([1, 2, 3], [0.25, 0.5]) + expected = array([ + [1.0, 2.0, 3.0], + [0.25, 0.0, 0.0], + [0.0, 0.5, 0.0]]) + assert_array_equal(a, expected) + + class TestBlockDiag: def test_basic(self): x = block_diag(eye(2), [[1,2], [3,4], [5,6]], [[1, 2, 3]]) From scipy-svn at scipy.org Sat May 1 22:20:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 1 May 2010 21:20:45 -0500 (CDT) Subject: [Scipy-svn] r6366 - trunk/scipy/signal Message-ID: <20100502022045.361AF39CAE9@scipy.org> Author: warren.weckesser Date: 2010-05-01 21:20:45 -0500 (Sat, 01 May 2010) New Revision: 6366 Modified: trunk/scipy/signal/ltisys.py Log: ENH: signal: Use a function to remove some repeated code in step(), impulse(), and impulse2(). Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-05-01 22:26:34 UTC (rev 6365) +++ trunk/scipy/signal/ltisys.py 2010-05-02 02:20:45 UTC (rev 6366) @@ -12,7 +12,7 @@ from filter_design import tf2zpk, zpk2tf, normalize import numpy -from numpy import product, zeros, array, dot, transpose, arange, ones, \ +from numpy import product, zeros, array, dot, transpose, ones, \ nan_to_num, zeros_like, linspace import scipy.interpolate as interpolate import scipy.integrate as integrate @@ -492,6 +492,36 @@ return T, squeeze(yout), squeeze(xout) +def _default_response_times(A, n): + """Compute a reasonable set of time samples for the response time. + + This function is used by impulse(), impulse2() and step() to compute + the response time when the `T` argument to the function is None. + + Parameters + ---------- + A : square ndarray + The system matrix. + n : int + The number of time samples to generate. + + Returns + ------- + t : ndarray, 1D + The 1D array of length `n` of time samples at which the response + is to be computed. + """ + # Create a reasonable time interval. This could use some more work. + # For example, what is expected when the system is unstable? + vals = linalg.eigvals(A) + r = min(abs(real(vals))) + if r == 0.0: + r = 1.0 + tc = 1.0 / r + t = linspace(0.0, 7*tc, n) + return t + + def impulse(system, X0=None, T=None, N=None): """Impulse response of continuous-time system. @@ -526,9 +556,7 @@ if N is None: N = 100 if T is None: - vals = linalg.eigvals(sys.A) - tc = 1.0/min(abs(real(vals))) - T = arange(0,7*tc,7*tc / float(N)) + T = _default_response_times(sys.A, N) h = zeros(T.shape, sys.A.dtype) s,v = linalg.eig(sys.A) vi = linalg.inv(v) @@ -599,14 +627,7 @@ if N is None: N = 100 if T is None: - # Create a reasonable time interval. This could use some more work. - # For example, what is expected when the system is unstable? - vals = linalg.eigvals(sys.A) - r = min(abs(real(vals))) - if r == 0.0: - r = 1.0 - tc = 1.0/r - T = arange(0, 7*tc, 7*tc / float(N)) + T = _default_response_times(sys.A, N) # Move the impulse in the input to the initial conditions, and then # solve using lsim2(). U = zeros_like(T) @@ -648,9 +669,7 @@ if N is None: N = 100 if T is None: - vals = linalg.eigvals(sys.A) - tc = 1.0/min(abs(real(vals))) - T = arange(0,7*tc,7*tc / float(N)) + T = _default_response_times(sys.A, N) U = ones(T.shape, sys.A.dtype) vals = lsim(sys, U, T, X0=X0) return vals[0], vals[1] From scipy-svn at scipy.org Sun May 2 19:19:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 May 2010 18:19:59 -0500 (CDT) Subject: [Scipy-svn] r6367 - in trunk: doc/release doc/source scipy/signal scipy/signal/tests Message-ID: <20100502231959.3557639C4B4@scipy.org> Author: warren.weckesser Date: 2010-05-02 18:19:59 -0500 (Sun, 02 May 2010) New Revision: 6367 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/signal.rst trunk/scipy/signal/info.py trunk/scipy/signal/ltisys.py trunk/scipy/signal/tests/test_ltisys.py Log: ENH: signal: Added the function step2 to compute the step response of a linear system using lsim2 (which used odeint). Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-02 02:20:45 UTC (rev 6366) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-02 23:19:59 UTC (rev 6367) @@ -85,9 +85,9 @@ Additions and modification to LTI functions (scipy.signal) ---------------------------------------------------------- -* The function `impulse2` was added to `scipy.signal`. It uses the ODE - solver `scipy.integrate.odeint` to compute the impulse response of - a system. +* The functions `impulse2` and `step2` were added to `scipy.signal`. + They use the function `scipy.signal.lsim2` to compute the impulse and + step response of a system, respectively. * The function `scipy.signal.lsim2` was changed to pass any additional keyword arguments to the ODE solver. Modified: trunk/doc/source/signal.rst =================================================================== --- trunk/doc/source/signal.rst 2010-05-02 02:20:45 UTC (rev 6366) +++ trunk/doc/source/signal.rst 2010-05-02 23:19:59 UTC (rev 6367) @@ -103,6 +103,7 @@ impulse impulse2 step + step2 LTI Reresentations ================== Modified: trunk/scipy/signal/info.py =================================================================== --- trunk/scipy/signal/info.py 2010-05-02 02:20:45 UTC (rev 6366) +++ trunk/scipy/signal/info.py 2010-05-02 23:19:59 UTC (rev 6367) @@ -70,8 +70,9 @@ lsim -- continuous-time simulation of output to linear system. lsim2 -- like lsim, but `scipy.integrate.odeint` is used. impulse -- impulse response of linear, time-invariant (LTI) system. - impulse2 -- like impulse2, but `scipy.integrate.odeint` is used. + impulse2 -- like impulse, but `scipy.integrate.odeint` is used. step -- step response of continous-time LTI system. + step2 -- like step, but `scipy.integrate.odeint` is used. LTI Reresentations: Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-05-02 02:20:45 UTC (rev 6366) +++ trunk/scipy/signal/ltisys.py 2010-05-02 23:19:59 UTC (rev 6367) @@ -495,8 +495,9 @@ def _default_response_times(A, n): """Compute a reasonable set of time samples for the response time. - This function is used by impulse(), impulse2() and step() to compute - the response time when the `T` argument to the function is None. + This function is used by impulse(), impulse2(), step() and step2() + to compute the response time when the `T` argument to the function + is None. Parameters ---------- @@ -595,7 +596,7 @@ **kwargs : Additional keyword arguments are passed on the function `scipy.signal.lsim2`, which in turn passes them on to - :func:`scipy.integrate.odeint`. See the documation for + :func:`scipy.integrate.odeint`. See the documentation for :func:`scipy.integrate.odeint` for information about these arguments. @@ -661,6 +662,9 @@ yout : 1D ndarray Step response of system. + See also + -------- + scipy.signal.step2 """ if isinstance(system, lti): sys = system @@ -673,3 +677,58 @@ U = ones(T.shape, sys.A.dtype) vals = lsim(sys, U, T, X0=X0) return vals[0], vals[1] + +def step2(system, X0=None, T=None, N=None, **kwargs): + """Step response of continuous-time system. + + This function is functionally the same as `scipy.signal.step`, but + it uses the function `scipy.ltisys.lsim2` to compute the step + response. + + Parameters + ---------- + system : an instance of the LTI class or a tuple describing the system. + The following gives the number of elements in the tuple and + the interpretation. + 2 (num, den) + 3 (zeros, poles, gain) + 4 (A, B, C, D) + X0 : array_like, optional + Initial state-vector (default is zero). + T : array_like, optional + Time points (computed if not given). + N : int + Number of time points to compute if `T` is not given. + **kwargs : + Additional keyword arguments are passed on the function + `scipy.signal.lsim2`, which in turn passes them on to + :func:`scipy.integrate.odeint`. See the documentation for + :func:`scipy.integrate.odeint` for information about these + arguments. + + Returns + ------- + T : 1D ndarray + Output time points. + yout : 1D ndarray + Step response of system. + + See also + -------- + scipy.signal.step + + Notes + ----- + .. versionadded:: 0.8.0 + """ + if isinstance(system, lti): + sys = system + else: + sys = lti(*system) + if N is None: + N = 100 + if T is None: + T = _default_response_times(sys.A, N) + U = ones(T.shape, sys.A.dtype) + vals = lsim2(sys, U, T, X0=X0, **kwargs) + return vals[0], vals[1] Modified: trunk/scipy/signal/tests/test_ltisys.py =================================================================== --- trunk/scipy/signal/tests/test_ltisys.py 2010-05-02 02:20:45 UTC (rev 6366) +++ trunk/scipy/signal/tests/test_ltisys.py 2010-05-02 23:19:59 UTC (rev 6367) @@ -1,8 +1,9 @@ import numpy as np from numpy.testing import assert_almost_equal, assert_equal, run_module_suite -from scipy.signal.ltisys import ss2tf, lsim2, impulse2, lti +from scipy.signal.ltisys import ss2tf, lsim2, impulse2, step2, lti + class TestSS2TF: def tst_matrix_shapes(self, p, q, r): ss2tf(np.zeros((p, p)), @@ -148,5 +149,65 @@ expected_y = tout * np.exp(-tout) assert_almost_equal(y, expected_y) +class Test_step2(object): + + def test_01(self): + # First order system: x'(t) + x(t) = u(t) + # Exact step response is x(t) = 1 - exp(-t). + system = ([1.0],[1.0,1.0]) + tout, y = step2(system) + expected_y = 1.0 - np.exp(-tout) + assert_almost_equal(y, expected_y) + + def test_02(self): + """Specify the desired time values for the output.""" + + # First order system: x'(t) + x(t) = u(t) + # Exact step response is x(t) = 1 - exp(-t). + system = ([1.0],[1.0,1.0]) + n = 21 + t = np.linspace(0, 2.0, n) + tout, y = step2(system, T=t) + assert_equal(tout.shape, (n,)) + assert_almost_equal(tout, t) + expected_y = 1 - np.exp(-t) + assert_almost_equal(y, expected_y) + + def test_03(self): + """Specify an initial condition as a scalar.""" + + # First order system: x'(t) + x(t) = u(t), x(0)=3.0 + # Exact step response is x(t) = 1 + 2*exp(-t). + system = ([1.0],[1.0,1.0]) + tout, y = step2(system, X0=3.0) + expected_y = 1 + 2.0*np.exp(-tout) + assert_almost_equal(y, expected_y) + + def test_04(self): + """Specify an initial condition as a list.""" + + # First order system: x'(t) + x(t) = u(t), x(0)=3.0 + # Exact step response is x(t) = 1 + 2*exp(-t). + system = ([1.0],[1.0,1.0]) + tout, y = step2(system, X0=[3.0]) + expected_y = 1 + 2.0*np.exp(-tout) + assert_almost_equal(y, expected_y) + + def test_05(self): + # Simple integrator: x'(t) = u(t) + # Exact step response is x(t) = t. + system = ([1.0],[1.0,0.0]) + tout, y = step2(system, atol=1e-10, rtol=1e-8) + expected_y = tout + assert_almost_equal(y, expected_y) + + def test_06(self): + # Second order system with a repeated root: x''(t) + 2*x(t) + x(t) = u(t) + # The exact step response is 1 - (1 + t)*exp(-t). + system = ([1.0], [1.0, 2.0, 1.0]) + tout, y = step2(system, atol=1e-10, rtol=1e-8) + expected_y = 1 - (1 + tout) * np.exp(-tout) + assert_almost_equal(y, expected_y) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sun May 2 19:29:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 2 May 2010 18:29:26 -0500 (CDT) Subject: [Scipy-svn] r6368 - trunk/scipy/signal Message-ID: <20100502232926.1595539C4B4@scipy.org> Author: warren.weckesser Date: 2010-05-02 18:29:25 -0500 (Sun, 02 May 2010) New Revision: 6368 Modified: trunk/scipy/signal/ltisys.py Log: Fix docstring. Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-05-02 23:19:59 UTC (rev 6367) +++ trunk/scipy/signal/ltisys.py 2010-05-02 23:29:25 UTC (rev 6368) @@ -682,7 +682,7 @@ """Step response of continuous-time system. This function is functionally the same as `scipy.signal.step`, but - it uses the function `scipy.ltisys.lsim2` to compute the step + it uses the function `scipy.signal.lsim2` to compute the step response. Parameters From scipy-svn at scipy.org Tue May 4 02:43:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 4 May 2010 01:43:01 -0500 (CDT) Subject: [Scipy-svn] r6369 - in trunk/scipy: io/matlab io/matlab/tests ndimage/src special Message-ID: <20100504064301.F08E739C4B4@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-04 01:43:01 -0500 (Tue, 04 May 2010) New Revision: 6369 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/matlab/tests/test_mio.py trunk/scipy/ndimage/src/ni_support.c trunk/scipy/special/basic.py Log: BF - fixed transpose of string arrays; writing of different length strings in string arrays Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-05-02 23:29:25 UTC (rev 6368) +++ trunk/scipy/io/matlab/mio5.py 2010-05-04 06:43:01 UTC (rev 6369) @@ -52,7 +52,7 @@ associated ``__function_workspace__`` matrix saved as well for the anonymous function to work correctly. * appending to a mat file that has a ``__function_workspace__`` would - invoLve first pulling off this workspace, appending, checking whether + involve first pulling off this workspace, appending, checking whether there were any more anonymous functions appended, and then somehow merging the relevant workspaces, and saving at the end of the mat file. @@ -559,11 +559,12 @@ tag = np.zeros((), mdtypes_template['tag_full']) tag['mdtype'] = mdtype tag['byte_count'] = byte_count - padding = (8 - tag['byte_count']) % 8 self.write_bytes(tag) self.write_bytes(arr) # pad to next 64-bit boundary - self.write_bytes(np.zeros((padding,),'u1')) + bc_mod_8 = byte_count % 8 + if bc_mod_8: + self.file_stream.write('\x00' * (8-bc_mod_8)) def write_header(self, shape, @@ -668,7 +669,7 @@ codec='UTF8' else: codec = 'ascii' - self.write_char(narr, codec) + self.write_char(narr, codec) else: self.write_numeric(narr) self.update_matrix_tag(mat_tag_pos) @@ -693,6 +694,8 @@ self.write_element(arr) def write_char(self, arr, codec='ascii'): + ''' Write string array `arr` with given `codec` + ''' if arr.size == 0 or np.all(arr == ''): # This an empty string array or a string array containing # only empty strings. Matlab cannot distiguish between a @@ -707,26 +710,29 @@ self.write_header(shape, mxCHAR_CLASS) self.write_smalldata_element(arr, miUTF8, 0) return - # non-empty string + # non-empty string. + # + # Convert to char array arr = arr_to_chars(arr) # We have to write the shape directly, because we are going # recode the characters, and the resulting stream of chars # may have a different length shape = arr.shape self.write_header(shape, mxCHAR_CLASS) - # We need to do our own transpose (not using the normal - # write routines that do this for us), and copy to make a nice C - # ordered thing - arr = arr.T.copy() if arr.dtype.kind == 'U' and arr.size: - # Recode unicode using self.codec + # Make one long string from all the characters. We need to + # transpose here, because we're flattening the array, before + # we write the bytes. The bytes have to be written in + # Fortran order. n_chars = np.product(shape) st_arr = np.ndarray(shape=(), dtype=arr_dtype_number(arr, n_chars), - buffer=arr) + buffer=arr.T.copy()) # Fortran order + # Recode with codec to give byte string st = st_arr.item().encode(codec) + # Reconstruct as one-dimensional byte array arr = np.ndarray(shape=(len(st),), - dtype='u1', + dtype='S1', buffer=st) self.write_element(arr, mdtype=miUTF8) Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-02 23:29:25 UTC (rev 6368) +++ trunk/scipy/io/matlab/miobase.py 2010-05-04 06:43:01 UTC (rev 6369) @@ -389,8 +389,12 @@ if not dims: dims = [1] dims.append(int(arr.dtype.str[2:])) - return np.ndarray(shape=dims, - dtype=arr_dtype_number(arr, 1), - buffer=arr) - - + arr = np.ndarray(shape=dims, + dtype=arr_dtype_number(arr, 1), + buffer=arr) + empties = [arr == ''] + if not np.any(empties): + return arr + arr = arr.copy() + arr[empties] = ' ' + return arr Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-02 23:29:25 UTC (rev 6368) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-04 06:43:01 UTC (rev 6369) @@ -736,3 +736,30 @@ squeeze_me=True, ) + +def test_str_round(): + # from report by Angus McMorland on mailing list 3 May 2010 + stream = StringIO() + in_arr = np.array(['Hello', 'Foob']) + out_arr = np.array(['Hello', 'Foob ']) + savemat(stream, dict(a=in_arr)) + res = loadmat(stream) + # resulted in [u'HloolFoa', u'elWrdobr'] + yield assert_array_equal, res['a'], out_arr + stream.truncate(0) + # Make Fortran ordered version of string + in_str = in_arr.tostring(order='F') + in_from_str = np.ndarray(shape=a.shape, + dtype=in_arr.dtype, + order='F', + buffer=in_str) + savemat(stream, dict(a=in_from_str)) + yield assert_array_equal, res['a'], out_arr + # unicode save did lead to buffer too small error + stream.truncate(0) + in_arr_u = in_arr.astype('U') + out_arr_u = out_arr.astype('U') + savemat(stream, {'a': in_arr_u}) + res = loadmat(stream) + yield assert_array_equal, res['a'], out_arr_u + Modified: trunk/scipy/ndimage/src/ni_support.c =================================================================== --- trunk/scipy/ndimage/src/ni_support.c 2010-05-02 23:29:25 UTC (rev 6368) +++ trunk/scipy/ndimage/src/ni_support.c 2010-05-04 06:43:01 UTC (rev 6369) @@ -168,6 +168,8 @@ switch (mode) { case NI_EXTEND_WRAP: + /* deal with situation where data is shorter than needed + for filling the line */ nextend = size1 / length; rextend = size1 - nextend * length; l1 = line + size1 + length - rextend; Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2010-05-02 23:29:25 UTC (rev 6368) +++ trunk/scipy/special/basic.py 2010-05-04 06:43:01 UTC (rev 6369) @@ -330,26 +330,38 @@ def _sph_harmonic(m,n,theta,phi): """Compute spherical harmonics. - This is a ufunc and may take scalar or array arguments like any other ufunc. - The inputs will be broadcasted against each other. + This is a ufunc and may take scalar or array arguments like any + other ufunc. The inputs will be broadcasted against each other. - :Parameters: - - `m` : int |m| <= n - The order of the harmonic. - - `n` : int >= 0 - The degree of the harmonic. - - `theta` : float [0, 2*pi] - The azimuthal (longitudinal) coordinate. - - `phi` : float [0, pi] - The polar (colatitudinal) coordinate. + Parameters + ---------- + m : int + |m| <= n; the order of the harmonic. + n : int + where `n` >= 0; the degree of the harmonic. This is often called + ``l`` (lower case L) in descriptions of spherical harmonics. + theta : float + [0, 2*pi]; the azimuthal (longitudinal) coordinate. + phi : float + [0, pi]; the polar (colatitudinal) coordinate. - :Returns: - - `y_mn` : complex float - The harmonic $Y^m_n$ sampled at `theta` and `phi`. + Returns + ------- + y_mn : complex float + The harmonic $Y^m_n$ sampled at `theta` and `phi` + + Notes + ----- + There are different conventions for the meaning of input arguments + `theta` and `phi`. We take `theta` to be the azimuthal angle and + `phi` to be the polar angle. It is common to see the opposite + convention - that is `theta` as the polar angle and `phi` as the + azimuthal angle. """ x = cos(phi) m,n = int(m), int(n) - Pmn,Pmnd = lpmn(m,n,x) + Pmn,Pmn_deriv = lpmn(m,n,x) + # Legendre call generates all orders up to m and degrees up to n val = Pmn[-1, -1] val *= sqrt((2*n+1)/4.0/pi) val *= exp(0.5*(gammaln(n-m+1)-gammaln(n+m+1))) @@ -484,6 +496,24 @@ all orders from 0..m and degrees from 0..n. z can be complex. + + Parameters + ---------- + m : int + |m| <= n; the order of the Legendre function + n : int + where `n` >= 0; the degree of the Legendre function. Often + called ``l`` (lower case L) in descriptions of the associated + Legendre function + z : float or complex + input value + + Returns + ------- + Pmn_z : (m+1, n+1) array + Values for all orders 0..m and degrees 0..n + Pmn_d_z : (m+1, n+1) array + Derivatives for all orders 0..m and degrees 0..n """ if not isscalar(m) or (abs(m)>n): raise ValueError, "m must be <= n." From scipy-svn at scipy.org Sat May 8 04:42:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:42:59 -0500 (CDT) Subject: [Scipy-svn] r6370 - trunk/scipy/ndimage Message-ID: <20100508084259.55E6D39CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:42:59 -0500 (Sat, 08 May 2010) New Revision: 6370 Modified: trunk/scipy/ndimage/doccer.py Log: Add exception handling to docformat for very short or empty strings. Modified: trunk/scipy/ndimage/doccer.py =================================================================== --- trunk/scipy/ndimage/doccer.py 2010-05-04 06:43:01 UTC (rev 6369) +++ trunk/scipy/ndimage/doccer.py 2010-05-08 08:42:59 UTC (rev 6370) @@ -52,10 +52,13 @@ indented = {} for name, dstr in docdict.items(): lines = dstr.expandtabs().splitlines() - newlines = [lines[0]] - for line in lines[1:]: - newlines.append(indent+line) - indented[name] = '\n'.join(newlines) + try: + newlines = [lines[0]] + for line in lines[1:]: + newlines.append(indent+line) + indented[name] = '\n'.join(newlines) + except IndexError: + indented[name] = dstr return docstring % indented From scipy-svn at scipy.org Sat May 8 04:43:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:43:14 -0500 (CDT) Subject: [Scipy-svn] r6371 - trunk/scipy/stats Message-ID: <20100508084314.29A1039CAF3@scipy.org> Author: rgommers Date: 2010-05-08 03:43:14 -0500 (Sat, 08 May 2010) New Revision: 6371 Modified: trunk/scipy/stats/distributions.py Log: ENH: New docstring generation machinery for continuous distributions. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:42:59 UTC (rev 6370) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:43:14 UTC (rev 6371) @@ -62,11 +62,156 @@ import types import stats as st +from scipy.ndimage import doccer all = alltrue sgf = vectorize import new + +## These are the docstring parts used for substitution in specific +## distribution docstrings. + +docheaders = {'methods':"""\nMethods\n-------\n""", + 'parameters':"""\nParameters\n---------\n""", + 'examples':"""\nExamples\n--------\n"""} + +_doc_rvs = \ +"""rvs(%(shapes)s, loc=0, scale=1, size=1) + Random variates. +""" +_doc_pdf = \ +"""pdf(x, %(shapes)s, loc=0, scale=1) + Probability density function. +""" +_doc_cdf = \ +"""cdf(x, %(shapes)s, loc=0, scale=1) + Cumulative density function. +""" +_doc_sf = \ +"""sf(x, %(shapes)s, loc=0, scale=1) + Survival function (1-cdf --- sometimes more accurate). +""" +_doc_ppf = \ +"""ppf(q, %(shapes)s, loc=0, scale=1) + Percent point function (inverse of cdf --- percentiles). +""" +_doc_isf = \ +"""isf(q, %(shapes)s, loc=0, scale=1) + Inverse survival function (inverse of sf). +""" +_doc_stats = \ +"""stats(%(shapes)s, loc=0, scale=1, moments='mv') + Mean('m'), variance('v'), skew('s'), and/or kurtosis('k'). +""" +_doc_entropy = \ +"""entropy(%(shapes)s, loc=0, scale=1) + (Differential) entropy of the RV. +""" +_doc_fit = \ +"""fit(data, %(shapes)s, loc=0, scale=1) + Parameter estimates for generic data. +""" +_doc_allmethods = ''.join([docheaders['methods'], _doc_rvs, _doc_pdf, _doc_cdf, + _doc_sf, _doc_ppf, _doc_isf, _doc_stats, + _doc_entropy, _doc_fit]) + +_doc_default_callparams = \ +""" +Parameters +---------- +x : array-like + quantiles +q : array-like + lower or upper tail probability +%(shapes)s : array-like + shape parameters +loc : array-like, optional + location parameter (default=0) +scale : array-like, optional + scale parameter (default=1) +size : int or tuple of ints, optional + shape of random variates (default computed from input arguments ) +moments : str, optional + composed of letters ['mvsk'] specifying which moments to compute where + 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and + 'k' = (Fisher's) kurtosis. (default='mv') +""" +_doc_default_longsummary = \ +"""Continuous random variables are defined from a standard form and may +require some shape parameters to complete its specification. Any +optional keyword parameters can be passed to the methods of the RV +object as given below: +""" +_doc_default_frozen_note = \ +""" +Alternatively, the object may be called (as a function) to fix the shape, +location, and scale parameters returning a "frozen" continuous RV object: + +rv = %(name)s(%(shapes)s, loc=0, scale=1) + - Frozen RV object with the same methods but holding the given shape, + location, and scale fixed. +""" +_doc_default_example = \ +""" +Examples +-------- +>>> import matplotlib.pyplot as plt +>>> numargs = %(name)s.numargs +>>> [ %(shapes)s ] = [0.9,] * numargs +>>> rv = %(name)s(%(shapes)s) + +Display frozen pdf + +>>> x = np.linspace(0, np.minimum(rv.dist.b, 3)) +>>> h = plt.plot(x, rv.pdf(x)) + +Check accuracy of cdf and ppf + +>>> prb = %(name)s.cdf(x, %(shapes)s) +>>> h = plt.semilogy(np.abs(x - %(name)s.ppf(prb, %(shapes)s)) + 1e-20) + +Random number generation + +>>> R = %(name)s.rvs(%(shapes)s, size=100) +""" + +_doc_default = ''.join([_doc_default_longsummary, _doc_allmethods, + _doc_default_callparams, _doc_default_frozen_note, + _doc_default_example]) + +_doc_default_before_pdf = ''.join([_doc_default_longsummary, + docheaders['methods'], _doc_rvs]) +_doc_default_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, + _doc_stats, _doc_entropy, _doc_fit, + _doc_default_callparams, + _doc_default_frozen_note, + _doc_default_example]) +docdict = {'rvs':_doc_rvs, + 'pdf':_doc_pdf, + 'cdf':_doc_cdf, + 'sf':_doc_sf, + 'ppf':_doc_ppf, + 'isf':_doc_isf, + 'stats':_doc_stats, + 'entropy':_doc_entropy, + 'fit':_doc_fit, + 'allmethods':_doc_allmethods, + 'callparams':_doc_default_callparams, + 'longsummary':_doc_default_longsummary, + 'frozennote':_doc_default_frozen_note, + 'example':_doc_default_example, + 'default':_doc_default, + 'before_pdf':_doc_default_before_pdf, + 'after_pdf':_doc_default_after_pdf} + +# clean up all the separate docstring elements, we do not need them anymore +for obj in [s for s in dir() if s.startswith('_doc_')]: + exec('del ' + obj) +del s, obj + + + def _build_random_array(fun, args, size=None): # Build an array by applying function fun to # the arguments in args, creating an array with @@ -350,90 +495,54 @@ class rv_continuous(rv_generic): - """ - A Generic continuous random variable. + """A generic continuous random variable class meant for subclassing. - Continuous random variables are defined from a standard form and may - require some shape parameters to complete its specification. Any - optional keyword parameters can be passed to the methods of the RV - object as given below: + `rv_continuous` is a base class to construct specific distribution classes + and instances from for continuous random variables. + Parameters + ---------- + momtype : + a : + b : + xa : + xb : + xtol : float, optional + The tolerance .... + badvalue : object, optional + The value in (masked) arrays that indicates a value that should be + ignored. + name : str, optional + The name of the instance. This string is used to construct the default + example for distributions. + longname : str, optional + This string is used as part of the first line of the docstring returned + when a subclass has no docstring of its own. Note: `longname` exists + for backwards compatibility, do not use for new subclasses. + shapes : str, optional + The shape of the distribution. For example ``"m, n"`` for a + distribution that takes two integers as the first two arguments for all + its methods. + extradoc : str, optional + This string is used as the last part of the docstring returned when a + subclass has no docstring of its own. Note: `extradoc` exists for + backwards compatibility, do not use for new subclasses. + Methods ------- - generic.rvs(,loc=0,scale=1,size=1) - - random variates + ... - generic.pdf(x,,loc=0,scale=1) - - probability density function - - generic.cdf(x,,loc=0,scale=1) - - cumulative density function - - generic.sf(x,,loc=0,scale=1) - - survival function (1-cdf --- sometimes more accurate) - - generic.ppf(q,,loc=0,scale=1) - - percent point function (inverse of cdf --- percentiles) - - generic.isf(q,,loc=0,scale=1) - - inverse survival function (inverse of sf) - - generic.stats(,loc=0,scale=1,moments='mv') - - mean('m'), variance('v'), skew('s'), and/or kurtosis('k') - - generic.entropy(,loc=0,scale=1) - - (differential) entropy of the RV. - - generic.fit(data,,loc=0,scale=1) - - Parameter estimates for generic data - - Alternatively, the object may be called (as a function) to fix the shape, - location, and scale parameters returning a "frozen" continuous RV object: - - rv = generic(,loc=0,scale=1) - - frozen RV object with the same methods but holding the given shape, location, and scale fixed - - Parameters - ---------- - x : array-like - quantiles - q : array-like - lower or upper tail probability - : array-like - shape parameters - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - size : int or tuple of ints, optional - shape of random variates (default computed from input arguments ) - moments : string, optional - composed of letters ['mvsk'] specifying which moments to compute where - 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and - 'k' = (Fisher's) kurtosis. (default='mv') - Examples -------- - >>> import matplotlib.pyplot as plt - >>> numargs = generic.numargs - >>> [ ] = [0.9,]*numargs - >>> rv = generic() + To create a new Gaussian distribution, we would do the following:: - Display frozen pdf + class gaussian_gen(rv_continuous): + "Gaussian distribution" + def _pdf: + ... + ... + """ - >>> x = np.linspace(0,np.minimum(rv.dist.b,3)) - >>> h=plt.plot(x,rv.pdf(x)) - - Check accuracy of cdf and ppf - - >>> prb = generic.cdf(x,) - >>> h=plt.semilogy(np.abs(x-generic.ppf(prb,))+1e-20) - - Random number generation - - >>> R = generic.rvs(,size=100) - - """ def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, xtol=1e-14, badvalue=None, name=None, longname=None, shapes=None, extradoc=None): @@ -486,21 +595,35 @@ if name[0] in ['aeiouAEIOU']: hstr = "An " else: hstr = "A " longname = hstr + name + + # generate docstring for subclass instances if self.__doc__ is None: - self.__doc__ = rv_continuous.__doc__ - if self.__doc__ is not None: - self.__doc__ = textwrap.dedent(self.__doc__) - if longname is not None: - self.__doc__ = self.__doc__.replace("A Generic",longname) - if name is not None: - self.__doc__ = self.__doc__.replace("generic",name) - if shapes is None: - self.__doc__ = self.__doc__.replace(",","") - else: - self.__doc__ = self.__doc__.replace("",shapes) - if extradoc is not None: - self.__doc__ += textwrap.dedent(extradoc) + self._construct_default_doc(longname=longname, extradoc=extradoc) + else: + self._construct_doc() + ## This only works for old-style classes... + # self.__class__.__doc__ = self.__doc__ + + def _construct_default_doc(self, longname=None, extradoc=None): + """Construct instance docstring from the default template.""" + self.__doc__ = ''.join(['%s continuous random variable.'%longname, + '\n\n%(default)s\n\n', + extradoc]) + self._construct_doc() + + def _construct_doc(self): + """Construct the instance docstring with string substitutions.""" + tempdict = docdict.copy() + tempdict['name'] = self.name or 'distname' + tempdict['shapes'] = self.shapes or '' + + for i in range(2): + if self.shapes is None: + # necessary because we use %(shapes)s in two forms (w w/o ", ") + self.__doc__ = self.__doc__.replace("%(shapes)s, ", "") + self.__doc__ = doccer.docformat(self.__doc__, tempdict) + def _ppf_to_solve(self, x, q,*args): return apply(self.cdf, (x, )+args)-q @@ -2849,7 +2972,7 @@ def _cdf(self, x, df): return special.stdtr(df, x) def _sf(self, x, df): - return special.stdtr(df, -x) + return special.stdtr(df, -x) def _ppf(self, q, df): return special.stdtrit(df, q) def _isf(self, q, df): @@ -4347,7 +4470,7 @@ def _argcheck(self, pr): return (pr >=0 ) & (pr <= 1) def _pmf(self, x, pr): - return binom_gen._pmf(self, x, 1, pr) + return binom_gen._pmf(self, x, 1, pr) def _cdf(self, x, pr): return binom_gen._cdf(self, x, 1, pr) def _sf(self, x, pr): @@ -4595,7 +4718,7 @@ vals = ceil(-1.0/lambda_ * log1p(-q)-1) vals1 = (vals-1).clip(self.a, np.inf) temp = self._cdf(vals1, lambda_) - return where(temp >= q, vals1, vals) + return where(temp >= q, vals1, vals) def _stats(self, lambda_): mu = 1/(exp(lambda_)-1) var = exp(-lambda_)/(expm1(-lambda_))**2 From scipy-svn at scipy.org Sat May 8 04:43:28 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:43:28 -0500 (CDT) Subject: [Scipy-svn] r6372 - trunk/scipy/stats Message-ID: <20100508084328.2CA0339CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:43:28 -0500 (Sat, 08 May 2010) New Revision: 6372 Modified: trunk/scipy/stats/distributions.py Log: ENH: Apply new doc machinery also to rv_discrete. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:43:14 UTC (rev 6371) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:43:28 UTC (rev 6372) @@ -205,6 +205,32 @@ 'before_pdf':_doc_default_before_pdf, 'after_pdf':_doc_default_after_pdf} +# Reuse common content between continous and discrete docs, change some minor +# bits. +docdict_discrete = docdict.copy() +docdict_discrete['longsummary'] = _doc_default_longsummary.replace(\ + 'Continuous', 'Discrete') +docdict_discrete['frozennote'] = _doc_default_frozen_note.replace('continuous', + 'discrete') +docdict_discrete['example'] = _doc_default_example.replace('[0.9,]', + 'Replace with reasonable value') + +_doc_default_disc = ''.join([docdict_discrete['longsummary'], + docdict_discrete['allmethods'], + docdict_discrete['frozennote'], + docdict_discrete['example']]) +docdict_discrete['default'] = _doc_default_disc + +_doc_default_before_pdf = ''.join([docdict_discrete['longsummary'], + docheaders['methods'], _doc_rvs]) +docdict_discrete['before_pdf'] = _doc_default_before_pdf +_doc_default_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, + _doc_stats, _doc_entropy, _doc_fit, + docdict_discrete['frozennote'], + docdict_discrete['example']]) +docdict_discrete['after_pdf'] = _doc_default_after_pdf + + # clean up all the separate docstring elements, we do not need them anymore for obj in [s for s in dir() if s.startswith('_doc_')]: exec('del ' + obj) @@ -581,8 +607,6 @@ self.vecentropy = sgf(self._entropy,otypes='d') self.vecentropy.nin = self.numargs + 1 self.veccdf = sgf(self._cdf_single_call,otypes='d') - self.veccdf.nin = self.numargs+1 - self.shapes = shapes self.extradoc = extradoc if momtype == 0: self.generic_moment = sgf(self._mom0_sc,otypes='d') @@ -3786,80 +3810,55 @@ # x_k, p(x_k) lists in initialization class rv_discrete(rv_generic): - """ - A Generic discrete random variable. + """A generic discrete random variable class meant for subclassing. - Discrete random variables are defined from a standard form and may require - some shape parameters to complete its specification. Any optional keyword - parameters can be passed to the methods of the RV object as given below: + `rv_discrete` is a base class to construct specific distribution classes + and instances from for discrete random variables. + Parameters + ---------- + momtype : + a : + b : + xa : + xb : + xtol : float, optional + The tolerance .... + badvalue : object, optional + The value in (masked) arrays that indicates a value that should be + ignored. + name : str, optional + The name of the instance. This string is used to construct the default + example for distributions. + longname : str, optional + This string is used as part of the first line of the docstring returned + when a subclass has no docstring of its own. Note: `longname` exists + for backwards compatibility, do not use for new subclasses. + shapes : str, optional + The shape of the distribution. For example ``"m, n"`` for a + distribution that takes two integers as the first two arguments for all + its methods. + extradoc : str, optional + This string is used as the last part of the docstring returned when a + subclass has no docstring of its own. Note: `extradoc` exists for + backwards compatibility, do not use for new subclasses. + Methods ------- - generic.rvs(,loc=0,size=1) - - random variates + ... - generic.pmf(x,,loc=0) - - probability mass function - - generic.cdf(x,,loc=0) - - cumulative density function - - generic.sf(x,,loc=0) - - survival function (1-cdf --- sometimes more accurate) - - generic.ppf(q,,loc=0) - - percent point function (inverse of cdf --- percentiles) - - generic.isf(q,,loc=0) - - inverse survival function (inverse of sf) - - generic.stats(,loc=0,moments='mv') - - mean('m',axis=0), variance('v'), skew('s'), and/or kurtosis('k') - - generic.entropy(,loc=0) - - entropy of the RV - - Alternatively, the object may be called (as a function) to fix - the shape and location parameters returning a - "frozen" discrete RV object: - - myrv = generic(,loc=0) - - frozen RV object with the same methods but holding the given shape and location fixed. - - You can construct an aribtrary discrete rv where P{X=xk} = pk - by passing to the rv_discrete initialization method (through the values= - keyword) a tuple of sequences (xk,pk) which describes only those values of - X (xk) that occur with nonzero probability (pk). - Examples -------- + To create a new Gaussian distribution, we would do the following:: - >>> import matplotlib.pyplot as plt - >>> numargs = generic.numargs - >>> [ ] = ['Replace with resonable value',]*numargs + class gaussian_gen(rv_continuous): + "Gaussian distribution" + def _pdf: + ... + ... - Display frozen pmf: + """ - >>> rv = generic() - >>> x = np.arange(0,np.min(rv.dist.b,3)+1) - >>> h = plt.plot(x,rv.pmf(x)) - - Check accuracy of cdf and ppf: - - >>> prb = generic.cdf(x,) - >>> h = plt.semilogy(np.abs(x-generic.ppf(prb,))+1e-20) - - Random number generation: - - >>> R = generic.rvs(,size=100) - - Custom made discrete distribution: - - >>> vals = [arange(7),(0.1,0.2,0.3,0.1,0.1,0.1,0.1)] - >>> custm = rv_discrete(name='custm',values=vals) - >>> h = plt.plot(vals[0],custm.pmf(vals[0])) - - """ def __init__(self, a=0, b=inf, name=None, badvalue=None, moment_tol=1e-8,values=None,inc=1,longname=None, shapes=None, extradoc=None): @@ -3926,31 +3925,38 @@ self._vecppf = new.instancemethod(_vppf, self, rv_discrete) - - #now that self.numargs is defined, we can adjust nin self._cdfvec.nin = self.numargs + 1 - if longname is None: - if name[0] in ['aeiouAEIOU']: hstr = "An " - else: hstr = "A " - longname = hstr + name + # generate docstring for subclass instances if self.__doc__ is None: - self.__doc__ = rv_discrete.__doc__ - if self.__doc__ is not None: - self.__doc__ = textwrap.dedent(self.__doc__) - self.__doc__ = self.__doc__.replace("A Generic",longname) - if name is not None: - self.__doc__ = self.__doc__.replace("generic",name) - if shapes is None: - self.__doc__ = self.__doc__.replace(",","") - else: - self.__doc__ = self.__doc__.replace("",shapes) - ind = self.__doc__.find("You can construct an arbitrary") - self.__doc__ = self.__doc__[:ind].strip() - if extradoc is not None: - self.__doc__ += textwrap.dedent(extradoc) + self._construct_default_doc(longname=longname, extradoc=extradoc) + else: + self._construct_doc() + ## This only works for old-style classes... + # self.__class__.__doc__ = self.__doc__ + + def _construct_default_doc(self, longname=None, extradoc=None): + """Construct instance docstring from the rv_discrete template.""" + self.__doc__ = ''.join(['%s discrete random variable.'%longname, + '\n\n%(default)s\n\n', + extradoc]) + self._construct_doc() + + def _construct_doc(self): + """Construct the instance docstring with string substitutions.""" + tempdict = docdict_discrete.copy() + tempdict['name'] = self.name or 'distname' + tempdict['shapes'] = self.shapes or '' + + for i in range(2): + if self.shapes is None: + # necessary because we use %(shapes)s in two forms (w w/o ", ") + self.__doc__ = self.__doc__.replace("%(shapes)s, ", "") + self.__doc__ = doccer.docformat(self.__doc__, tempdict) + + def _rvs(self, *args): return self._ppf(mtrand.random_sample(self._size),*args) From scipy-svn at scipy.org Sat May 8 04:43:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:43:42 -0500 (CDT) Subject: [Scipy-svn] r6373 - trunk/scipy/stats Message-ID: <20100508084342.25FF739CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:43:42 -0500 (Sat, 08 May 2010) New Revision: 6373 Modified: trunk/scipy/stats/distributions.py Log: DOC: Fix shapes parameter for all distributions. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:43:28 UTC (rev 6372) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:43:42 UTC (rev 6373) @@ -1343,7 +1343,7 @@ g2 = 6.0*(a**3 + a**2*(1-2*b) + b**2*(1+b) - 2*a*b*(2+b)) g2 /= a*b*(a+b+2)*(a+b+3) return mn, var, g1, g2 -beta = beta_gen(a=0.0, b=1.0, name='beta',shapes='a,b',extradoc=""" +beta = beta_gen(a=0.0, b=1.0, name='beta',shapes='a, b',extradoc=""" Beta distribution @@ -1377,7 +1377,7 @@ *(b-2.0)*(b-1.0)), inf) else: raise NotImplementedError -betaprime = betaprime_gen(a=0.0, b=500.0, name='betaprime', shapes='a,b', +betaprime = betaprime_gen(a=0.0, b=500.0, name='betaprime', shapes='a, b', extradoc=""" Beta prime distribution @@ -1457,7 +1457,7 @@ g2 -= 3*g1c**4 * g1cd**4 -4*gd**2*g3c*g1c*g1cd*g3cd return mu, mu2, g1, g2 burr = burr_gen(a=0.0, name='burr', longname="Burr", - shapes="c,d", extradoc=""" + shapes="c, d", extradoc=""" Burr distribution @@ -1734,7 +1734,7 @@ return (-log1p(-q**(1.0/a)))**arr(1.0/c) exponweib = exponweib_gen(a=0.0,name='exponweib', longname="An exponentiated Weibull", - shapes="a,c",extradoc=""" + shapes="a, c",extradoc=""" Exponentiated Weibull distribution @@ -1855,7 +1855,7 @@ g2 = 3/(2*v2-16)*(8+g1*g1*(v2-6)) g2 = where(v2 > 8, g2, nan) return mu, mu2, g1, g2 -f = f_gen(a=0.0,name='f',longname='An F',shapes="dfn,dfd", +f = f_gen(a=0.0,name='f',longname='An F',shapes="dfn, dfd", extradoc=""" F distribution @@ -2052,7 +2052,7 @@ return -expm1((-a-b)*x + b*(-expm1(-c*x))/c) genexpon = genexpon_gen(a=0.0,name='genexpon', longname='A generalized exponential', - shapes='a,b,c',extradoc=""" + shapes='a, b, c',extradoc=""" Generalized exponential distribution (Ryu 1993) @@ -2209,7 +2209,7 @@ return a*(1-val) + 1.0/c*val + special.gammaln(a)-log(abs(c)) gengamma = gengamma_gen(a=0.0, name='gengamma', longname='A generalized gamma', - shapes="a,c", extradoc=""" + shapes="a, c", extradoc=""" Generalized gamma distribution @@ -2440,7 +2440,7 @@ return fac*num / den gausshyper = gausshyper_gen(a=0.0, b=1.0, name='gausshyper', longname="A Gauss hypergeometric", - shapes="a,b,c,z", + shapes="a, b, c, z", extradoc=""" Gauss hypergeometric distribution @@ -2543,7 +2543,7 @@ return 1.0/(1+exp(-1.0/b*(norm.ppf(q)-a))) johnsonsb = johnsonsb_gen(a=0.0,b=1.0,name='johnsonb', longname="A Johnson SB", - shapes="a,b",extradoc=""" + shapes="a, b",extradoc=""" Johnson SB distribution @@ -2565,7 +2565,7 @@ def _ppf(self, q, a, b): return sinh((norm.ppf(q)-a)/b) johnsonsu = johnsonsu_gen(name='johnsonsu',longname="A Johnson SU", - shapes="a,b", extradoc=""" + shapes="a, b", extradoc=""" Johnson SU distribution @@ -2867,7 +2867,7 @@ qsk = pow(q,s*1.0/k) return pow(qsk/(1.0-qsk),1.0/s) mielke = mielke_gen(a=0.0, name='mielke', longname="A Mielke's Beta-Kappa", - shapes="k,s", extradoc=""" + shapes="k, s", extradoc=""" Mielke's Beta-Kappa distribution @@ -2923,7 +2923,7 @@ return df + nc, 2*val, sqrt(8)*(val+nc)/val**1.5, \ 12.0*(val+2*nc)/val**2.0 ncx2 = ncx2_gen(a=0.0, name='ncx2', longname="A non-central chi-squared", - shapes="df,nc", extradoc=""" + shapes="df, nc", extradoc=""" Non-central chi-squared distribution @@ -2966,7 +2966,7 @@ ((dfd-2.0)**2.0 * (dfd-4.0))) return mu, mu2, None, None ncf = ncf_gen(a=0.0, name='ncf', longname="A non-central F distribution", - shapes="dfn,dfd,nc", extradoc=""" + shapes="dfn, dfd, nc", extradoc=""" Non-central F distribution @@ -3071,7 +3071,7 @@ g2 = g2n / g2d return mu, mu2, g1, g2 nct = nct_gen(name="nct", longname="A Noncentral T", - shapes="df,nc", extradoc=""" + shapes="df, nc", extradoc=""" Non-central Student T distribution @@ -3193,7 +3193,7 @@ return exp(-s*norm.ppf(pow(1.0-q,1.0/c))) powerlognorm = powerlognorm_gen(a=0.0, name="powerlognorm", longname="A power log-normal", - shapes="c,s", extradoc=""" + shapes="c, s", extradoc=""" Power log-normal distribution @@ -3294,7 +3294,7 @@ return 0.5*log(a*b)+log(log(b/a)) reciprocal = reciprocal_gen(name="reciprocal", longname="A reciprocal", - shapes="a,b", extradoc=""" + shapes="a, b", extradoc=""" Reciprocal distribution @@ -3467,7 +3467,7 @@ mu2 = 1 + (a*pA - b*pB) / d - mu*mu return mu, mu2, None, None truncnorm = truncnorm_gen(name='truncnorm', longname="A truncated normal", - shapes="a,b", extradoc=""" + shapes="a, b", extradoc=""" Truncated Normal distribution. @@ -4457,7 +4457,7 @@ vals = self._pmf(k,n,pr) lvals = where(vals==0,0.0,log(vals)) return -sum(vals*lvals,axis=0) -binom = binom_gen(name='binom',shapes="n,pr",extradoc=""" +binom = binom_gen(name='binom',shapes="n, pr",extradoc=""" Binomial distribution @@ -4530,7 +4530,7 @@ g2 = (1.0 + 6*P*Q) / (n*P*Q) return mu, var, g1, g2 nbinom = nbinom_gen(name='nbinom', longname="A negative binomial", - shapes="n,pr", extradoc=""" + shapes="n, pr", extradoc=""" Negative binomial distribution @@ -4618,7 +4618,7 @@ lvals = where(vals==0.0,0.0,log(vals)) return -sum(vals*lvals,axis=0) hypergeom = hypergeom_gen(name='hypergeom',longname="A hypergeometric", - shapes="M,n,N", extradoc=""" + shapes="M, n, N", extradoc=""" Hypergeometric distribution @@ -4736,7 +4736,7 @@ C = (1-exp(-l)) return l*exp(-l)/C - log(C) planck = planck_gen(name='planck',longname='A discrete exponential ', - shapes="lambda_", + shapes="lamda", extradoc=""" Planck (Discrete Exponential) @@ -4773,7 +4773,7 @@ return mu, var, g1, g2 boltzmann = boltzmann_gen(name='boltzmann',longname='A truncated discrete exponential ', - shapes="lambda_,N", + shapes="lamda, N", extradoc=""" Boltzmann (Truncated Discrete Exponential) @@ -4822,7 +4822,7 @@ def _entropy(self, min, max): return log(max-min) randint = randint_gen(name='randint',longname='A discrete uniform '\ - '(random integer)', shapes="min,max", + '(random integer)', shapes="min, max", extradoc=""" Discrete Uniform From scipy-svn at scipy.org Sat May 8 04:43:55 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:43:55 -0500 (CDT) Subject: [Scipy-svn] r6374 - trunk/scipy/stats Message-ID: <20100508084355.DA87639CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:43:55 -0500 (Sat, 08 May 2010) New Revision: 6374 Modified: trunk/scipy/stats/distributions.py Log: DOC: Convert wald to new-style docstring. Add `shapes` attribute to rv_discrete. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:43:42 UTC (rev 6373) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:43:55 UTC (rev 6374) @@ -579,6 +579,7 @@ badvalue = nan self.badvalue = badvalue self.name = name + self.shapes = shapes self.a = a self.b = b if a is None: @@ -3587,6 +3588,14 @@ ## Wald distribution (Inverse Normal with shape parameter mu=1.0) class wald_gen(invnorm_gen): + """A Wald continuous random variable. + + %(before_pdf)s + pdf(x, loc=0, scale=1) + The probability density function, defined by + ``1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x))``, for ``x > 0``. + %(after_pdf)s + """ def _rvs(self): return invnorm_gen._rvs(self, 1.0) def _pdf(self, x): @@ -3595,16 +3604,9 @@ return invnorm.cdf(x,1,0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 -wald = wald_gen(a=0.0, name="wald", longname="A Wald", - extradoc=""" +wald = wald_gen(a=0.0, name="wald") -Wald distribution -wald.pdf(x) = 1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x)) -for x > 0. -""" - ) - ## Weibull ## See Frechet From scipy-svn at scipy.org Sat May 8 04:44:10 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:44:10 -0500 (CDT) Subject: [Scipy-svn] r6375 - trunk/scipy/stats Message-ID: <20100508084410.0AEA139CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:44:09 -0500 (Sat, 08 May 2010) New Revision: 6375 Modified: trunk/scipy/stats/distributions.py Log: DOC: Add Maxwell distribution docstring with extra info. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:43:55 UTC (rev 6374) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:44:09 UTC (rev 6375) @@ -187,6 +187,8 @@ _doc_default_callparams, _doc_default_frozen_note, _doc_default_example]) +_doc_methods_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, + _doc_stats, _doc_entropy, _doc_fit]) docdict = {'rvs':_doc_rvs, 'pdf':_doc_pdf, 'cdf':_doc_cdf, @@ -203,7 +205,8 @@ 'example':_doc_default_example, 'default':_doc_default, 'before_pdf':_doc_default_before_pdf, - 'after_pdf':_doc_default_after_pdf} + 'after_pdf':_doc_default_after_pdf, + 'afterpdf_methods':_doc_methods_after_pdf} # Reuse common content between continous and discrete docs, change some minor # bits. @@ -2829,10 +2832,32 @@ # MAXWELL -# a special case of chi with df = 3, loc=0.0, and given scale = 1.0/sqrt(a) -# where a is the parameter used in mathworld description class maxwell_gen(rv_continuous): + """A Maxwell continuous random variable. + + Methods + ------- + %(rvs)s + pdf(x, loc=0, scale=1) + Probability density function. Given by + :math:`\sqrt(2/\pi)x^2 exp(-x^2/2)` for ``x > 0``. + %(afterpdf_methods)s + %(callparams)s + %(frozennote)s + + Notes + ----- + A special case of a `chi` distribution, with ``df = 3``, ``loc = 0.0``, + and given ``scale = 1.0 / sqrt(a)``, where a is the parameter used in + the Mathworld description [1]_. + + References + ---------- + .. [1] http://mathworld.wolfram.com/MaxwellDistribution.html + + %(example)s + """ def _rvs(self): return chi.rvs(3.0,size=self._size) def _pdf(self, x): @@ -2847,16 +2872,9 @@ (-12*pi*pi + 160*pi - 384) / val**2.0 def _entropy(self): return _EULER + 0.5*log(2*pi)-0.5 -maxwell = maxwell_gen(a=0.0, name='maxwell', longname="A Maxwell", - extradoc=""" +maxwell = maxwell_gen(a=0.0, name='maxwell') -Maxwell distribution -maxwell.pdf(x) = sqrt(2/pi) * x**2 * exp(-x**2/2) -for x > 0. -""" - ) - # Mielke's Beta-Kappa class mielke_gen(rv_continuous): From scipy-svn at scipy.org Sat May 8 04:44:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:44:25 -0500 (CDT) Subject: [Scipy-svn] r6376 - trunk/scipy/stats Message-ID: <20100508084425.6C92539CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:44:25 -0500 (Sat, 08 May 2010) New Revision: 6376 Modified: trunk/scipy/stats/distributions.py Log: DOC: Add new-style docstring to nbinom. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:44:09 UTC (rev 6375) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:44:25 UTC (rev 6376) @@ -4522,6 +4522,14 @@ # Negative binomial class nbinom_gen(rv_discrete): + """A negative binomial discrete random variable. + + %(before_pdf)s + pmf(x, n, pr, loc=0, scale=1) + Probability mass function, given by + ``np.choose(k+n-1, n-1) * p**n * (1-p)**k`` for ``k >= 0``. + %(after_pdf)s + """ def _rvs(self, n, pr): return mtrand.negative_binomial(n, pr, self._size) def _argcheck(self, n, pr): @@ -4549,16 +4557,9 @@ g1 = (Q+P)/sqrt(n*P*Q) g2 = (1.0 + 6*P*Q) / (n*P*Q) return mu, var, g1, g2 -nbinom = nbinom_gen(name='nbinom', longname="A negative binomial", - shapes="n, pr", extradoc=""" +nbinom = nbinom_gen(name='nbinom', shapes="n, pr") -Negative binomial distribution -nbinom.pmf(k,n,p) = choose(k+n-1,n-1) * p**n * (1-p)**k -for k >= 0. -""" - ) - ## Geometric distribution class geom_gen(rv_discrete): From scipy-svn at scipy.org Sat May 8 04:44:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:44:39 -0500 (CDT) Subject: [Scipy-svn] r6377 - trunk/scipy/stats Message-ID: <20100508084439.E8D8039CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:44:39 -0500 (Sat, 08 May 2010) New Revision: 6377 Modified: trunk/scipy/stats/distributions.py Log: BUG: Fix a minor error, deleted a line by accident. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:44:25 UTC (rev 6376) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:44:39 UTC (rev 6377) @@ -582,7 +582,6 @@ badvalue = nan self.badvalue = badvalue self.name = name - self.shapes = shapes self.a = a self.b = b if a is None: @@ -611,6 +610,8 @@ self.vecentropy = sgf(self._entropy,otypes='d') self.vecentropy.nin = self.numargs + 1 self.veccdf = sgf(self._cdf_single_call,otypes='d') + self.veccdf.nin = self.numargs + 1 + self.shapes = shapes self.extradoc = extradoc if momtype == 0: self.generic_moment = sgf(self._mom0_sc,otypes='d') From scipy-svn at scipy.org Sat May 8 04:44:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:44:54 -0500 (CDT) Subject: [Scipy-svn] r6378 - trunk/scipy/stats Message-ID: <20100508084454.9B48239CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:44:54 -0500 (Sat, 08 May 2010) New Revision: 6378 Modified: trunk/scipy/stats/distributions.py Log: DOC: Remove scale parameter for discrete dists, and replace pdf with pmf. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:44:39 UTC (rev 6377) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:44:54 UTC (rev 6378) @@ -84,6 +84,10 @@ """pdf(x, %(shapes)s, loc=0, scale=1) Probability density function. """ +_doc_pmf = \ +"""pmf(x, %(shapes)s, loc=0, scale=1) + Probability mass function. +""" _doc_cdf = \ """cdf(x, %(shapes)s, loc=0, scale=1) Cumulative density function. @@ -211,10 +215,30 @@ # Reuse common content between continous and discrete docs, change some minor # bits. docdict_discrete = docdict.copy() + +docdict_discrete['pmf'] = _doc_pmf +_doc_disc_methods = ['rvs', 'pmf', 'cdf', 'sf', 'ppf', 'isf', 'stats', 'entropy', 'fit'] +for obj in _doc_disc_methods: + docdict_discrete[obj] = docdict_discrete[obj].replace(', scale=1', '') +docdict_discrete.pop('pdf') + +_doc_allmethods = ''.join([docdict_discrete[obj] for obj in + _doc_disc_methods]) +docdict_discrete['allmethods'] = docheaders['methods'] + _doc_allmethods + docdict_discrete['longsummary'] = _doc_default_longsummary.replace(\ 'Continuous', 'Discrete') -docdict_discrete['frozennote'] = _doc_default_frozen_note.replace('continuous', - 'discrete') +_doc_default_frozen_note = \ +""" +Alternatively, the object may be called (as a function) to fix the shape and +location parameters returning a "frozen" continuous RV object: + +rv = %(name)s(%(shapes)s, loc=0) + - Frozen RV object with the same methods but holding the given shape and + location fixed. +""" +docdict_discrete['frozennote'] = _doc_default_frozen_note + docdict_discrete['example'] = _doc_default_example.replace('[0.9,]', 'Replace with reasonable value') From scipy-svn at scipy.org Sat May 8 04:45:09 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:45:09 -0500 (CDT) Subject: [Scipy-svn] r6379 - trunk/scipy/stats Message-ID: <20100508084509.3C81F39CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:45:09 -0500 (Sat, 08 May 2010) New Revision: 6379 Modified: trunk/scipy/stats/distributions.py Log: DOC: Replace before_pdf and after_pdf with before_notes, move pdf-info to Notes. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:44:54 UTC (rev 6378) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:45:09 UTC (rev 6379) @@ -184,15 +184,10 @@ _doc_default_callparams, _doc_default_frozen_note, _doc_default_example]) -_doc_default_before_pdf = ''.join([_doc_default_longsummary, - docheaders['methods'], _doc_rvs]) -_doc_default_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, - _doc_stats, _doc_entropy, _doc_fit, - _doc_default_callparams, - _doc_default_frozen_note, - _doc_default_example]) -_doc_methods_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, - _doc_stats, _doc_entropy, _doc_fit]) +_doc_default_before_notes = ''.join([_doc_default_longsummary, _doc_allmethods, + _doc_default_callparams, + _doc_default_frozen_note]) + docdict = {'rvs':_doc_rvs, 'pdf':_doc_pdf, 'cdf':_doc_cdf, @@ -208,9 +203,7 @@ 'frozennote':_doc_default_frozen_note, 'example':_doc_default_example, 'default':_doc_default, - 'before_pdf':_doc_default_before_pdf, - 'after_pdf':_doc_default_after_pdf, - 'afterpdf_methods':_doc_methods_after_pdf} + 'before_notes':_doc_default_before_notes} # Reuse common content between continous and discrete docs, change some minor # bits. @@ -248,23 +241,13 @@ docdict_discrete['example']]) docdict_discrete['default'] = _doc_default_disc -_doc_default_before_pdf = ''.join([docdict_discrete['longsummary'], - docheaders['methods'], _doc_rvs]) -docdict_discrete['before_pdf'] = _doc_default_before_pdf -_doc_default_after_pdf = ''.join([_doc_cdf, _doc_sf, _doc_ppf, _doc_isf, - _doc_stats, _doc_entropy, _doc_fit, - docdict_discrete['frozennote'], - docdict_discrete['example']]) -docdict_discrete['after_pdf'] = _doc_default_after_pdf - # clean up all the separate docstring elements, we do not need them anymore for obj in [s for s in dir() if s.startswith('_doc_')]: exec('del ' + obj) del s, obj - def _build_random_array(fun, args, size=None): # Build an array by applying function fun to # the arguments in args, creating an array with @@ -2861,15 +2844,7 @@ class maxwell_gen(rv_continuous): """A Maxwell continuous random variable. - Methods - ------- - %(rvs)s - pdf(x, loc=0, scale=1) - Probability density function. Given by - :math:`\sqrt(2/\pi)x^2 exp(-x^2/2)` for ``x > 0``. - %(afterpdf_methods)s - %(callparams)s - %(frozennote)s + %(before_notes)s Notes ----- @@ -2877,6 +2852,9 @@ and given ``scale = 1.0 / sqrt(a)``, where a is the parameter used in the Mathworld description [1]_. + Probability density function. Given by :math:`\sqrt(2/\pi)x^2 exp(-x^2/2)` + for ``x > 0``. + References ---------- .. [1] http://mathworld.wolfram.com/MaxwellDistribution.html @@ -3633,11 +3611,14 @@ class wald_gen(invnorm_gen): """A Wald continuous random variable. - %(before_pdf)s - pdf(x, loc=0, scale=1) - The probability density function, defined by - ``1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x))``, for ``x > 0``. - %(after_pdf)s + %(before_notes)s + + Notes + ----- + The probability density function, `pdf`, is defined by + ``1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x))``, for ``x > 0``. + + %(example)s """ def _rvs(self): return invnorm_gen._rvs(self, 1.0) @@ -4549,11 +4530,14 @@ class nbinom_gen(rv_discrete): """A negative binomial discrete random variable. - %(before_pdf)s - pmf(x, n, pr, loc=0, scale=1) - Probability mass function, given by - ``np.choose(k+n-1, n-1) * p**n * (1-p)**k`` for ``k >= 0``. - %(after_pdf)s + %(before_notes)s + + Notes + ----- + Probability mass function, given by + ``np.choose(k+n-1, n-1) * p**n * (1-p)**k`` for ``k >= 0``. + + %(example)s """ def _rvs(self, n, pr): return mtrand.negative_binomial(n, pr, self._size) From scipy-svn at scipy.org Sat May 8 04:45:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:45:24 -0500 (CDT) Subject: [Scipy-svn] r6380 - trunk/scipy/stats Message-ID: <20100508084524.E8C6639CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:45:24 -0500 (Sat, 08 May 2010) New Revision: 6380 Modified: trunk/scipy/stats/distributions.py Log: DOC: Put back extradoc for now. Should disappear eventually. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:45:09 UTC (rev 6379) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:45:24 UTC (rev 6380) @@ -2875,9 +2875,16 @@ (-12*pi*pi + 160*pi - 384) / val**2.0 def _entropy(self): return _EULER + 0.5*log(2*pi)-0.5 -maxwell = maxwell_gen(a=0.0, name='maxwell') +maxwell = maxwell_gen(a=0.0, name='maxwell', extradoc=""" +Maxwell distribution +maxwell.pdf(x) = sqrt(2/pi) * x**2 * exp(-x**2/2) +for x > 0. +""" + ) + + # Mielke's Beta-Kappa class mielke_gen(rv_continuous): @@ -3628,9 +3635,17 @@ return invnorm.cdf(x,1,0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 -wald = wald_gen(a=0.0, name="wald") +wald = wald_gen(a=0.0, name="wald", extradoc=""" +Wald distribution +wald.pdf(x) = 1/sqrt(2*pi*x**3) * exp(-(x-1)**2/(2*x)) +for x > 0. +""" + ) + + + ## Weibull ## See Frechet @@ -4566,9 +4581,16 @@ g1 = (Q+P)/sqrt(n*P*Q) g2 = (1.0 + 6*P*Q) / (n*P*Q) return mu, var, g1, g2 -nbinom = nbinom_gen(name='nbinom', shapes="n, pr") +nbinom = nbinom_gen(name='nbinom', shapes="n, pr", extradoc=""" +Negative binomial distribution +nbinom.pmf(k,n,p) = choose(k+n-1,n-1) * p**n * (1-p)**k +for k >= 0. +""" + ) + + ## Geometric distribution class geom_gen(rv_discrete): From scipy-svn at scipy.org Sat May 8 04:45:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:45:39 -0500 (CDT) Subject: [Scipy-svn] r6381 - trunk/scipy/stats Message-ID: <20100508084539.40A4039CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:45:39 -0500 (Sat, 08 May 2010) New Revision: 6381 Modified: trunk/scipy/stats/distributions.py Log: DOC: Put extradoc content in Notes section instead of at the end. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:45:24 UTC (rev 6380) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:45:39 UTC (rev 6381) @@ -74,6 +74,7 @@ docheaders = {'methods':"""\nMethods\n-------\n""", 'parameters':"""\nParameters\n---------\n""", + 'notes':"""\nNotes\n-----\n""", 'examples':"""\nExamples\n--------\n"""} _doc_rvs = \ @@ -157,8 +158,7 @@ location, and scale fixed. """ _doc_default_example = \ -""" -Examples +"""Examples -------- >>> import matplotlib.pyplot as plt >>> numargs = %(name)s.numargs @@ -643,9 +643,11 @@ def _construct_default_doc(self, longname=None, extradoc=None): """Construct instance docstring from the default template.""" + if extradoc.startswith('\n\n'): + extradoc = extradoc[2:] self.__doc__ = ''.join(['%s continuous random variable.'%longname, - '\n\n%(default)s\n\n', - extradoc]) + '\n\n%(before_notes)s\n', docheaders['notes'], + extradoc, '\n%(example)s']) self._construct_doc() def _construct_doc(self): @@ -3980,9 +3982,11 @@ def _construct_default_doc(self, longname=None, extradoc=None): """Construct instance docstring from the rv_discrete template.""" + if extradoc.startswith('\n\n'): + extradoc = extradoc[2:] self.__doc__ = ''.join(['%s discrete random variable.'%longname, - '\n\n%(default)s\n\n', - extradoc]) + '\n\n%(before_notes)s\n', docheaders['notes'], + extradoc, '\n%(example)s']) self._construct_doc() def _construct_doc(self): From scipy-svn at scipy.org Sat May 8 04:46:05 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:46:05 -0500 (CDT) Subject: [Scipy-svn] r6382 - in trunk/scipy: io/matlab misc misc/tests ndimage ndimage/tests stats Message-ID: <20100508084605.AFC5639CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:46:05 -0500 (Sat, 08 May 2010) New Revision: 6382 Added: trunk/scipy/misc/doccer.py trunk/scipy/misc/tests/test_doccer.py Removed: trunk/scipy/ndimage/doccer.py trunk/scipy/ndimage/tests/test_doccer.py Modified: trunk/scipy/io/matlab/miobase.py trunk/scipy/ndimage/__init__.py trunk/scipy/ndimage/filters.py trunk/scipy/stats/distributions.py Log: Move ndimage.doccer to misc.doccer. Reason: stats should not depend on ndimage Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/io/matlab/miobase.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -5,7 +5,7 @@ """ import numpy as np -from scipy.ndimage import doccer +from scipy.misc import doccer import byteordercodes as boc @@ -139,7 +139,7 @@ dtypes : mapping mapping where values have been replaced by ``np.dtype(val).newbyteorder(order_code)`` - + ''' dtypes = dtype_template.copy() for k in dtypes: @@ -221,8 +221,8 @@ def matdims(arr, oned_as='column'): - ''' Determine equivalent matlab dimensions for given array - + ''' Determine equivalent matlab dimensions for given array + Parameters ---------- arr : ndarray @@ -377,7 +377,7 @@ self.mat_stream.seek(curpos-1) return len(b) == 0 - + def arr_dtype_number(arr, num): ''' Return dtype for given number of items per element''' return np.dtype(arr.dtype.str[:2] + str(num)) Copied: trunk/scipy/misc/doccer.py (from rev 6381, trunk/scipy/ndimage/doccer.py) =================================================================== --- trunk/scipy/misc/doccer.py (rev 0) +++ trunk/scipy/misc/doccer.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -0,0 +1,135 @@ +''' Utilities to allow inserting docstring fragments for common +parameters into function and method docstrings''' + +import sys + +def docformat(docstring, docdict=None): + ''' Fill a function docstring from variables in dictionary + + Adapt the indent of the inserted docs + + Parameters + ---------- + docstring : string + docstring from function, possibly with dict formatting strings + docdict : dict + dictionary with keys that match the dict formatting strings + and values that are docstring fragments to be inserted. The + indentation of the inserted docstrings is set to match the + minimum indentation of the ``docstring`` by adding this + indentation to all lines of the inserted string, except the + first + + Returns + ------- + outstring : string + string with requested ``docdict`` strings inserted + + Examples + -------- + >>> docformat(' Test string with %(value)s', {'value':'inserted value'}) + ' Test string with inserted value' + >>> docstring = 'First line\\n Second line\\n %(value)s' + >>> inserted_string = "indented\\nstring" + >>> docdict = {'value': inserted_string} + >>> docformat(docstring, docdict) + 'First line\\n Second line\\n indented\\n string' + ''' + if not docstring: + return docstring + if docdict is None: + docdict = {} + if not docdict: + return docstring + lines = docstring.expandtabs().splitlines() + # Find the minimum indent of the main docstring, after first line + if len(lines) < 2: + icount = 0 + else: + icount = indentcount_lines(lines[1:]) + indent = ' ' * icount + # Insert this indent to dictionary docstrings + indented = {} + for name, dstr in docdict.items(): + lines = dstr.expandtabs().splitlines() + try: + newlines = [lines[0]] + for line in lines[1:]: + newlines.append(indent+line) + indented[name] = '\n'.join(newlines) + except IndexError: + indented[name] = dstr + return docstring % indented + + +def indentcount_lines(lines): + ''' Minumum indent for all lines in line list + + >>> lines = [' one', ' two', ' three'] + >>> indentcount_lines(lines) + 1 + >>> lines = [] + >>> indentcount_lines(lines) + 0 + >>> lines = [' one'] + >>> indentcount_lines(lines) + 1 + >>> indentcount_lines([' ']) + 0 + ''' + indentno = sys.maxint + for line in lines: + stripped = line.lstrip() + if stripped: + indentno = min(indentno, len(line) - len(stripped)) + if indentno == sys.maxint: + return 0 + return indentno + + +def filldoc(docdict, unindent_params=True): + ''' Return docstring decorator using docdict variable dictionary + + Parameters + ---------- + docdict : dictionary + dictionary containing name, docstring fragment pairs + unindent_params : {False, True}, boolean, optional + If True, strip common indentation from all parameters in + docdict + + Returns + ------- + decfunc : function + decorator that applies dictionary to input function docstring + + ''' + if unindent_params: + docdict = unindent_dict(docdict) + def decorate(f): + f.__doc__ = docformat(f.__doc__, docdict) + return f + return decorate + + +def unindent_dict(docdict): + ''' Unindent all strings in a docdict ''' + can_dict = {} + for name, dstr in docdict.items(): + can_dict[name] = unindent_string(dstr) + return can_dict + + +def unindent_string(docstring): + ''' Set docstring to minimum indent for all lines, including first + + >>> unindent_string(' two') + 'two' + >>> unindent_string(' two\\n three') + 'two\\n three' + ''' + lines = docstring.expandtabs().splitlines() + icount = indentcount_lines(lines) + if icount == 0: + return docstring + return '\n'.join([line[icount:] for line in lines]) Copied: trunk/scipy/misc/tests/test_doccer.py (from rev 6381, trunk/scipy/ndimage/tests/test_doccer.py) =================================================================== --- trunk/scipy/misc/tests/test_doccer.py (rev 0) +++ trunk/scipy/misc/tests/test_doccer.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -0,0 +1,89 @@ +''' Some tests for the documenting decorator and support functions ''' + +import numpy as np + +from numpy.testing import assert_equal, assert_raises + +from nose.tools import assert_true + +from scipy.misc import doccer + +docstring = \ +"""Docstring + %(strtest1)s + %(strtest2)s + %(strtest3)s +""" +param_doc1 = \ +"""Another test + with some indent""" + +param_doc2 = \ +"""Another test, one line""" + +param_doc3 = \ +""" Another test + with some indent""" + +doc_dict = {'strtest1':param_doc1, + 'strtest2':param_doc2, + 'strtest3':param_doc3} + +filled_docstring = \ +"""Docstring + Another test + with some indent + Another test, one line + Another test + with some indent +""" + + +def test_unindent(): + yield assert_equal, doccer.unindent_string(param_doc1), param_doc1 + yield assert_equal, doccer.unindent_string(param_doc2), param_doc2 + yield assert_equal, doccer.unindent_string(param_doc3), param_doc1 + + +def test_unindent_dict(): + d2 = doccer.unindent_dict(doc_dict) + yield assert_equal, d2['strtest1'], doc_dict['strtest1'] + yield assert_equal, d2['strtest2'], doc_dict['strtest2'] + yield assert_equal, d2['strtest3'], doc_dict['strtest1'] + + +def test_docformat(): + udd = doccer.unindent_dict(doc_dict) + formatted = doccer.docformat(docstring, udd) + yield assert_equal, formatted, filled_docstring + single_doc = 'Single line doc %(strtest1)s' + formatted = doccer.docformat(single_doc, doc_dict) + # Note - initial indent of format string does not + # affect subsequent indent of inserted parameter + yield assert_equal, formatted, """Single line doc Another test + with some indent""" + + +def test_decorator(): + # with unindentation of parameters + decorator = doccer.filldoc(doc_dict, True) + @decorator + def func(): + """ Docstring + %(strtest3)s + """ + yield assert_equal, func.__doc__, """ Docstring + Another test + with some indent + """ + # without unindentation of parameters + decorator = doccer.filldoc(doc_dict, False) + @decorator + def func(): + """ Docstring + %(strtest3)s + """ + yield assert_equal, func.__doc__, """ Docstring + Another test + with some indent + """ Modified: trunk/scipy/ndimage/__init__.py =================================================================== --- trunk/scipy/ndimage/__init__.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/ndimage/__init__.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -36,6 +36,11 @@ from morphology import * from io import * +# doccer is moved to scipy.misc in scipy 0.8 +from scipy.misc import doccer +doccer = numpy.deprecate(doccer, old_name='doccer', + new_name='scipy.misc.doccer') + from info import __doc__ __version__ = '2.0' Deleted: trunk/scipy/ndimage/doccer.py =================================================================== --- trunk/scipy/ndimage/doccer.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/ndimage/doccer.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -1,135 +0,0 @@ -''' Utilities to allow inserting docstring fragments for common -parameters into function and method docstrings''' - -import sys - -def docformat(docstring, docdict=None): - ''' Fill a function docstring from variables in dictionary - - Adapt the indent of the inserted docs - - Parameters - ---------- - docstring : string - docstring from function, possibly with dict formatting strings - docdict : dict - dictionary with keys that match the dict formatting strings - and values that are docstring fragments to be inserted. The - indentation of the inserted docstrings is set to match the - minimum indentation of the ``docstring`` by adding this - indentation to all lines of the inserted string, except the - first - - Returns - ------- - outstring : string - string with requested ``docdict`` strings inserted - - Examples - -------- - >>> docformat(' Test string with %(value)s', {'value':'inserted value'}) - ' Test string with inserted value' - >>> docstring = 'First line\\n Second line\\n %(value)s' - >>> inserted_string = "indented\\nstring" - >>> docdict = {'value': inserted_string} - >>> docformat(docstring, docdict) - 'First line\\n Second line\\n indented\\n string' - ''' - if not docstring: - return docstring - if docdict is None: - docdict = {} - if not docdict: - return docstring - lines = docstring.expandtabs().splitlines() - # Find the minimum indent of the main docstring, after first line - if len(lines) < 2: - icount = 0 - else: - icount = indentcount_lines(lines[1:]) - indent = ' ' * icount - # Insert this indent to dictionary docstrings - indented = {} - for name, dstr in docdict.items(): - lines = dstr.expandtabs().splitlines() - try: - newlines = [lines[0]] - for line in lines[1:]: - newlines.append(indent+line) - indented[name] = '\n'.join(newlines) - except IndexError: - indented[name] = dstr - return docstring % indented - - -def indentcount_lines(lines): - ''' Minumum indent for all lines in line list - - >>> lines = [' one', ' two', ' three'] - >>> indentcount_lines(lines) - 1 - >>> lines = [] - >>> indentcount_lines(lines) - 0 - >>> lines = [' one'] - >>> indentcount_lines(lines) - 1 - >>> indentcount_lines([' ']) - 0 - ''' - indentno = sys.maxint - for line in lines: - stripped = line.lstrip() - if stripped: - indentno = min(indentno, len(line) - len(stripped)) - if indentno == sys.maxint: - return 0 - return indentno - - -def filldoc(docdict, unindent_params=True): - ''' Return docstring decorator using docdict variable dictionary - - Parameters - ---------- - docdict : dictionary - dictionary containing name, docstring fragment pairs - unindent_params : {False, True}, boolean, optional - If True, strip common indentation from all parameters in - docdict - - Returns - ------- - decfunc : function - decorator that applies dictionary to input function docstring - - ''' - if unindent_params: - docdict = unindent_dict(docdict) - def decorate(f): - f.__doc__ = docformat(f.__doc__, docdict) - return f - return decorate - - -def unindent_dict(docdict): - ''' Unindent all strings in a docdict ''' - can_dict = {} - for name, dstr in docdict.items(): - can_dict[name] = unindent_string(dstr) - return can_dict - - -def unindent_string(docstring): - ''' Set docstring to minimum indent for all lines, including first - - >>> unindent_string(' two') - 'two' - >>> unindent_string(' two\\n three') - 'two\\n three' - ''' - lines = docstring.expandtabs().splitlines() - icount = indentcount_lines(lines) - if icount == 0: - return docstring - return '\n'.join([line[icount:] for line in lines]) Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/ndimage/filters.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -32,7 +32,7 @@ import numpy import _ni_support import _nd_image -import doccer +from scipy.misc import doccer _input_doc = \ """input : array-like Deleted: trunk/scipy/ndimage/tests/test_doccer.py =================================================================== --- trunk/scipy/ndimage/tests/test_doccer.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/ndimage/tests/test_doccer.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -1,89 +0,0 @@ -''' Some tests for the documenting decorator and support functions ''' - -import numpy as np - -from numpy.testing import assert_equal, assert_raises - -from nose.tools import assert_true - -import scipy.ndimage.doccer as sndd - -docstring = \ -"""Docstring - %(strtest1)s - %(strtest2)s - %(strtest3)s -""" -param_doc1 = \ -"""Another test - with some indent""" - -param_doc2 = \ -"""Another test, one line""" - -param_doc3 = \ -""" Another test - with some indent""" - -doc_dict = {'strtest1':param_doc1, - 'strtest2':param_doc2, - 'strtest3':param_doc3} - -filled_docstring = \ -"""Docstring - Another test - with some indent - Another test, one line - Another test - with some indent -""" - - -def test_unindent(): - yield assert_equal, sndd.unindent_string(param_doc1), param_doc1 - yield assert_equal, sndd.unindent_string(param_doc2), param_doc2 - yield assert_equal, sndd.unindent_string(param_doc3), param_doc1 - - -def test_unindent_dict(): - d2 = sndd.unindent_dict(doc_dict) - yield assert_equal, d2['strtest1'], doc_dict['strtest1'] - yield assert_equal, d2['strtest2'], doc_dict['strtest2'] - yield assert_equal, d2['strtest3'], doc_dict['strtest1'] - - -def test_docformat(): - udd = sndd.unindent_dict(doc_dict) - formatted = sndd.docformat(docstring, udd) - yield assert_equal, formatted, filled_docstring - single_doc = 'Single line doc %(strtest1)s' - formatted = sndd.docformat(single_doc, doc_dict) - # Note - initial indent of format string does not - # affect subsequent indent of inserted parameter - yield assert_equal, formatted, """Single line doc Another test - with some indent""" - - -def test_decorator(): - # with unindentation of parameters - decorator = sndd.filldoc(doc_dict, True) - @decorator - def func(): - """ Docstring - %(strtest3)s - """ - yield assert_equal, func.__doc__, """ Docstring - Another test - with some indent - """ - # without unindentation of parameters - decorator = sndd.filldoc(doc_dict, False) - @decorator - def func(): - """ Docstring - %(strtest3)s - """ - yield assert_equal, func.__doc__, """ Docstring - Another test - with some indent - """ Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:45:39 UTC (rev 6381) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:46:05 UTC (rev 6382) @@ -62,7 +62,7 @@ import types import stats as st -from scipy.ndimage import doccer +from scipy.misc import doccer all = alltrue sgf = vectorize @@ -4990,7 +4990,7 @@ 1-ncx2.cdf(2*mu1, 2*(x+1), 2*mu2)) return px -# enable later +# enable later ## def _cf(self, w, mu1, mu2): ## # characteristic function ## poisscf = poisson._cf @@ -5020,6 +5020,6 @@ Parameters mu1 and mu2 must be strictly positive. For details see: http://en.wikipedia.org/wiki/Skellam_distribution - + """ ) From scipy-svn at scipy.org Sat May 8 04:46:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 03:46:21 -0500 (CDT) Subject: [Scipy-svn] r6383 - trunk/scipy/stats Message-ID: <20100508084621.2396E39CAED@scipy.org> Author: rgommers Date: 2010-05-08 03:46:21 -0500 (Sat, 08 May 2010) New Revision: 6383 Modified: trunk/scipy/stats/distributions.py Log: STY: Reformat docdict strings to lines <80 chars long. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-08 08:46:05 UTC (rev 6382) +++ trunk/scipy/stats/distributions.py 2010-05-08 08:46:21 UTC (rev 6383) @@ -69,8 +69,8 @@ import new -## These are the docstring parts used for substitution in specific -## distribution docstrings. +# These are the docstring parts used for substitution in specific +# distribution docstrings. docheaders = {'methods':"""\nMethods\n-------\n""", 'parameters':"""\nParameters\n---------\n""", @@ -117,9 +117,9 @@ """fit(data, %(shapes)s, loc=0, scale=1) Parameter estimates for generic data. """ -_doc_allmethods = ''.join([docheaders['methods'], _doc_rvs, _doc_pdf, _doc_cdf, - _doc_sf, _doc_ppf, _doc_isf, _doc_stats, - _doc_entropy, _doc_fit]) +_doc_allmethods = ''.join([docheaders['methods'], _doc_rvs, _doc_pdf, + _doc_cdf, _doc_sf, _doc_ppf, _doc_isf, + _doc_stats, _doc_entropy, _doc_fit]) _doc_default_callparams = \ """ @@ -180,11 +180,14 @@ >>> R = %(name)s.rvs(%(shapes)s, size=100) """ -_doc_default = ''.join([_doc_default_longsummary, _doc_allmethods, - _doc_default_callparams, _doc_default_frozen_note, +_doc_default = ''.join([_doc_default_longsummary, + _doc_allmethods, + _doc_default_callparams, + _doc_default_frozen_note, _doc_default_example]) -_doc_default_before_notes = ''.join([_doc_default_longsummary, _doc_allmethods, +_doc_default_before_notes = ''.join([_doc_default_longsummary, + _doc_allmethods, _doc_default_callparams, _doc_default_frozen_note]) @@ -205,12 +208,13 @@ 'default':_doc_default, 'before_notes':_doc_default_before_notes} -# Reuse common content between continous and discrete docs, change some minor -# bits. +# Reuse common content between continous and discrete docs, change some +# minor bits. docdict_discrete = docdict.copy() docdict_discrete['pmf'] = _doc_pmf -_doc_disc_methods = ['rvs', 'pmf', 'cdf', 'sf', 'ppf', 'isf', 'stats', 'entropy', 'fit'] +_doc_disc_methods = ['rvs', 'pmf', 'cdf', 'sf', 'ppf', 'isf', 'stats', + 'entropy', 'fit'] for obj in _doc_disc_methods: docdict_discrete[obj] = docdict_discrete[obj].replace(', scale=1', '') docdict_discrete.pop('pdf') From scipy-svn at scipy.org Sat May 8 06:35:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 05:35:37 -0500 (CDT) Subject: [Scipy-svn] r6384 - trunk Message-ID: <20100508103537.357B739CAED@scipy.org> Author: rgommers Date: 2010-05-08 05:35:37 -0500 (Sat, 08 May 2010) New Revision: 6384 Modified: trunk/INSTALL.txt Log: DOC: Add note that SciPy trunk can require NumPy trunk. Fixes #989. Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2010-05-08 08:46:21 UTC (rev 6383) +++ trunk/INSTALL.txt 2010-05-08 10:35:37 UTC (rev 6384) @@ -23,7 +23,8 @@ __ http://www.python.org -2) NumPy__ 1.3.0 or newer +2) NumPy__ 1.4.1 or newer (note: SciPy trunk at times requires latest NumPy + trunk). __ http://www.numpy.org/ From scipy-svn at scipy.org Sat May 8 10:16:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 09:16:07 -0500 (CDT) Subject: [Scipy-svn] r6385 - trunk Message-ID: <20100508141607.02D3D39CAED@scipy.org> Author: rgommers Date: 2010-05-08 09:16:06 -0500 (Sat, 08 May 2010) New Revision: 6385 Modified: trunk/pavement.py Log: REL: cleanups of Paver script taken from the 0.7.x branch. Modified: trunk/pavement.py =================================================================== --- trunk/pavement.py 2010-05-08 10:35:37 UTC (rev 6384) +++ trunk/pavement.py 2010-05-08 14:16:06 UTC (rev 6385) @@ -77,14 +77,15 @@ if sys.platform == "win32": WINE_PY25 = [r"C:\Python25\python.exe"] WINE_PY26 = [r"C:\Python26\python26.exe"] + MAKENSIS = ["makensis"] elif sys.platform == "darwin": - WINE_PY25 = ["/Applications/Darwine/Wine.bundle/Contents/bin/wine", - "/Users/david/.wine/drive_c/Python25/python.exe"] - WINE_PY26 = ["/Applications/Darwine/Wine.bundle/Contents/bin/wine", - "/Users/david/.wine/drive_c/Python26/python.exe"] + WINE_PY25 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] + WINE_PY26 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"] + MAKENSIS = ["wine", "makensis"] else: - WINE_PY25 = ["/home/david/.wine/drive_c/Python25/python.exe"] - WINE_PY26 = ["/home/david/.wine/drive_c/Python26/python.exe"] + WINE_PY25 = [os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] + WINE_PY26 = [os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"] + MAKENSIS = ["wine", "makensis"] WINE_PYS = {'2.6' : WINE_PY26, '2.5': WINE_PY25} SUPERPACK_BUILD = 'build-superpack' SUPERPACK_BINDIR = os.path.join(SUPERPACK_BUILD, 'binaries') @@ -123,11 +124,15 @@ options(sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'), virtualenv=Bunch(script_name=BOOTSTRAP_SCRIPT, - packages_to_install=["sphinx==0.6.1"]), - wininst=Bunch(pyver="2.5", scratch=True)) + packages_to_install=["sphinx==0.6.5"]), + wininst=Bunch(pyver=PYVER, scratch=True)) def parse_numpy_version(pyexec): - cmd = [pyexec, "-c", '"import numpy; print numpy.version.version"'] + if isinstance(pyexec, str): + cmd = [pyexec, "-c", "'import numpy; print numpy.version.version'"] + else: + # sequence for pyexec + cmd = pyexec + ["-c", "'import numpy; print numpy.version.version'"] # Execute in shell because launching python from python does not work # (hangs) @@ -357,8 +362,8 @@ def bdist_superpack(options): """Build all arch specific wininst installers.""" prepare_nsis_script(options.wininst.pyver, FULLVERSION) - subprocess.check_call(['makensis', 'scipy-superinstaller.nsi'], - cwd=SUPERPACK_BUILD) + subprocess.check_call(MAKENSIS + ['scipy-superinstaller.nsi'], + cwd=SUPERPACK_BUILD) # Copy the superpack into installers dir if not os.path.exists(INSTALLERS_DIR): From scipy-svn at scipy.org Sat May 8 11:05:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 10:05:47 -0500 (CDT) Subject: [Scipy-svn] r6386 - in trunk/scipy: io/matlab/tests io/tests ndimage ndimage/tests signal signal/tests Message-ID: <20100508150547.4C21D39CAED@scipy.org> Author: ptvirtan Date: 2010-05-08 10:05:47 -0500 (Sat, 08 May 2010) New Revision: 6386 Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py trunk/scipy/io/tests/test_netcdf.py trunk/scipy/ndimage/measurements.py trunk/scipy/ndimage/tests/test_ndimage.py trunk/scipy/signal/signaltools.py trunk/scipy/signal/tests/test_filter_design.py Log: BUG: ndimage/signal: replace python2.5/2.6-isms with backward compatible constructs Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -72,7 +72,8 @@ def _make_readerlike(): - class R(): pass + class R(object): + pass r = R() r.byte_order = boc.native_code r.dtypes = {} Modified: trunk/scipy/io/tests/test_netcdf.py =================================================================== --- trunk/scipy/io/tests/test_netcdf.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/io/tests/test_netcdf.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -74,9 +74,12 @@ for testargs in gen_for_simple(f): yield testargs f.close() - finally: + except: os.chdir(cwd) shutil.rmtree(tmpdir) + raise + os.chdir(cwd) + shutil.rmtree(tmpdir) def test_read_write_sio(): Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/ndimage/measurements.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -31,6 +31,7 @@ import types import math import numpy +import numpy as np import _ni_support import _nd_image import morphology @@ -218,7 +219,7 @@ return func(input[labels > 0], positions[labels > 0]) index = numpy.atleast_1d(index) - if any(index.astype(labels.dtype).astype(index.dtype) != index): + if np.any(index.astype(labels.dtype).astype(index.dtype) != index): raise ValueError, "Cannot convert index values from <%s> to <%s> (labels' type) without loss of precision"%(index.dtype, labels.dtype) index = index.astype(labels.dtype) @@ -426,11 +427,17 @@ if index is None: mask = (labels > 0) - return single_group(input[mask], positions[mask] if find_positions else None) + masked_positions = None + if find_positions: + masked_positions = positions[mask] + return single_group(input[mask], masked_positions) if numpy.isscalar(index): mask = (labels == index) - return single_group(input[mask], positions[mask] if find_positions else None) + masked_positions = None + if find_positions: + masked_positions = positions[mask] + return single_group(input[mask], masked_positions) order = input.ravel().argsort() input = input.ravel()[order] Modified: trunk/scipy/ndimage/tests/test_ndimage.py =================================================================== --- trunk/scipy/ndimage/tests/test_ndimage.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/ndimage/tests/test_ndimage.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -30,6 +30,7 @@ import math import numpy +import numpy as np from numpy import fft from numpy.testing import * import scipy.ndimage as ndimage @@ -2971,7 +2972,7 @@ input = numpy.array([1, 3, 8, 10, 8], type) output = ndimage.standard_deviation(input, labels, [2, 3, 4]) - self.failUnless(all(output == [1.0, 1.0, 0.0])) + self.failUnless(np.all(output == [1.0, 1.0, 0.0])) def test_minimum_position01(self): "minimum position 1" Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/signal/signaltools.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -15,7 +15,7 @@ transpose, dot, any, mean, flipud, ndarray import numpy as np from scipy.misc import factorial -from .windows import get_window +from windows import get_window _modedict = {'valid':0, 'same':1, 'full':2} Modified: trunk/scipy/signal/tests/test_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_filter_design.py 2010-05-08 14:16:06 UTC (rev 6385) +++ trunk/scipy/signal/tests/test_filter_design.py 2010-05-08 15:05:47 UTC (rev 6386) @@ -28,12 +28,13 @@ filter coefficients.""" warnings.simplefilter("error", BadCoefficients) try: - b, a = bessel(20, 0.1) - z, p, k = tf2zpk(b, a) - raise AssertionError("tf2zpk did not warn about bad "\ - "coefficients") - except BadCoefficients: - pass + try: + b, a = bessel(20, 0.1) + z, p, k = tf2zpk(b, a) + raise AssertionError("tf2zpk did not warn about bad "\ + "coefficients") + except BadCoefficients: + pass finally: warnings.simplefilter("always", BadCoefficients) From scipy-svn at scipy.org Sat May 8 11:13:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 8 May 2010 10:13:31 -0500 (CDT) Subject: [Scipy-svn] r6387 - trunk/scipy/weave Message-ID: <20100508151331.B2D5539CAF8@scipy.org> Author: rgommers Date: 2010-05-08 10:13:31 -0500 (Sat, 08 May 2010) New Revision: 6387 Modified: trunk/scipy/weave/build_tools.py Log: BUG: fix gcc_exists Windows warnings and function itself. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2010-05-08 15:05:47 UTC (rev 6386) +++ trunk/scipy/weave/build_tools.py 2010-05-08 15:13:31 UTC (rev 6387) @@ -336,19 +336,19 @@ compiler_name = 'unix' return compiler_name -def gcc_exists(name = 'gcc'): - """ Test to make sure gcc is found - - Does this return correct value on win98??? - """ +def gcc_exists(name='gcc'): + """ Test to make sure gcc is found.""" result = 0 cmd = [str(name), '-v'] try: - p = subprocess.Popen(cmd, True, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + if sys.platform == 'win32': + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + else: + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) str_result = p.stdout.read() - #print str_result - if 'Reading specs' in str_result: + if 'specs' in str_result: result = 1 except: # This was needed because the msvc compiler messes with From scipy-svn at scipy.org Mon May 10 15:52:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 May 2010 14:52:36 -0500 (CDT) Subject: [Scipy-svn] r6388 - trunk/scipy/io/matlab Message-ID: <20100510195236.3917A39CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-10 14:52:36 -0500 (Mon, 10 May 2010) New Revision: 6388 Modified: trunk/scipy/io/matlab/mio5.py Log: BF - workaround for odd compressed variable problem reported by Angus MacMorland Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-05-08 15:13:31 UTC (rev 6387) +++ trunk/scipy/io/matlab/mio5.py 2010-05-10 19:52:36 UTC (rev 6388) @@ -350,8 +350,13 @@ mdtype, byte_count = self._file_reader.read_full_tag() assert byte_count > 0 next_pos = self.mat_stream.tell() + byte_count - if mdtype == miCOMPRESSED: # make new stream from compressed data - stream = StringIO(zlib.decompress(self.mat_stream.read(byte_count))) + if mdtype == miCOMPRESSED: + # make new stream from compressed data + data = self.mat_stream.read(byte_count) + # use decompressobj to work round puzzling zlib.decompress + # failure: http://bugs.python.org/issue8672 + stream = StringIO(zlib.decompressobj().decompress(data)) + del data self._matrix_reader.set_stream(stream) mdtype, byte_count = self._matrix_reader.read_full_tag() else: From scipy-svn at scipy.org Mon May 10 21:52:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 10 May 2010 20:52:36 -0500 (CDT) Subject: [Scipy-svn] r6389 - trunk/scipy/io/matlab Message-ID: <20100511015236.F1FA639CAEC@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-10 20:52:36 -0500 (Mon, 10 May 2010) New Revision: 6389 Modified: trunk/scipy/io/matlab/mio5.py Log: DOC - comments on decompression fix with assert Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-05-10 19:52:36 UTC (rev 6388) +++ trunk/scipy/io/matlab/mio5.py 2010-05-11 01:52:36 UTC (rev 6389) @@ -353,9 +353,15 @@ if mdtype == miCOMPRESSED: # make new stream from compressed data data = self.mat_stream.read(byte_count) - # use decompressobj to work round puzzling zlib.decompress - # failure: http://bugs.python.org/issue8672 - stream = StringIO(zlib.decompressobj().decompress(data)) + # Some matlab files contain zlib streams without valid + # Z_STREAM_END termination. To get round this, we use the + # decompressobj object, that allows you to decode an + # incomplete stream. See discussion at + # http://bugs.python.org/issue8672 + dcor = zlib.decompressobj() + stream = StringIO(dcor.decompress(data)) + # Check the stream is not so broken as to leave cruft behind + assert dcor.flush() == '' del data self._matrix_reader.set_stream(stream) mdtype, byte_count = self._matrix_reader.read_full_tag() From scipy-svn at scipy.org Fri May 14 11:16:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 May 2010 10:16:51 -0500 (CDT) Subject: [Scipy-svn] r6390 - trunk/scipy/stats Message-ID: <20100514151651.A2D9039C4B4@scipy.org> Author: rgommers Date: 2010-05-14 10:16:51 -0500 (Fri, 14 May 2010) New Revision: 6390 Modified: trunk/scipy/stats/distributions.py Log: DOC: fix bug for stats doc generation by more complete string substitution. If the shapes keyword is None, the Parameters section should not display the two lines for shapes. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-11 01:52:36 UTC (rev 6389) +++ trunk/scipy/stats/distributions.py 2010-05-14 15:16:51 UTC (rev 6390) @@ -121,6 +121,8 @@ _doc_cdf, _doc_sf, _doc_ppf, _doc_isf, _doc_stats, _doc_entropy, _doc_fit]) +# Note that the two lines for %(shapes) are searched for and replaced in +# rv_continuous and rv_discrete - update there if the exact string changes _doc_default_callparams = \ """ Parameters @@ -660,6 +662,11 @@ tempdict['name'] = self.name or 'distname' tempdict['shapes'] = self.shapes or '' + if self.shapes is None: + # remove shapes from call parameters if there are none + for item in ['callparams', 'default', 'before_notes']: + tempdict[item] = tempdict[item].replace(\ + "\n%(shapes)s : array-like\n shape parameters", "") for i in range(2): if self.shapes is None: # necessary because we use %(shapes)s in two forms (w w/o ", ") @@ -3999,6 +4006,11 @@ tempdict['name'] = self.name or 'distname' tempdict['shapes'] = self.shapes or '' + if self.shapes is None: + # remove shapes from call parameters if there are none + for item in ['callparams', 'default', 'before_notes']: + tempdict[item] = tempdict[item].replace(\ + "\n%(shapes)s : array-like\n shape parameters", "") for i in range(2): if self.shapes is None: # necessary because we use %(shapes)s in two forms (w w/o ", ") From scipy-svn at scipy.org Fri May 14 11:17:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 14 May 2010 10:17:12 -0500 (CDT) Subject: [Scipy-svn] r6391 - trunk/scipy/stats Message-ID: <20100514151712.D33D839C4B4@scipy.org> Author: rgommers Date: 2010-05-14 10:17:12 -0500 (Fri, 14 May 2010) New Revision: 6391 Modified: trunk/scipy/stats/distributions.py Log: Remove unused import. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-14 15:16:51 UTC (rev 6390) +++ trunk/scipy/stats/distributions.py 2010-05-14 15:17:12 UTC (rev 6391) @@ -25,8 +25,8 @@ from scipy.special import gammaln as gamln from copy import copy import vonmises_cython -import textwrap + __all__ = [ 'rv_continuous', 'ksone', 'kstwobign', 'norm', 'alpha', 'anglit', 'arcsine', From scipy-svn at scipy.org Sat May 15 18:10:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 15 May 2010 17:10:31 -0500 (CDT) Subject: [Scipy-svn] r6392 - trunk/scipy/stats Message-ID: <20100515221031.E811139CAFC@scipy.org> Author: oliphant Date: 2010-05-15 17:10:31 -0500 (Sat, 15 May 2010) New Revision: 6392 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/morestats.py Log: Add a few more methods to distributions objects and add a 'describe' function to return the distribution objects for mean, variance, and standard deviation of data. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-14 15:17:12 UTC (rev 6391) +++ trunk/scipy/stats/distributions.py 2010-05-15 22:10:31 UTC (rev 6392) @@ -58,12 +58,9 @@ gam = special.gamma lgam = special.gammaln - import types import stats as st - from scipy.misc import doccer - all = alltrue sgf = vectorize import new @@ -319,12 +316,22 @@ kwds = self.kwds kwds.update({'moments':moments}) return self.dist.stats(*self.args,**kwds) + def median(self): + return self.dist.median(*self.args, **self.kwds) + def mean(self): + return self.dist.mean(*self.args,**self.kwds) + def var(self): + return self.dist.var(*self.args, **self.kwds) + def std(self): + return self.dist.std(*self.args, **self.kwds) def moment(self,n): return self.dist.moment(n,*self.args,**self.kwds) def entropy(self): return self.dist.entropy(*self.args,**self.kwds) def pmf(self,k): return self.dist.pmf(k,*self.args,**self.kwds) + def interval(self,alpha): + return self.dist.interval(alpha, *self.args, **self.kwds) @@ -535,7 +542,58 @@ return vals + def median(self, *args, **kwds): + return self.ppf(0.5, *args, **kwds) + def mean(self, *args, **kwds): + kwds['moments'] = 'm' + res = self.stats(*args, **kwds) + if isinstance(res, ndarray) and res.ndim == 0: + return res[()] + + def var(self, *args, **kwds): + kwds['moments'] = 'v' + res = self.stats(*args, **kwds) + if isinstance(res, ndarray) and res.ndim == 0: + return res[()] + else: + return res + + def std(self, *args, **kwds): + kwds['moments'] = 'v' + res = sqrt(self.stats(*args, **kwds)) + return res + + def interval(self, alpha, *args, **kwds): + """Confidence interval centered on the median + + Parameters + ---------- + alpha : array-like float in [0,1] + Probability that an rv will be drawn from the returned range + arg1, arg2, ... : array-like + The shape parameter(s) for the distribution (see docstring of the instance + object for more information) + loc: array-like, optioal + location parameter (deafult = 0) + scale : array-like, optional + scale paramter (default = 1) + + Returns + ------- + a, b: array-like (float) + end-points of range that contain alpha % of the rvs + """ + alpha = asarray(alpha) + if any((alpha > 1) | (alpha < 0)): + raise ValueError, "alpha must be between 0 and 1 inclusive" + q1 = (1.0-alpha)/2 + q2 = (1.0+alpha)/2 + a = self.ppf(q1, *args, **kwds) + b = self.ppf(q2, *args, **kwds) + return a, b + + class rv_continuous(rv_generic): """A generic continuous random variable class meant for subclassing. @@ -574,6 +632,70 @@ ------- ... + generic.pdf(x,,loc=0,scale=1) + - probability density function + + generic.cdf(x,,loc=0,scale=1) + - cumulative density function + + generic.sf(x,,loc=0,scale=1) + - survival function (1-cdf --- sometimes more accurate) + + generic.ppf(q,,loc=0,scale=1) + - percent point function (inverse of cdf --- percentiles) + + generic.median(,loc=0,scale=1) + - median of the distribution + + generic.isf(q,,loc=0,scale=1) + - inverse survival function (inverse of sf) + + generic.stats(,loc=0,scale=1,moments='mv') + - mean('m'), variance('v'), skew('s'), and/or kurtosis('k') + + generic.mean(,loc=0,scale=1) + - mean of the distribution + + generic.var(,loc=0,scale=1) + - variance of the distribution + + generic.std(,loc=0,scale=1) + - standard deviation of the distribution + + generic.entropy(,loc=0,scale=1) + - (differential) entropy of the RV. + + generic.fit(data,,loc=0,scale=1) + - Parameter estimates for generic data + + generic.interval(alpha, ,loc=0,scale=1) + - Return an alpha confidence interval centered on the median + + Alternatively, the object may be called (as a function) to fix the shape, + location, and scale parameters returning a "frozen" continuous RV object: + + rv = generic(,loc=0,scale=1) + - frozen RV object with the same methods but holding the given shape, location, and scale fixed + + Parameters + ---------- + x : array-like + quantiles + q : array-like + lower or upper tail probability + : array-like + shape parameters + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + size : int or tuple of ints, optional + shape of random variates (default computed from input arguments ) + moments : string, optional + composed of letters ['mvsk'] specifying which moments to compute where + 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and + 'k' = (Fisher's) kurtosis. (default='mv') + Examples -------- To create a new Gaussian distribution, we would do the following:: @@ -1209,6 +1331,7 @@ else: place(output,cond0,self.vecentropy(*goodargs)+log(scale)) return output + _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) _ZETA3 = 1.202056903159594285399738161511449990765 # special.zeta(3,1) Apery's constant @@ -4208,6 +4331,8 @@ instance object for more information) loc : array-like, optional location parameter (default=0) + scale: array-like, optional + scale parameter (default=1) Returns ------- Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-05-14 15:17:12 UTC (rev 6391) +++ trunk/scipy/stats/morestats.py 2010-05-15 22:10:31 UTC (rev 6392) @@ -18,7 +18,7 @@ from numpy.testing.decorators import setastest import warnings -__all__ = ['find_repeats', +__all__ = ['find_repeats', 'describe', 'bayes_mvs', 'kstat', 'kstatvar', 'probplot', 'ppcc_max', 'ppcc_plot', 'boxcox_llf', 'boxcox', 'boxcox_normmax', 'boxcox_normplot', 'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_test', @@ -100,7 +100,7 @@ return _gauss_mvs(x, n, alpha) xbar = x.mean() C = x.var() - # mean + # mean fac = sqrt(C/(n-1)) tval = distributions.t.ppf((1+alpha)/2.0,n-1) delta = fac*tval @@ -136,6 +136,40 @@ return (mp,(ma,mb)),(vp,(va,vb)),(stp,(sta,stb)) +def describe(data): + """Describe data with distributions for mean, variance, and standard deviation + + Parameters + ---------- + data : array-like (raveled to 1-d) + + Returns + ------- + mdist : "frozen" distribution object + Distribution object representing the mean of the data + vdist : "frozen" distribution object + Distribution object representing the variance of the data + sdist : "frozen" distribution object + Distribution object representing the standard deviation of the data + """ + x = ravel(data) + n = len(x) + if (n < 2): + raise ValueError, "Need at least 2 data-points." + xbar = x.mean() + C = x.var() + if (n > 1000): # gaussian approximations for large n + mdist = distributions.norm(loc=xbar, scale=math.sqrt(C/n)) + sdist = distributions.norm(loc=math.sqrt(C), scale=math.sqrt(C/(2.*n))) + vdist = distributions.norm(loc=C, scale=math.sqrt(2.0/n)*C) + else: + nm1 = n-1 + fac = n*C/2. + val = nm1/2. + mdist = distributions.t(nm1,loc=xbar,scale=math.sqrt(C/nm1)) + sdist = distributions.gengamma(val,-2,scale=math.sqrt(fac)) + vdist = distributions.invgamma(val,scale=fac) + return mdist, vdist, sdist ################################ From scipy-svn at scipy.org Sat May 22 12:44:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 22 May 2010 11:44:37 -0500 (CDT) Subject: [Scipy-svn] r6393 - trunk/scipy/stats Message-ID: <20100522164437.2A27E39CAE7@scipy.org> Author: oliphant Date: 2010-05-22 11:44:36 -0500 (Sat, 22 May 2010) New Revision: 6393 Modified: trunk/scipy/stats/morestats.py Log: Rename function that returns distribution objects for mean, variance, and standard deviation to 'mvsdist' because there is already a 'describe' Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-05-15 22:10:31 UTC (rev 6392) +++ trunk/scipy/stats/morestats.py 2010-05-22 16:44:36 UTC (rev 6393) @@ -18,7 +18,7 @@ from numpy.testing.decorators import setastest import warnings -__all__ = ['find_repeats', 'describe', +__all__ = ['find_repeats', 'mvsdist', 'bayes_mvs', 'kstat', 'kstatvar', 'probplot', 'ppcc_max', 'ppcc_plot', 'boxcox_llf', 'boxcox', 'boxcox_normmax', 'boxcox_normplot', 'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_test', @@ -136,8 +136,8 @@ return (mp,(ma,mb)),(vp,(va,vb)),(stp,(sta,stb)) -def describe(data): - """Describe data with distributions for mean, variance, and standard deviation +def mvsdist(data): + """Return 'frozen' distributions for mean, variance, and standard deviation of data. Parameters ---------- From scipy-svn at scipy.org Sun May 23 07:35:44 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 06:35:44 -0500 (CDT) Subject: [Scipy-svn] r6394 - trunk/scipy/signal Message-ID: <20100523113544.1C73A39CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 06:35:43 -0500 (Sun, 23 May 2010) New Revision: 6394 Modified: trunk/scipy/signal/info.py Log: DOC: Update scipy.signal docstring. Modified: trunk/scipy/signal/info.py =================================================================== --- trunk/scipy/signal/info.py 2010-05-22 16:44:36 UTC (rev 6393) +++ trunk/scipy/signal/info.py 2010-05-23 11:35:43 UTC (rev 6394) @@ -4,119 +4,198 @@ Convolution: - convolve -- N-dimensional convolution. - correlate -- N-dimensional correlation. - fftconvolve -- N-dimensional convolution using the FFT. - convolve2d -- 2-dimensional convolution (more options). - correlate2d -- 2-dimensional correlation (more options). - sepfir2d -- Convolve with a 2-D separable FIR filter. + convolve: + N-dimensional convolution. + correlate: + N-dimensional correlation. + fftconvolve: + N-dimensional convolution using the FFT. + convolve2d: + 2-dimensional convolution (more options). + correlate2d: + 2-dimensional correlation (more options). + sepfir2d: + Convolve with a 2-D separable FIR filter. + B-splines: - bspline -- B-spline basis function of order n. - gauss_spline -- Gaussian approximation to the B-spline basis function. - cspline1d -- Coefficients for 1-D cubic (3rd order) B-spline. - qspline1d -- Coefficients for 1-D quadratic (2nd order) B-spline. - cspline2d -- Coefficients for 2-D cubic (3rd order) B-spline. - qspline2d -- Coefficients for 2-D quadratic (2nd order) B-spline. - spline_filter -- Smoothing spline (cubic) filtering of a rank-2 array. + bspline: + B-spline basis function of order n. + gauss_spline: + Gaussian approximation to the B-spline basis function. + cspline1d: + Coefficients for 1-D cubic (3rd order) B-spline. + qspline1d: + Coefficients for 1-D quadratic (2nd order) B-spline. + cspline2d: + Coefficients for 2-D cubic (3rd order) B-spline. + qspline2d: + Coefficients for 2-D quadratic (2nd order) B-spline. + spline_filter: + Smoothing spline (cubic) filtering of a rank-2 array. Filtering: - order_filter -- N-dimensional order filter. - medfilt -- N-dimensional median filter. - medfilt2 -- 2-dimensional median filter (faster). - wiener -- N-dimensional wiener filter. + order_filter: + N-dimensional order filter. + medfilt: + N-dimensional median filter. + medfilt2: + 2-dimensional median filter (faster). + wiener: + N-dimensional wiener filter. + symiirorder1: + 2nd-order IIR filter (cascade of first-order systems). + symiirorder2: + 4th-order IIR filter (cascade of second-order systems). + lfilter: + 1-dimensional FIR and IIR digital linear filtering. + deconvolve: + 1-d deconvolution using lfilter. + hilbert: + Compute the analytic signal of a 1-d signal. + get_window: + Create FIR window. + decimate: + Downsample a signal. + detrend: + Remove linear and/or constant trends from data. + resample: + Resample using Fourier method. - symiirorder1 -- 2nd-order IIR filter (cascade of first-order systems). - symiirorder2 -- 4th-order IIR filter (cascade of second-order systems). - lfilter -- 1-dimensional FIR and IIR digital linear filtering. - - deconvolve -- 1-d deconvolution using lfilter. - - hilbert -- Compute the analytic signal of a 1-d signal. - get_window -- Create FIR window. - - detrend -- Remove linear and/or constant trends from data. - resample -- Resample using Fourier method. - Filter design: - bilinear -- Return a digital filter from an analog filter using the bilinear transform. - firwin -- Windowed FIR filter design. - freqs -- Analog filter frequency response. - freqz -- Digital filter frequency response. - iirdesign -- IIR filter design given bands and gains. - iirfilter -- IIR filter design given order and critical frequencies. - kaiserord -- Design a Kaiser window to limit ripple and width of transition region. - remez -- Optimal FIR filter design. + bilinear: + Return a digital filter from an analog filter using the bilinear transform. + firwin: + Windowed FIR filter design. + freqs: + Analog filter frequency response. + freqz: + Digital filter frequency response. + iirdesign: + IIR filter design given bands and gains. + iirfilter: + IIR filter design given order and critical frequencies. + invres: + Inverse partial fraction expansion. + kaiserord: + Design a Kaiser window to limit ripple and width of transition region. + remez: + Optimal FIR filter design. + residue: + Partial fraction expansion of b(s) / a(s). + residuez: + Partial fraction expansion of b(z) / a(z). + unique_roots: + Unique roots and their multiplicities. - unique_roots -- Unique roots and their multiplicities. - residue -- Partial fraction expansion of b(s) / a(s). - residuez -- Partial fraction expansion of b(z) / a(z). - invres -- Inverse partial fraction expansion. - Matlab-style IIR filter design: - butter (buttord) -- Butterworth - cheby1 (cheb1ord) -- Chebyshev Type I - cheby2 (cheb2ord) -- Chebyshev Type II - ellip (ellipord) -- Elliptic (Cauer) - bessel -- Bessel (no order selection available -- try butterod) + butter (buttord): + Butterworth + cheby1 (cheb1ord): + Chebyshev Type I + cheby2 (cheb2ord): + Chebyshev Type II + ellip (ellipord): + Elliptic (Cauer) + bessel: + Bessel (no order selection available -- try butterod) Linear Systems: - lti -- linear time invariant system object. - lsim -- continuous-time simulation of output to linear system. - lsim2 -- like lsim, but `scipy.integrate.odeint` is used. - impulse -- impulse response of linear, time-invariant (LTI) system. - impulse2 -- like impulse, but `scipy.integrate.odeint` is used. - step -- step response of continous-time LTI system. - step2 -- like step, but `scipy.integrate.odeint` is used. + lti: + linear time invariant system object. + lsim: + continuous-time simulation of output to linear system. + lsim2: + like lsim, but `scipy.integrate.odeint` is used. + impulse: + impulse response of linear, time-invariant (LTI) system. + impulse2: + like impulse, but `scipy.integrate.odeint` is used. + step: + step response of continous-time LTI system. + step2: + like step, but `scipy.integrate.odeint` is used. - LTI Reresentations: + LTI Representations: - tf2zpk -- transfer function to zero-pole-gain. - zpk2tf -- zero-pole-gain to transfer function. - tf2ss -- transfer function to state-space. - ss2tf -- state-pace to transfer function. - zpk2ss -- zero-pole-gain to state-space. - ss2zpk -- state-space to pole-zero-gain. + tf2zpk: + transfer function to zero-pole-gain. + zpk2tf: + zero-pole-gain to transfer function. + tf2ss: + transfer function to state-space. + ss2tf: + state-pace to transfer function. + zpk2ss: + zero-pole-gain to state-space. + ss2zpk: + state-space to pole-zero-gain. Waveforms: - chirp -- Frequency swept cosine signal, with several frequency functions. - gausspulse -- Gaussian modulated sinusoid - sawtooth -- Periodic sawtooth - square -- Square wave - sweep_poly -- Frequency swept cosine signal; frequency is arbitrary polynomial. + sawtooth: + Periodic sawtooth + square: + Square wave + gausspulse: + Gaussian modulated sinusoid + chirp: + Frequency swept cosine signal, with several frequency functions. + sweep_poly: + Frequency swept cosine signal; frequency is arbitrary polynomial. Window functions: - get_window -- Return a window of a given length and type. - barthann -- Bartlett-Hann window - bartlett -- Bartlett window - blackman -- Blackman window - blackmanharris -- Minimum 4-term Blackman-Harris window - bohman -- Bohman window - boxcar -- Boxcar window - chebwin -- Dolph-Chebyshev window - flattop -- Flat top window - gaussian -- Gaussian window - general_gaussian -- Generalized Gaussian window - hamming -- Hamming window - hann -- Hann window - kaiser -- Kaiser window - nuttall -- Nuttall's minimum 4-term Blackman-Harris window - parzen -- Parzen window - slepian -- Slepian window - triang -- Triangular window + get_window: + Return a window of a given length and type. + barthann: + Bartlett-Hann window + bartlett: + Bartlett window + blackman: + Blackman window + blackmanharris: + Minimum 4-term Blackman-Harris window + bohman: + Bohman window + boxcar: + Boxcar window + chebwin: + Dolph-Chebyshev window + flattop: + Flat top window + gaussian: + Gaussian window + general_gaussian: + Generalized Gaussian window + hamming: + Hamming window + hann: + Hann window + kaiser: + Kaiser window + nuttall: + Nuttall's minimum 4-term Blackman-Harris window + parzen: + Parzen window + slepian: + Slepian window + triang: + Triangular window Wavelets: - daub -- return low-pass filter for daubechies wavelets - qmf -- return quadrature mirror filter from low-pass - cascade -- compute scaling function and wavelet from coefficients + daub: + return low-pass + qmf: + return quadrature mirror filter from low-pass + cascade: + compute scaling function and wavelet from coefficients """ postpone_import = 1 From scipy-svn at scipy.org Sun May 23 07:52:50 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 06:52:50 -0500 (CDT) Subject: [Scipy-svn] r6395 - trunk/scipy/signal Message-ID: <20100523115250.11AC739CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 06:52:49 -0500 (Sun, 23 May 2010) New Revision: 6395 Modified: trunk/scipy/signal/info.py Log: DOC: signal: Add a couple more functions to the docstring for scipy.signal. Modified: trunk/scipy/signal/info.py =================================================================== --- trunk/scipy/signal/info.py 2010-05-23 11:35:43 UTC (rev 6394) +++ trunk/scipy/signal/info.py 2010-05-23 11:52:49 UTC (rev 6395) @@ -51,6 +51,8 @@ 4th-order IIR filter (cascade of second-order systems). lfilter: 1-dimensional FIR and IIR digital linear filtering. + lfiltic: + Construct initial conditions for `lfilter`. deconvolve: 1-d deconvolution using lfilter. hilbert: @@ -196,6 +198,8 @@ return quadrature mirror filter from low-pass cascade: compute scaling function and wavelet from coefficients + morlet: + Complex Morlet wavelet. """ postpone_import = 1 From scipy-svn at scipy.org Sun May 23 08:10:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 07:10:22 -0500 (CDT) Subject: [Scipy-svn] r6396 - trunk/doc/source Message-ID: <20100523121022.87DB639CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 07:10:22 -0500 (Sun, 23 May 2010) New Revision: 6396 Modified: trunk/doc/source/signal.rst Log: DOC: signal.rst: Apply patch from doc editor: add a couple functions and correct a typo. Modified: trunk/doc/source/signal.rst =================================================================== --- trunk/doc/source/signal.rst 2010-05-23 11:52:49 UTC (rev 6395) +++ trunk/doc/source/signal.rst 2010-05-23 12:10:22 UTC (rev 6396) @@ -52,6 +52,7 @@ hilbert get_window + decimate detrend resample @@ -105,8 +106,8 @@ step step2 -LTI Reresentations -================== +LTI Representations +=================== .. autosummary:: :toctree: generated/ @@ -161,6 +162,7 @@ .. autosummary:: :toctree: generated/ + cascade daub + morlet qmf - cascade From scipy-svn at scipy.org Sun May 23 08:41:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 07:41:33 -0500 (CDT) Subject: [Scipy-svn] r6397 - trunk/scipy/linalg Message-ID: <20100523124133.ACBEE39CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 07:41:33 -0500 (Sun, 23 May 2010) New Revision: 6397 Modified: trunk/scipy/linalg/info.py Log: DOC: reformatted scipy.linalg docstring. Modified: trunk/scipy/linalg/info.py =================================================================== --- trunk/scipy/linalg/info.py 2010-05-23 12:10:22 UTC (rev 6396) +++ trunk/scipy/linalg/info.py 2010-05-23 12:41:33 UTC (rev 6397) @@ -1,75 +1,132 @@ """ -Linear algebra routines -======================= +Linear Algebra +============== -Linear Algebra Basics:: +Linear Algebra Basics: - inv --- Find the inverse of a square matrix - solve --- Solve a linear system of equations - solve_banded --- Solve a linear system of equations with a banded matrix - solveh_banded --- Solve a linear system of equations with a Hermitian or symmetric banded matrix, returning the Cholesky decomposition as well - det --- Find the determinant of a square matrix - norm --- matrix and vector norm - lstsq --- Solve linear least-squares problem - pinv --- Pseudo-inverse (Moore-Penrose) using lstsq - pinv2 --- Pseudo-inverse using svd + inv: + Find the inverse of a square matrix + solve: + Solve a linear system of equations + solve_banded: + Solve a linear system of equations with a banded matrix + solveh_banded: + Solve a linear system of equations with a Hermitian or symmetric + banded matrix + det: + Find the determinant of a square matrix + norm: + matrix and vector norm + lstsq: + Solve linear least-squares problem + pinv: + Pseudo-inverse (Moore-Penrose) using lstsq + pinv2: + Pseudo-inverse using svd -Eigenvalue Problem:: +Eigenvalue Problem: - eig --- Find the eigenvalues and vectors of a square matrix - eigvals --- Find the eigenvalues of a square matrix - eigh --- Find the eigenvalues and eigenvectors of a complex Hermitian or real symmetric matrix. - eigvalsh --- Find the eigenvalues of a complex Hermitian or real symmetric matrix. - eig_banded --- Find the eigenvalues and vectors of a band matrix - eigvals_banded --- Find the eigenvalues of a band matrix + eig: + Find the eigenvalues and vectors of a square matrix + eigvals: + Find the eigenvalues of a square matrix + eigh: + Find the eigenvalues and eigenvectors of a complex Hermitian or + real symmetric matrix. + eigvalsh: + Find the eigenvalues of a complex Hermitian or real symmetric + matrix. + eig_banded: + Find the eigenvalues and vectors of a band matrix + eigvals_banded: + Find the eigenvalues of a band matrix -Decompositions:: +Decompositions: - lu --- LU decomposition of a matrix - lu_factor --- LU decomposition returning unordered matrix and pivots - lu_solve --- solve Ax=b using back substitution with output of lu_factor - svd --- Singular value decomposition of a matrix - svdvals --- Singular values of a matrix - diagsvd --- construct matrix of singular values from output of svd - orth --- construct orthonormal basis for range of A using svd - cholesky --- Cholesky decomposition of a matrix - cholesky_banded --- Cholesky decomposition of a banded symmetric or Hermitian matrix - cho_factor --- Cholesky decomposition for use in solving linear system - cho_solve --- Solve previously factored linear system - cho_solve_banded --- Solve previously factored banded linear system. - qr --- QR decomposition of a matrix - schur --- Schur decomposition of a matrix - rsf2csf --- Real to complex schur form - hessenberg --- Hessenberg form of a matrix + lu: + LU decomposition of a matrix + lu_factor: + LU decomposition returning unordered matrix and pivots + lu_solve: + solve Ax=b using back substitution with output of lu_factor + svd: + Singular value decomposition of a matrix + svdvals: + Singular values of a matrix + diagsvd: + construct matrix of singular values from output of svd + orth: + construct orthonormal basis for range of A using svd + cholesky: + Cholesky decomposition of a matrix + cholesky_banded: + Cholesky decomposition of a banded symmetric or Hermitian matrix + cho_factor: + Cholesky decomposition for use in solving linear system + cho_solve: + Solve previously factored linear system + cho_solve_banded: + Solve previously factored banded linear system. + qr: + QR decomposition of a matrix + schur: + Schur decomposition of a matrix + rsf2csf: + Real to complex schur form + hessenberg: + Hessenberg form of a matrix -Matrix Functions:: +Matrix Functions: - expm --- matrix exponential using Pade approx. - expm2 --- matrix exponential using Eigenvalue decomp. - expm3 --- matrix exponential using Taylor-series expansion - logm --- matrix logarithm - cosm --- matrix cosine - sinm --- matrix sine - tanm --- matrix tangent - coshm --- matrix hyperbolic cosine - sinhm --- matrix hyperbolic sine - tanhm --- matrix hyperbolic tangent - signm --- matrix sign - sqrtm --- matrix square root - funm --- Evaluating an arbitrary matrix function. + expm: + matrix exponential using Pade approx. + expm2: + matrix exponential using Eigenvalue decomp. + expm3: + matrix exponential using Taylor-series expansion + logm: + matrix logarithm + cosm: + matrix cosine + sinm: + matrix sine + tanm: + matrix tangent + coshm: + matrix hyperbolic cosine + sinhm: + matrix hyperbolic sine + tanhm: + matrix hyperbolic tangent + signm: + matrix sign + sqrtm: + matrix square root + funm: + Evaluating an arbitrary matrix function. -Special Matrices:: +Special Matrices: - block_diag --- Construct a block diagonal matrix from submatrices. - circulant --- Circulant matrix - hadamard --- Hadamard matrix of order 2^n - hankel --- Hankel matrix - kron --- Kronecker product of two arrays. - leslie --- Leslie matrix - toeplitz --- Toeplitz matrix - tri --- Construct a matrix filled with ones at and below a given diagonal. - tril --- Construct a lower-triangular matrix from a given matrix. - triu --- Construct an upper-triangular matrix from a given matrix. + block_diag: + Construct a block diagonal matrix from submatrices. + circulant: + Circulant matrix + hadamard: + Hadamard matrix of order 2^n + hankel: + Hankel matrix + kron: + Kronecker product of two arrays. + leslie: + Leslie matrix + toeplitz: + Toeplitz matrix + tri: + Construct a matrix filled with ones at and below a given diagonal. + tril: + Construct a lower-triangular matrix from a given matrix. + triu: + Construct an upper-triangular matrix from a given matrix. """ postpone_import = 1 From scipy-svn at scipy.org Sun May 23 14:37:11 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 13:37:11 -0500 (CDT) Subject: [Scipy-svn] r6398 - trunk/scipy/linalg Message-ID: <20100523183711.AA0B239CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 13:37:11 -0500 (Sun, 23 May 2010) New Revision: 6398 Modified: trunk/scipy/linalg/special_matrices.py Log: DOC: linalg: added 'versionadded' note to the leslie matrix function Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-05-23 12:41:33 UTC (rev 6397) +++ trunk/scipy/linalg/special_matrices.py 2010-05-23 18:37:11 UTC (rev 6398) @@ -340,6 +340,10 @@ which is `f`, and the first subdiagonal, which is `s`. The data type of the array will be the data type of `f[0]+s[0]`. + Notes + ----- + .. versionadded:: 0.8.0 + Examples -------- >>> leslie([0.1, 2.0, 1.0, 0.1], [0.2, 0.8, 0.7]) From scipy-svn at scipy.org Sun May 23 16:19:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 15:19:19 -0500 (CDT) Subject: [Scipy-svn] r6399 - in trunk: doc/release doc/source scipy/linalg scipy/linalg/tests Message-ID: <20100523201919.0450739CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 15:19:17 -0500 (Sun, 23 May 2010) New Revision: 6399 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/linalg.rst trunk/scipy/linalg/info.py trunk/scipy/linalg/special_matrices.py trunk/scipy/linalg/tests/test_special_matrices.py Log: ENH: linalg: Added the function 'companion' for creating a companion matrix. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-23 18:37:11 UTC (rev 6398) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-23 20:19:17 UTC (rev 6399) @@ -108,8 +108,8 @@ New functions and other changes in scipy.linalg ----------------------------------------------- -The functions `cho_solve_banded`, `circulant`, `hadamard` and `leslie` -were added to `scipy.linalg`. +The functions `cho_solve_banded`, `circulant`, `companion`, `hadamard` and +`leslie` were added to `scipy.linalg`. The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. Modified: trunk/doc/source/linalg.rst =================================================================== --- trunk/doc/source/linalg.rst 2010-05-23 18:37:11 UTC (rev 6398) +++ trunk/doc/source/linalg.rst 2010-05-23 20:19:17 UTC (rev 6399) @@ -84,6 +84,7 @@ block_diag circulant + companion hadamard hankel kron Modified: trunk/scipy/linalg/info.py =================================================================== --- trunk/scipy/linalg/info.py 2010-05-23 18:37:11 UTC (rev 6398) +++ trunk/scipy/linalg/info.py 2010-05-23 20:19:17 UTC (rev 6399) @@ -111,6 +111,8 @@ Construct a block diagonal matrix from submatrices. circulant: Circulant matrix + companion: + Companion matrix hadamard: Hadamard matrix of order 2^n hankel: Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-05-23 18:37:11 UTC (rev 6398) +++ trunk/scipy/linalg/special_matrices.py 2010-05-23 20:19:17 UTC (rev 6399) @@ -479,3 +479,52 @@ r += rr c += cc return out + +def companion(a): + """Create a companion matrix. + + Create the companion matrix associated with the polynomial whose + coefficients are given in `a`. + + Parameters + ---------- + a : array-like, 1D + Polynomial coefficients. The length of `a` must be at least two, + and `a[0]` must not be zero. + + Returns + ------- + c : ndarray + A square ndarray with shape `(n-1, n-1)`, where `n` is the length + of `a`. The first row of `c` is `-a[1:]/a[0]`, and the first + subdiagonal is all ones. The data type of the array is the same + as the data type of `a[1]/(1.0*a[0])`. + + Notes + ----- + .. versionadded:: 0.8.0 + + Examples + -------- + >>> companion([1, -10, 31, -30]) + array([[ 10., -31., 30.], + [ 1., 0., 0.], + [ 0., 1., 0.]]) + """ + a = np.atleast_1d(a) + + if a.ndim != 1: + raise ValueError("Incorrect shape for `a`. `a` must be one-dimensional.") + + if a.size < 2: + raise ValueError("The length of `a` must be at least 2.") + + if a[0] == 0: + raise ValueError("The first coefficient in `a` must not be zero.") + + first_row = -a[1:]/(1.0*a[0]) + n = a.size + c = np.zeros((n-1, n-1), dtype=first_row.dtype) + c[0] = first_row + c[range(1,n-1), range(0, n-2)] = 1 + return c Modified: trunk/scipy/linalg/tests/test_special_matrices.py =================================================================== --- trunk/scipy/linalg/tests/test_special_matrices.py 2010-05-23 18:37:11 UTC (rev 6398) +++ trunk/scipy/linalg/tests/test_special_matrices.py 2010-05-23 20:19:17 UTC (rev 6399) @@ -4,7 +4,7 @@ from numpy.testing import * from scipy.linalg import toeplitz, hankel, circulant, hadamard, leslie, \ - tri, triu, tril, kron, block_diag + companion, tri, triu, tril, kron, block_diag def get_mat(n): @@ -190,6 +190,28 @@ assert_array_equal(a, expected) +class TestCompanion(TestCase): + + def test_bad_shapes(self): + assert_raises(ValueError, companion, [[1,1],[2,2]]) + assert_raises(ValueError, companion, [0,4,5]) + assert_raises(ValueError, companion, [1]) + assert_raises(ValueError, companion, []) + + def test_basic(self): + c = companion([1, 2, 3]) + expected = array([ + [-2.0, -3.0], + [ 1.0, 0.0]]) + assert_array_equal(c, expected) + + c = companion([2.0, 5.0, -10.0]) + expected = array([ + [-2.5, 5.0], + [ 1.0, 0.0]]) + assert_array_equal(c, expected) + + class TestBlockDiag: def test_basic(self): x = block_diag(eye(2), [[1,2], [3,4], [5,6]], [[1, 2, 3]]) From scipy-svn at scipy.org Sun May 23 16:53:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 23 May 2010 15:53:37 -0500 (CDT) Subject: [Scipy-svn] r6400 - trunk/scipy/linalg Message-ID: <20100523205337.E8BCD39CAE7@scipy.org> Author: warren.weckesser Date: 2010-05-23 15:53:37 -0500 (Sun, 23 May 2010) New Revision: 6400 Modified: trunk/scipy/linalg/special_matrices.py Log: DOC: linalg: Simplify the expression in the docstring that determines the return type of . Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-05-23 20:19:17 UTC (rev 6399) +++ trunk/scipy/linalg/special_matrices.py 2010-05-23 20:53:37 UTC (rev 6400) @@ -498,7 +498,7 @@ A square ndarray with shape `(n-1, n-1)`, where `n` is the length of `a`. The first row of `c` is `-a[1:]/a[0]`, and the first subdiagonal is all ones. The data type of the array is the same - as the data type of `a[1]/(1.0*a[0])`. + as the data type of `1.0*a[0]`. Notes ----- From scipy-svn at scipy.org Mon May 24 09:09:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:09:36 -0500 (CDT) Subject: [Scipy-svn] r6401 - trunk/scipy/integrate Message-ID: <20100524130936.BC6EA39CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:09:36 -0500 (Mon, 24 May 2010) New Revision: 6401 Modified: trunk/scipy/integrate/quadpack.py trunk/scipy/integrate/quadrature.py Log: DOC: merge wiki edits - integrate module. Modified: trunk/scipy/integrate/quadpack.py =================================================================== --- trunk/scipy/integrate/quadpack.py 2010-05-23 20:53:37 UTC (rev 6400) +++ trunk/scipy/integrate/quadpack.py 2010-05-24 13:09:36 UTC (rev 6401) @@ -9,6 +9,20 @@ error = _quadpack.error def quad_explain(output=sys.stdout): + """ + Print extra information about integrate.quad() parameters and returns. + + Parameters + ---------- + output : instance with "write" method + Information about `quad` is passed to ``output.write()``. + Default is ``sys.stdout``. + + Returns + ------- + None + + """ output.write(""" Extra information for quad() inputs and outputs: @@ -119,86 +133,95 @@ limit=50, points=None, weight=None, wvar=None, wopts=None, maxp1=50, limlst=50): """ - quad(func, a, b, args=(), full_output=0, epsabs=1.4899999999999999e-08, epsrel=1.4899999999999999e-08, limit=50, points=None, weight=None, wvar=None, wopts=None, maxp1=50, limlst=50) - Compute a definite integral. Integrate func from a to b (possibly infinite interval) using a technique from the Fortran library QUADPACK. + If func takes many arguments, it is integrated along the axis corresponding + to the first argument. Use the keyword argument `args` to pass the other + arguments. + Run scipy.integrate.quad_explain() for more information on the more esoteric inputs and outputs. Parameters - ----------- - func : function - a Python function or method to integrate. - a : float - lower limit of integration (use -scipy.integrate.Inf for -infinity). - b : float - upper limit of integration (use scipy.integrate.Inf for +infinity). - full_output : - non-zero to return a dictionary of integration information. - If non-zero, warning messages are also suppressed and the - message is appended to the output tuple. + ---------- + func : function + A Python function or method to integrate. + a : float + Lower limit of integration (use -scipy.integrate.Inf for -infinity). + b : float + Upper limit of integration (use scipy.integrate.Inf for +infinity). + args : tuple, optional + extra arguments to pass to func + full_output : int + Non-zero to return a dictionary of integration information. + If non-zero, warning messages are also suppressed and the + message is appended to the output tuple. + Returns - ----------- + ------- - y : float - the integral of func from a to b. - abserr : float - an estimate of the absolute error in the result. + y : float + The integral of func from a to b. + abserr : float + an estimate of the absolute error in the result. - infodict : dict - a dictionary containing additional information. - Run scipy.integrate.quad_explain() for more information. - message : - a convergence message. - explain : - appended only with 'cos' or 'sin' weighting and infinite - integration limits, it contains an explanation of the codes in - infodict['ierlst'] + infodict : dict + a dictionary containing additional information. + Run scipy.integrate.quad_explain() for more information. + message : + a convergence message. + explain : + appended only with 'cos' or 'sin' weighting and infinite + integration limits, it contains an explanation of the codes in + infodict['ierlst'] Other Parameters ---------------- - epsabs : - absolute error tolerance. - epsrel : - relative error tolerance. - limit : - an upper bound on the number of subintervals used in the adaptive - algorithm. - points : - a sequence of break points in the bounded integration interval - where local difficulties of the integrand may occur (e.g., - singularities, discontinuities). The sequence does not have - to be sorted. + epsabs : + absolute error tolerance. + epsrel : + relative error tolerance. + limit : + an upper bound on the number of subintervals used in the adaptive + algorithm. + points : + a sequence of break points in the bounded integration interval + where local difficulties of the integrand may occur (e.g., + singularities, discontinuities). The sequence does not have + to be sorted. + weight : + string indicating weighting function. + wvar : + variables for use with weighting functions. + limlst : + Upper bound on the number of cylces (>=3) for use with a sinusoidal + weighting and an infinite end-point. + wopts : + Optional input for reusing Chebyshev moments. + maxp1 : + An upper bound on the number of Chebyshev moments. - ** - ** Run scipy.integrate.quad_explain() for more information - ** on the following inputs - ** - weight : - string indicating weighting function. - wvar : - variables for use with weighting functions. - limlst : - Upper bound on the number of cylces (>=3) for use with a sinusoidal - weighting and an infinite end-point. - wopts : - Optional input for reusing Chebyshev moments. - maxp1 : - An upper bound on the number of Chebyshev moments. + See Also + -------- + dblquad, tplquad - double and triple integrals + fixed_quad - fixed-order Gaussian quadrature + quadrature - adaptive Gaussian quadrature + odeint, ode - ODE integrators + simps, trapz, romb - integrators for sampled data + scipy.special - for coefficients and roots of orthogonal polynomials - Examples -------- Calculate :math:`\\int^4_0 x^2 dx` and compare with an analytic result + >>> from scipy import integrate >>> x2 = lambda x: x**2 - >>> quad(x,0.,4.) + >>> integrate.quad(x,0.,4.) (21.333333333333332, 2.3684757858670003e-13) >> print 4.**3/3 21.3333333333 @@ -206,17 +229,17 @@ Calculate :math:`\\int^\\infty_0 e^{-x} dx` >>> invexp = lambda x: exp(-x) - >>> quad(invexp,0,inf) + >>> integrate.quad(invexp,0,inf) (0.99999999999999989, 5.8426061711142159e-11) - See also: - dblquad, tplquad - double and triple integrals - fixed_quad - fixed-order Gaussian quadrature - quadrature - adaptive Gaussian quadrature - odeint, ode - ODE integrators - simps, trapz, romb - integrators for sampled data - scipy.special - for coefficients and roots of orthogonal polynomials + >>> f = lambda x,a : a*x + >>> y, err = integrate.quad(f, 0, 1, args=(1,)) + >>> y + 0.5 + >>> y, err = integrate.quad(f, 0, 1, args=(3,)) + >>> y + 1.5 """ if type(args) != type(()): args = (args,) @@ -410,50 +433,51 @@ Return the triple integral of func3d(z, y,x) from x=a..b, y=gfun(x)..hfun(x), and z=qfun(x,y)..rfun(x,y) - Parameters - ----------- - func3d : function - a Python function or method of at least three variables in the - order (z, y, x). - (a,b) : tuple - the limits of integration in x: a < b - gfun : function - the lower boundary curve in y which is a function taking a single - floating point argument (x) and returning a floating point result: - a lambda function can be useful here. - hfun : function - the upper boundary curve in y (same requirements as gfun). - qfun : function - the lower boundary surface in z. It must be a function that takes - two floats in the order (x, y) and returns a float. - rfun : function - the upper boundary surface in z. (Same requirements as qfun.) - args : - extra arguments to pass to func3d. - epsabs : float - absolute tolerance passed directly to the innermost 1-D quadrature - integration. - epsrel : float - relative tolerance of the innermost 1-D integrals. + ---------- + func3d : function + A Python function or method of at least three variables in the + order (z, y, x). + (a,b) : tuple + The limits of integration in x: a < b + gfun : function + The lower boundary curve in y which is a function taking a single + floating point argument (x) and returning a floating point result: + a lambda function can be useful here. + hfun : function + The upper boundary curve in y (same requirements as gfun). + qfun : function + The lower boundary surface in z. It must be a function that takes + two floats in the order (x, y) and returns a float. + rfun : function + The upper boundary surface in z. (Same requirements as qfun.) + args : Arguments + Extra arguments to pass to func3d. + epsabs : float + Absolute tolerance passed directly to the innermost 1-D quadrature + integration. + epsrel : float + Relative tolerance of the innermost 1-D integrals. - Returns - ----------- + ------- + y : float + The resultant integral. + abserr : float + An estimate of the error. - y : float - the resultant integral. - abserr : float - an estimate of the error. + See Also + -------- + quad: Adaptive quadrature using QUADPACK + quadrature: Adaptive Gaussian quadrature + fixed_quad: Fixed-order Gaussian quadrature + dblquad: Double integrals + romb: Integrators for sampled data + trapz: Integrators for sampled data + simps: Integrators for sampled data + ode: ODE integrators + odeint: ODE integrators + scipy.special: For coefficients and roots of orthogonal polynomials - See also: - quad - single integral - dblquad - double integral - fixed_quad - fixed-order Gaussian quadrature - quadrature - adaptive Gaussian quadrature - odeint, ode - ODE integrators - simps, trapz, romb - integrators for sampled data - scipy.special - for coefficients and roots of orthogonal polynomials - """ return dblquad(_infunc2,a,b,gfun,hfun,(func,qfun,rfun,args),epsabs=epsabs,epsrel=epsrel) Modified: trunk/scipy/integrate/quadrature.py =================================================================== --- trunk/scipy/integrate/quadrature.py 2010-05-23 20:53:37 UTC (rev 6400) +++ trunk/scipy/integrate/quadrature.py 2010-05-24 13:09:36 UTC (rev 6401) @@ -10,34 +10,39 @@ import math def fixed_quad(func,a,b,args=(),n=5): - """Compute a definite integral using fixed-order Gaussian quadrature. + """ + Compute a definite integral using fixed-order Gaussian quadrature. - Description: + Integrate `func` from a to b using Gaussian quadrature of order n. - Integrate func from a to b using Gaussian quadrature of order n. + Parameters + ---------- + func : callable + A Python function or method to integrate (must accept vector inputs). + a : float + Lower limit of integration. + b : float + Upper limit of integration. + args : tuple, optional + Extra arguments to pass to function, if any. + n : int, optional + Order of quadrature integration. Default is 5. - Inputs: + Returns + ------- + val : float + Gaussian quadrature approximation to the integral - func -- a Python function or method to integrate - (must accept vector inputs) - a -- lower limit of integration - b -- upper limit of integration - args -- extra arguments to pass to function. - n -- order of quadrature integration. + See Also + -------- + quad : adaptive quadrature using QUADPACK + dblquad, tplquad : double and triple integrals + romberg : adaptive Romberg quadrature + quadrature : adaptive Gaussian quadrature + romb, simps, trapz : integrators for sampled data + cumtrapz : cumulative integration for sampled data + ode, odeint - ODE integrators - Outputs: (val, None) - - val -- Gaussian quadrature approximation to the integral. - - See also: - - quad - adaptive quadrature using QUADPACK - dblquad, tplquad - double and triple integrals - romberg - adaptive Romberg quadrature - quadrature - adaptive Gaussian quadrature - romb, simps, trapz - integrators for sampled data - cumtrapz - cumulative integration for sampled data - ode, odeint - ODE integrators """ [x,w] = p_roots(n) x = real(x) @@ -95,39 +100,52 @@ return vfunc def quadrature(func,a,b,args=(),tol=1.49e-8,maxiter=50, vec_func=True): - """Compute a definite integral using fixed-tolerance Gaussian quadrature. + """ + Compute a definite integral using fixed-tolerance Gaussian quadrature. - Description: - Integrate func from a to b using Gaussian quadrature - with absolute tolerance tol. + with absolute tolerance `tol`. - Inputs: + Parameters + ---------- + func : function + A Python function or method to integrate. + a : float + Lower limit of integration. + b : float + Upper limit of integration. + args : tuple, optional + Extra arguments to pass to function. + tol : float, optional + Iteration stops when error between last two iterates is less than + tolerance. + maxiter : int, optional + Maximum number of iterations. + vec_func : bool, optional + True or False if func handles arrays as arguments (is + a "vector" function). Default is True. - func -- a Python function or method to integrate. - a -- lower limit of integration. - b -- upper limit of integration. - args -- extra arguments to pass to function. - tol -- iteration stops when error between last two iterates is less than - tolerance. - maxiter -- maximum number of iterations. - vec_func -- True or False if func handles arrays as arguments (is - a "vector" function ). Default is True. + Returns + ------- + val : float + Gaussian quadrature approximation (within tolerance) to integral. + err : float + Difference between last two estimates of the integral. - Outputs: (val, err) + See also + -------- + romberg: adaptive Romberg quadrature + fixed_quad: fixed-order Gaussian quadrature + quad: adaptive quadrature using QUADPACK + dblquad: double integrals + tplquad: triple integrals + romb: integrator for sampled data + simps: integrator for sampled data + trapz: integrator for sampled data + cumtrapz: cumulative integration for sampled data + ode: ODE integrator + odeint: ODE integrator - val -- Gaussian quadrature approximation (within tolerance) to integral. - err -- Difference between last two estimates of the integral. - - See also: - - romberg - adaptive Romberg quadrature - fixed_quad - fixed-order Gaussian quadrature - quad - adaptive quadrature using QUADPACK - dblquad, tplquad - double and triple integrals - romb, simps, trapz - integrators for sampled data - cumtrapz - cumulative integration for sampled data - ode, odeint - ODE integrators """ err = 100.0 val = err @@ -148,20 +166,41 @@ return tuple(l) def cumtrapz(y, x=None, dx=1.0, axis=-1): - """Cumulatively integrate y(x) using samples along the given axis + """ + Cumulatively integrate y(x) using samples along the given axis and the composite trapezoidal rule. If x is None, spacing given by dx is assumed. - See also: + Parameters + ---------- + y : array - quad - adaptive quadrature using QUADPACK - romberg - adaptive Romberg quadrature - quadrature - adaptive Gaussian quadrature - fixed_quad - fixed-order Gaussian quadrature - dblquad, tplquad - double and triple integrals - romb, trapz - integrators for sampled data - cumtrapz - cumulative integration for sampled data - ode, odeint - ODE integrators + x : array, optional + + dx : int, optional + + axis : int, optional + Specifies the axis to cumulate: + + - -1 --> X axis + - 0 --> Z axis + - 1 --> Y axis + + See Also + -------- + + quad: adaptive quadrature using QUADPACK + romberg: adaptive Romberg quadrature + quadrature: adaptive Gaussian quadrature + fixed_quad: fixed-order Gaussian quadrature + dblquad: double integrals + tplquad: triple integrals + romb: integrators for sampled data + trapz: integrators for sampled data + cumtrapz: cumulative integration for sampled data + ode: ODE integrators + odeint: ODE integrators + """ y = asarray(y) if x is None: @@ -204,39 +243,57 @@ def simps(y, x=None, dx=1, axis=-1, even='avg'): - """Integrate y(x) using samples along the given axis and the composite + """ + Integrate y(x) using samples along the given axis and the composite Simpson's rule. If x is None, spacing of dx is assumed. If there are an even number of samples, N, then there are an odd number of intervals (N-1), but Simpson's rule requires an even number - of intervals. The parameter 'even' controls how this is handled as - follows: + of intervals. The parameter 'even' controls how this is handled. - even='avg': Average two results: 1) use the first N-2 intervals with - a trapezoidal rule on the last interval and 2) use the last - N-2 intervals with a trapezoidal rule on the first interval + Parameters + ---------- + y : array_like + Array to be integrated. + x : array_like, optional + If given, the points at which `y` is sampled. + dx : int, optional + Spacing of integration points along axis of `y`. Only used when + `x` is None. Default is 1. + axis : int, optional + Axis along which to integrate. Default is the last axis. + even : {'avg', 'first', 'str'}, optional + 'avg' : Average two results:1) use the first N-2 intervals with + a trapezoidal rule on the last interval and 2) use the last + N-2 intervals with a trapezoidal rule on the first interval. - even='first': Use Simpson's rule for the first N-2 intervals with - a trapezoidal rule on the last interval. + 'first' : Use Simpson's rule for the first N-2 intervals with + a trapezoidal rule on the last interval. - even='last': Use Simpson's rule for the last N-2 intervals with a - trapezoidal rule on the first interval. + 'last' : Use Simpson's rule for the last N-2 intervals with a + trapezoidal rule on the first interval. + See Also + -------- + quad: adaptive quadrature using QUADPACK + romberg: adaptive Romberg quadrature + quadrature: adaptive Gaussian quadrature + fixed_quad: fixed-order Gaussian quadrature + dblquad: double integrals + tplquad: triple integrals + romb: integrators for sampled data + trapz: integrators for sampled data + cumtrapz: cumulative integration for sampled data + ode: ODE integrators + odeint: ODE integrators + + Notes + ----- For an odd number of samples that are equally spaced the result is - exact if the function is a polynomial of order 3 or less. If - the samples are not equally spaced, then the result is exact only - if the function is a polynomial of order 2 or less. + exact if the function is a polynomial of order 3 or less. If + the samples are not equally spaced, then the result is exact only + if the function is a polynomial of order 2 or less. - See also: - - quad - adaptive quadrature using QUADPACK - romberg - adaptive Romberg quadrature - quadrature - adaptive Gaussian quadrature - fixed_quad - fixed-order Gaussian quadrature - dblquad, tplquad - double and triple integrals - romb, trapz - integrators for sampled data - cumtrapz - cumulative integration for sampled data - ode, odeint - ODE integrators """ y = asarray(y) nd = len(y.shape) @@ -293,21 +350,31 @@ return result def romb(y, dx=1.0, axis=-1, show=False): - """Romberg integration using samples of a function + """ + Romberg integration using samples of a function - Inputs: + Parameters + ----------- + y : array like + a vector of 2**k + 1 equally-spaced samples of a function - y - a vector of 2**k + 1 equally-spaced samples of a fucntion - dx - the sample spacing. - axis - the axis along which to integrate - show - When y is a single 1-d array, then if this argument is True - print the table showing Richardson extrapolation from the - samples. + dx : array like + the sample spacing. - Output: ret + axis : array like? + the axis along which to integrate - ret - The integrated result for each axis. + show : Boolean + When y is a single 1-d array, then if this argument is True + print the table showing Richardson extrapolation from the + samples. + Returns + ----------- + + ret : array_like? + The integrated result for each axis. + See also: quad - adaptive quadrature using QUADPACK @@ -318,6 +385,7 @@ simps, trapz - integrators for sampled data cumtrapz - cumulative integration for sampled data ode, odeint - ODE integrators + """ y = asarray(y) nd = len(y.shape) @@ -603,35 +671,46 @@ } def newton_cotes(rn,equal=0): - r"""Return weights and error coefficient for Netwon-Cotes integration. + """ + Return weights and error coefficient for Newton-Cotes integration. - Suppose we have (N+1) samples of f at the positions - x_0, x_1, ..., x_N. Then an N-point Newton-Cotes formula for the - integral between x_0 and x_N is: + Suppose we have (N+1) samples of f at the positions + x_0, x_1, ..., x_N. Then an N-point Newton-Cotes formula for the + integral between x_0 and x_N is: - $\int_{x_0}^{x_N} f(x)dx = \Delta x \sum_{i=0}^{N} a_i f(x_i) - + B_N (\Delta x)^{N+2} f^{N+1} (\xi)$ + :math:`\\int_{x_0}^{x_N} f(x)dx = \\Delta x \\sum_{i=0}^{N} a_i f(x_i) + + B_N (\\Delta x)^{N+2} f^{N+1} (\\xi)` - where $\xi \in [x_0,x_N]$ and $\Delta x = \frac{x_N-x_0}{N}$ is the - averages samples spacing. + where :math:`\\xi \\in [x_0,x_N]` and :math:`\\Delta x = \\frac{x_N-x_0}{N}` + is the averages samples spacing. - If the samples are equally-spaced and N is even, then the error - term is $B_N (\Delta x)^{N+3} f^{N+2}(\xi)$. + If the samples are equally-spaced and N is even, then the error + term is :math:`B_N (\\Delta x)^{N+3} f^{N+2}(\\xi)`. - Normally, the Newton-Cotes rules are used on smaller integration - regions and a composite rule is used to return the total integral. + Parameters + ---------- - Inputs: - rn -- the integer order for equally-spaced data - or the relative positions of the samples with - the first sample at 0 and the last at N, where - N+1 is the length of rn. N is the order of the Newt - equal -- Set to 1 to enforce equally spaced data + rn : int + The integer order for equally-spaced data + or the relative positions of the samples with + the first sample at 0 and the last at N, where + N+1 is the length of rn. N is the order of the Newton + equal: int, optional + Set to 1 to enforce equally spaced data - Outputs: - an -- 1-d array of weights to apply to the function at - the provided sample positions. - B -- error coefficient + Returns + ------- + an : array + 1-d array of weights to apply to the function at + the provided sample positions. + B : float + error coefficient + + Notes + ----- + Normally, the Newton-Cotes rules are used on smaller integration + regions and a composite rule is used to return the total integral. + """ try: N = len(rn)-1 From scipy-svn at scipy.org Mon May 24 09:09:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:09:52 -0500 (CDT) Subject: [Scipy-svn] r6402 - trunk/scipy/interpolate Message-ID: <20100524130952.C037939CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:09:52 -0500 (Mon, 24 May 2010) New Revision: 6402 Modified: trunk/scipy/interpolate/fitpack.py trunk/scipy/interpolate/fitpack2.py trunk/scipy/interpolate/polyint.py Log: DOC: merge wiki edits - interpolate module. Modified: trunk/scipy/interpolate/fitpack.py =================================================================== --- trunk/scipy/interpolate/fitpack.py 2010-05-24 13:09:36 UTC (rev 6401) +++ trunk/scipy/interpolate/fitpack.py 2010-05-24 13:09:52 UTC (rev 6402) @@ -432,43 +432,45 @@ #return l[0] def splev(x,tck,der=0): - """Evaulate a B-spline and its derivatives. + """ + Evaluate a B-spline and its derivatives. - Description: + Given the knots and coefficients of a B-spline representation, evaluate + the value of the smoothing polynomial and it's derivatives. + This is a wrapper around the FORTRAN routines splev and splder of FITPACK. - Given the knots and coefficients of a B-spline representation, evaluate - the value of the smoothing polynomial and it's derivatives. - This is a wrapper around the FORTRAN routines splev and splder of FITPACK. + Parameters + ---------- + x (u) -- a 1-D array of points at which to return the value of the + smoothed spline or its derivatives. If tck was returned from + splprep, then the parameter values, u should be given. + tck -- A sequence of length 3 returned by splrep or splprep containg the + knots, coefficients, and degree of the spline. + der -- The order of derivative of the spline to compute (must be less than + or equal to k). - Inputs: + Returns + ------- + y -- an array of values representing the spline function or curve. + If tck was returned from splrep, then this is a list of arrays + representing the curve in N-dimensional space. - x (u) -- a 1-D array of points at which to return the value of the - smoothed spline or its derivatives. If tck was returned from - splprep, then the parameter values, u should be given. - tck -- A sequence of length 3 returned by splrep or splprep containg the - knots, coefficients, and degree of the spline. - der -- The order of derivative of the spline to compute (must be less than - or equal to k). + See Also + -------- + splprep, splrep, sproot, spalde, splint : evaluation, roots, integral + bisplrep, bisplev : bivariate splines + UnivariateSpline, BivariateSpline : + An alternative wrapping of the FITPACK functions. - Outputs: (y, ) + References + ---------- + .. [1] C. de Boor, "On calculating with b-splines", J. Approximation + Theory, 6, p.50-62, 1972. + .. [2] M.G. Cox, "The numerical evaluation of b-splines", J. Inst. Maths + Applics, 10, p.134-149, 1972. + .. [3] P. Dierckx, "Curve and surface fitting with splines", Monographs + on Numerical Analysis, Oxford University Press, 1993. - y -- an array of values representing the spline function or curve. - If tck was returned from splrep, then this is a list of arrays - representing the curve in N-dimensional space. - - See also: - splprep, splrep, sproot, spalde, splint - evaluation, roots, integral - bisplrep, bisplev - bivariate splines - UnivariateSpline, BivariateSpline - an alternative wrapping - of the FITPACK functions - - Notes: - de Boor C : On calculating with b-splines, J. Approximation Theory - 6 (1972) 50-62. - Cox M.G. : The numerical evaluation of b-splines, J. Inst. Maths - Applics 10 (1972) 134-149. - Dierckx P. : Curve and surface fitting with splines, Monographs on - Numerical Analysis, Oxford University Press, 1993. """ t,c,k=tck try: @@ -489,37 +491,39 @@ return y[0] def splint(a,b,tck,full_output=0): - """Evaluate the definite integral of a B-spline. + """ + Evaluate the definite integral of a B-spline. - Description: + Given the knots and coefficients of a B-spline, evaluate the definite + integral of the smoothing polynomial between two given points. - Given the knots and coefficients of a B-spline, evaluate the definite - integral of the smoothing polynomial between two given points. + Parameters + ---------- + a, b -- The end-points of the integration interval. + tck -- A length 3 sequence describing the given spline (See splev). + full_output -- Non-zero to return optional output. - Inputs: + Returns + ------- + integral -- The resulting integral. - a, b -- The end-points of the integration interval. - tck -- A length 3 sequence describing the given spline (See splev). - full_output -- Non-zero to return optional output. + wrk -- An array containing the integrals of the + normalized B-splines defined on the set of knots. - Outputs: (integral, {wrk}) + See Also + -------- + splprep, splrep, sproot, spalde, splev : evaluation, roots, integral + bisplrep, bisplev : bivariate splines + UnivariateSpline, BivariateSpline : + An alternative wrapping of the FITPACK functions. - integral -- The resulting integral. - wrk -- An array containing the integrals of the normalized B-splines defined - on the set of knots. + References + ---------- + .. [1] P.W. Gaffney, The calculation of indefinite integrals of b-splines", + J. Inst. Maths Applics, 17, p.37-41, 1976. + .. [2] P. Dierckx, "Curve and surface fitting with splines", Monographs + on Numerical Analysis, Oxford University Press, 1993. - - See also: - splprep, splrep, sproot, spalde, splev - evaluation, roots, integral - bisplrep, bisplev - bivariate splines - UnivariateSpline, BivariateSpline - an alternative wrapping - of the FITPACK functions - - Notes: - Gaffney P.W. : The calculation of indefinite integrals of b-splines - J. Inst. Maths Applics 17 (1976) 37-41. - Dierckx P. : Curve and surface fitting with splines, Monographs on - Numerical Analysis, Oxford University Press, 1993. """ t,c,k=tck try: @@ -535,30 +539,45 @@ else: return aint def sproot(tck,mest=10): - """Find the roots of a cubic B-spline. + """ + Find the roots of a cubic B-spline. - Description: + Given the knots (>=8) and coefficients of a cubic B-spline return the + roots of the spline. - Given the knots (>=8) and coefficients of a cubic B-spline return the - roots of the spline. + Parameters + ---------- - Inputs: + tck -- A length 3 sequence describing the given spline (See splev). + The number of knots must be >= 8. The knots must be a montonically + increasing sequence. - tck -- A length 3 sequence describing the given spline (See splev). - The number of knots must be >= 8. The knots must be a montonically - increasing sequence. - mest -- An estimate of the number of zeros (Default is 10). + mest -- An estimate of the number of zeros (Default is 10) - Outputs: (zeros, ) - zeros -- An array giving the roots of the spline. + Returns + ------- - See also: - splprep, splrep, splint, spalde, splev - evaluation, roots, integral - bisplrep, bisplev - bivariate splines - UnivariateSpline, BivariateSpline - an alternative wrapping - of the FITPACK functions + zeros -- An array giving the roots of the spline. + See also + -------- + splprep, splrep, splint, spalde, splev : + evaluation, roots, integral + bisplrep, bisplev : + bivariate splines + UnivariateSpline, BivariateSpline : + An alternative wrapping of the FITPACK functions. + + References + ---------- + .. [1] C. de Boor, "On calculating with b-splines", J. Approximation + Theory, 6, p.50-62, 1972. + .. [2] M.G. Cox, "The numerical evaluation of b-splines", J. Inst. Maths + Applics, 10, p.134-149, 1972. + .. [3] P. Dierckx, "Curve and surface fitting with splines", Monographs + on Numerical Analysis, Oxford University Press, 1993. + """ t,c,k=tck if k==4: t=t[1:-1] @@ -868,40 +887,49 @@ return dfitpack.dblint(tx,ty,c,kx,ky,xb,xe,yb,ye) def insert(x,tck,m=1,per=0): - """Insert knots into a B-spline. + """ + Insert knots into a B-spline. - Description: + Given the knots and coefficients of a B-spline representation, create a + new B-spline with a knot inserted m times at point x. + This is a wrapper around the FORTRAN routine insert of FITPACK. - Given the knots and coefficients of a B-spline representation, create a - new B-spline with a knot inserted m times at point x. - This is a wrapper around the FORTRAN routine insert of FITPACK. + Parameters + ---------- - Inputs: + x (u) -- A 1-D point at which to insert a new knot(s). If tck was returned + from splprep, then the parameter values, u should be given. + tck -- A sequence of length 3 returned by splrep or splprep containg the + knots, coefficients, and degree of the spline. - x (u) -- A 1-D point at which to insert a new knot(s). If tck was returned - from splprep, then the parameter values, u should be given. - tck -- A sequence of length 3 returned by splrep or splprep containg the - knots, coefficients, and degree of the spline. - m -- The number of times to insert the given knot (its multiplicity). - per -- If non-zero, input spline is considered periodic. + m -- The number of times to insert the given knot (its multiplicity). - Outputs: tck + per -- If non-zero, input spline is considered periodic. - tck -- (t,c,k) a tuple containing the vector of knots, the B-spline + Returns + ------- + + tck -- (t,c,k) a tuple containing the vector of knots, the B-spline coefficients, and the degree of the new spline. - Requirements: - t(k+1) <= x <= t(n-k), where k is the degree of the spline. - In case of a periodic spline (per != 0) there must be - either at least k interior knots t(j) satisfying t(k+1)>> from numpy import linspace,exp + >>> from numpy.random import randn + >>> from scipy.interpolate import UnivariateSpline + >>> x = linspace(-3,3,100) + >>> y = exp(-x**2) + randn(100)/10 + >>> s = UnivariateSpline(x,y,s=1) + >>> xs = linspace(-3,3,1000) + >>> ys = s(xs) + + xs,ys is now a smoothed, super-sampled version of the noisy gaussian x,y + """ def __init__(self, x, y, w=None, bbox = [None]*2, k=3, s=None): @@ -231,9 +262,53 @@ 'finding roots unsupported for non-cubic splines' class InterpolatedUnivariateSpline(UnivariateSpline): - """ Interpolated univariate spline approximation. Identical to - UnivariateSpline with less error checking. + """ + One-dimensional interpolating spline for a given set of data points. + Fits a spline y=s(x) of degree `k` to the provided `x`,`y` data. Spline + function passes through all provided points. Equivalent to + `UnivariateSpline` with s=0. + + Parameters + ---------- + x : sequence + input dimension of data points -- must be increasing + y : sequence + input dimension of data points + w : sequence or None, optional + weights for spline fitting. Must be positive. If None (default), + weights are all equal. + bbox : sequence or None, optional + 2-sequence specifying the boundary of the approximation interval. If + None (default), bbox=[x[0],x[-1]]. + k : int, optional + Degree of the smoothing spline. Must be <= 5. + + + See Also + -------- + UnivariateSpline : Superclass -- allows knots to be selected by a + smoothing condition + LSQUnivariateSpline : spline for which knots are user-selected + splrep : An older, non object-oriented wrapping of FITPACK + splev, sproot, splint, spalde + BivariateSpline : A similar class for two-dimensional spline interpolation + + + + Examples + -------- + >>> from numpy import linspace,exp + >>> from numpy.random import randn + >>> from scipy.interpolate import UnivariateSpline + >>> x = linspace(-3,3,100) + >>> y = exp(-x**2) + randn(100)/10 + >>> s = UnivariateSpline(x,y,s=1) + >>> xs = linspace(-3,3,1000) + >>> ys = s(xs) + + xs,ys is now a smoothed, super-sampled version of the noisy gaussian x,y + """ def __init__(self, x, y, w=None, bbox = [None]*2, k=3): @@ -255,10 +330,62 @@ self._reset_class() class LSQUnivariateSpline(UnivariateSpline): - """ Weighted least-squares univariate spline - approximation. Appears to be identical to UnivariateSpline with - more error checking. + """ + One-dimensional spline with explicit internal knots. + Fits a spline y=s(x) of degree `k` to the provided `x`,`y` data. `t` + specifies the internal knots of the spline + + Parameters + ---------- + x : sequence + input dimension of data points -- must be increasing + y : sequence + input dimension of data points + t: sequence + interior knots of the spline. Must be in ascending order + and bbox[0]>> from numpy import linspace,exp + >>> from numpy.random import randn + >>> from scipy.interpolate import LSQUnivariateSpline + >>> x = linspace(-3,3,100) + >>> y = exp(-x**2) + randn(100)/10 + >>> t = [-1,0,1] + >>> s = LSQUnivariateSpline(x,y,t) + >>> xs = linspace(-3,3,1000) + >>> ys = s(xs) + + xs,ys is now a smoothed, super-sampled version of the noisy gaussian x,y + with knots [-3,-1,0,1,3] + """ def __init__(self, x, y, t, w=None, bbox = [None]*2, k=3): Modified: trunk/scipy/interpolate/polyint.py =================================================================== --- trunk/scipy/interpolate/polyint.py 2010-05-24 13:09:36 UTC (rev 6401) +++ trunk/scipy/interpolate/polyint.py 2010-05-24 13:09:52 UTC (rev 6402) @@ -4,7 +4,8 @@ __all__ = ["KroghInterpolator", "krogh_interpolate", "BarycentricInterpolator", "barycentric_interpolate", "PiecewisePolynomial", "piecewise_polynomial_interpolate","approximate_taylor_polynomial", "pchip"] class KroghInterpolator(object): - """The interpolating polynomial for a set of points + """ + The interpolating polynomial for a set of points Constructs a polynomial that passes through a given set of points, optionally with specified derivatives at those points. @@ -22,8 +23,22 @@ x values, degrees higher than about thirty cause problems with numerical instability in this code. - Based on Krogh 1970, "Efficient Algorithms for Polynomial Interpolation - and Numerical Differentiation" + Based on [1]_. + + Parameters + ---------- + xi : array-like, length N + Known x-coordinates + yi : array-like, N by R + Known y-coordinates, interpreted as vectors of length R, + or scalars if R=1. When an xi occurs two or more times in + a row, the corresponding yi's represent derivative values. + + References + ---------- + .. [1] Krogh, "Efficient Algorithms for Polynomial Interpolation + and Numerical Differentiation", 1970. + """ def __init__(self, xi, yi): """Construct an interpolator passing through the specified points @@ -311,9 +326,9 @@ def approximate_taylor_polynomial(f,x,degree,scale,order=None): - """Estimate the Taylor polynomial of f at x by polynomial fitting + """ + Estimate the Taylor polynomial of f at x by polynomial fitting. - A polynomial Parameters ---------- f : callable @@ -321,32 +336,33 @@ a vector of x values. x : scalar The point at which the polynomial is to be evaluated. - degree : integer + degree : int The degree of the Taylor polynomial scale : scalar The width of the interval to use to evaluate the Taylor polynomial. Function values spread over a range this wide are used to fit the polynomial. Must be chosen carefully. - order : integer or None + order : int or None The order of the polynomial to be used in the fitting; f will be - evaluated order+1 times. If None, use degree. + evaluated ``order+1`` times. If None, use `degree`. Returns ------- - p : poly1d - the Taylor polynomial (translated to the origin, so that + p : poly1d instance + The Taylor polynomial (translated to the origin, so that for example p(0)=f(x)). Notes ----- - The appropriate choice of "scale" is a tradeoff - too large and the + The appropriate choice of "scale" is a trade-off; too large and the function differs from its Taylor polynomial too much to get a good - answer, too small and roundoff errors overwhelm the higher-order terms. + answer, too small and round-off errors overwhelm the higher-order terms. The algorithm used becomes numerically unstable around order 30 even under ideal circumstances. Choosing order somewhat larger than degree may improve the higher-order terms. + """ if order is None: order=degree From scipy-svn at scipy.org Mon May 24 09:10:10 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:10:10 -0500 (CDT) Subject: [Scipy-svn] r6403 - in trunk/scipy/io: . matlab Message-ID: <20100524131010.BAEBF39CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:10:10 -0500 (Mon, 24 May 2010) New Revision: 6403 Modified: trunk/scipy/io/data_store.py trunk/scipy/io/matlab/byteordercodes.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/mmio.py trunk/scipy/io/wavfile.py Log: DOC: merge wiki edits - io module. Modified: trunk/scipy/io/data_store.py =================================================================== --- trunk/scipy/io/data_store.py 2010-05-24 13:09:52 UTC (rev 6402) +++ trunk/scipy/io/data_store.py 2010-05-24 13:10:10 UTC (rev 6403) @@ -86,9 +86,17 @@ def save_as_module(file_name=None,data=None): - """ Save the dictionary "data" into - a module and shelf named save """ + Save the dictionary "data" into a module and shelf named save. + + Parameters + ---------- + file_name : str, optional + File name of the module to save. + data : dict, optional + The dictionary to store in the module. + + """ _create_module(file_name) _create_shelf(file_name,data) Modified: trunk/scipy/io/matlab/byteordercodes.py =================================================================== --- trunk/scipy/io/matlab/byteordercodes.py 2010-05-24 13:09:52 UTC (rev 6402) +++ trunk/scipy/io/matlab/byteordercodes.py 2010-05-24 13:10:10 UTC (rev 6403) @@ -18,21 +18,23 @@ 'swapped': ('swapped', 'S')} def to_numpy_code(code): - ''' Convert various order codings to numpy format + """ + Convert various order codings to numpy format. + Parameters ---------- - code : {'little','big','l','b','le','be','<','>', - 'native','=', - 'swapped', 's'} string - code is converted to lower case before parsing + code : str + The code to convert. It is converted to lower case before parsing. + Legal values are: + 'little', 'big', 'l', 'b', 'le', 'be', '<', '>', 'native', '=', + 'swapped', 's'. Returns ------- - out_code : {'<','>'} string - where '<' is the numpy dtype code for little - endian, and '>' is the code for big endian + out_code : {'<', '>'} + Here '<' is the numpy dtype code for little endian, + and '>' is the code for big endian. - Examples -------- >>> import sys @@ -48,7 +50,8 @@ >>> sc = to_numpy_code('swapped') >>> sc == '>' if sys_is_le else sc == '<' True - ''' + + """ code = code.lower() if code is None: return native_code Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-24 13:09:52 UTC (rev 6402) +++ trunk/scipy/io/matlab/miobase.py 2010-05-24 13:10:10 UTC (rev 6403) @@ -148,11 +148,13 @@ def read_dtype(mat_stream, a_dtype): - ''' Generic get of byte stream data of known type + """ + Generic get of byte stream data of known type Parameters ---------- mat_stream : file-like object + Matlam (TM) stream a_dtype : dtype dtype of array to read. `a_dtype` is assumed to be correct endianness @@ -160,7 +162,9 @@ Returns ------- arr : array - ''' + Array of given datatype obtained from stream. + + """ num_bytes = a_dtype.itemsize arr = np.ndarray(shape=(), dtype=a_dtype, @@ -221,17 +225,32 @@ def matdims(arr, oned_as='column'): - ''' Determine equivalent matlab dimensions for given array + """ + Determine equivalent matlab dimensions for given array Parameters ---------- arr : ndarray - oned_as : {'column', 'row'} string, optional + Input array. + oned_as : {'column', 'row'}, optional + Whether 1-D arrays are returned as Matlab row or column matrices. + Default is 'column'. Returns ------- - dims : shape as matlab expects + dims : tuple + Shape tuple, in the form Matlab expects it. + Notes + ----- + We had to decide what shape a 1 dimensional array would be by + default. ``np.atleast_2d`` thinks it is a row vector. The + default for a vector in matlab (e.g. ``>> 1:12``) is a row vector. + + Versions of scipy up to and including 0.7 resulted (accidentally) + in 1-D arrays being read as column vectors. For the moment, we + maintain the same tradition here. + Examples -------- >>> matdims(np.array(1)) # numpy scalar @@ -253,7 +272,7 @@ >>> matdims(np.array([[[]]])) # empty 3d (0, 0, 0) - Optional argument flips 1d shape behavior + Optional argument flips 1-D shape behavior. >>> matdims(np.array([1,2]), 'row') # 1d array, 2 elements (1, 2) @@ -265,16 +284,7 @@ ... ValueError: 1D option "bizarre" is strange - Notes - ----- - We had to decide what shape a 1 dimensional array would be by - default. ``np.atleast_2d`` thinks it is a row vector. The - default for a vector in matlab (e.g. ``>> 1:12``) is a row vector. - - Versions of scipy up to and including 0.7 resulted (accidentally) - in 1d arrays being read as column vectors. For the moment, we - maintain the same tradition here. - ''' + """ if arr.size == 0: # empty return (0,) * np.max([arr.ndim, 2]) shape = arr.shape Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2010-05-24 13:09:52 UTC (rev 6402) +++ trunk/scipy/io/mmio.py 2010-05-24 13:10:10 UTC (rev 6403) @@ -18,50 +18,74 @@ #------------------------------------------------------------------------------- def mminfo(source): - """ Queries the contents of the Matrix Market file 'filename' to + """ + Queries the contents of the Matrix Market file 'filename' to extract size and storage information. - Inputs: + Parameters + ---------- - source - Matrix Market filename (extension .mtx) or open file object + source : file + Matrix Market filename (extension .mtx) or open file object - Outputs: + Returns + ------- - rows,cols - number of matrix rows and columns - entries - number of non-zero entries of a sparse matrix - or rows*cols for a dense matrix - format - 'coordinate' | 'array' - field - 'real' | 'complex' | 'pattern' | 'integer' - symm - 'general' | 'symmetric' | 'skew-symmetric' | 'hermitian' + rows,cols : int + Number of matrix rows and columns + entries : int + Number of non-zero entries of a sparse matrix + or rows*cols for a dense matrix + + format : {'coordinate', 'array'} + + field : {'real', 'complex', 'pattern', 'integer'} + + symm : {'general', 'symmetric', 'skew-symmetric', 'hermitian'} + """ return MMFile.info(source) #------------------------------------------------------------------------------- def mmread(source): - """ Reads the contents of a Matrix Market file 'filename' into a matrix. + """ + Reads the contents of a Matrix Market file 'filename' into a matrix. - Inputs: + Parameters + ---------- - source - Matrix Market filename (extensions .mtx, .mtz.gz) - or open file object. + source : file + Matrix Market filename (extensions .mtx, .mtz.gz) + or open file object. - Outputs: + Returns + ------- + a: + Sparse or full matrix - a - sparse or full matrix """ return MMFile().read(source) #------------------------------------------------------------------------------- def mmwrite(target, a, comment='', field=None, precision=None): - """ Writes the sparse or dense matrix A to a Matrix Market formatted file. + """ + Writes the sparse or dense matrix A to a Matrix Market formatted file. - Inputs: + Parameters + ---------- - target - Matrix Market filename (extension .mtx) or open file object - a - sparse or full matrix - comment - comments to be prepended to the Matrix Market file - field - 'real' | 'complex' | 'pattern' | 'integer' - precision - Number of digits to display for real or complex values. + target : file + Matrix Market filename (extension .mtx) or open file object + a : array like + Sparse or full matrix + comment : str + comments to be prepended to the Matrix Market file + + field : {'real', 'complex', 'pattern', 'integer'}, optional + + precision : + Number of digits to display for real or complex values. + """ MMFile().write(target, a, comment, field, precision) Modified: trunk/scipy/io/wavfile.py =================================================================== --- trunk/scipy/io/wavfile.py 2010-05-24 13:09:52 UTC (rev 6402) +++ trunk/scipy/io/wavfile.py 2010-05-24 13:10:10 UTC (rev 6403) @@ -1,3 +1,13 @@ +""" +Module to read / write wav files using numpy arrays + +Functions +--------- +read: Return the sample rate (in samples/sec) and data from a WAV file. + +write: Write a numpy array as a WAV file. + +""" import numpy import struct import warnings @@ -66,12 +76,30 @@ # open a wave-file def read(file): - """Return the sample rate (in samples/sec) and data from a WAV file + """ + Return the sample rate (in samples/sec) and data from a WAV file - The file can be an open file or a filename. - The returned sample rate is a Python integer - The data is returned as a numpy array with a - data-type determined from the file. + Parameters + ---------- + file : file + Input wav file. + + Returns + ------- + rate : int + Sample rate of wav file + data : numpy array + Data read from wav file + + Notes + ----- + + * The file can be an open file or a filename. + + * The returned sample rate is a Python integer + * The data is returned as a numpy array with a + data-type determined from the file. + """ if hasattr(file,'read'): fid = file @@ -98,16 +126,25 @@ # Write a wave-file # sample rate, data def write(filename, rate, data): - """Write a numpy array as a WAV file + """ + Write a numpy array as a WAV file - filename -- The name of the file to write (will be over-written) - rate -- The sample rate (in samples/sec). - data -- A 1-d or 2-d numpy array of integer data-type. - The bits-per-sample will be determined by the data-type - To write multiple-channels, use a 2-d array of shape - (Nsamples, Nchannels) + Parameters + ---------- + filename : file + The name of the file to write (will be over-written). + rate : int + The sample rate (in samples/sec). + data : ndarray + A 1-D or 2-D numpy array of integer data-type. - Writes a simple uncompressed WAV file. + Notes + ----- + * Writes a simple uncompressed WAV file. + * The bits-per-sample will be determined by the data-type. + * To write multiple-channels, use a 2-D array of shape + (Nsamples, Nchannels). + """ fid = open(filename, 'wb') fid.write('RIFF') From scipy-svn at scipy.org Mon May 24 09:10:27 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:10:27 -0500 (CDT) Subject: [Scipy-svn] r6404 - trunk/scipy/misc Message-ID: <20100524131027.2394039CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:10:27 -0500 (Mon, 24 May 2010) New Revision: 6404 Modified: trunk/scipy/misc/common.py trunk/scipy/misc/pilutil.py Log: DOC: merge wiki edits - misc module. Modified: trunk/scipy/misc/common.py =================================================================== --- trunk/scipy/misc/common.py 2010-05-24 13:10:10 UTC (rev 6403) +++ trunk/scipy/misc/common.py 2010-05-24 13:10:27 UTC (rev 6404) @@ -93,9 +93,31 @@ return vals def factorialk(n,k,exact=1): - """n(!!...!) = multifactorial of order k - k times """ + n(!!...!) = multifactorial of order k + k times + + + Parameters + ---------- + n : int, array-like + Calculate multifactorial. Arrays are only supported with exact + set to False. If n < 0, the return value is 0. + exact : bool, optional + If exact is set to True, calculate the answer exactly using + integer arithmetic. + + Returns + ------- + val : int + Multi factorial of n. + + Raises + ------ + NotImplementedError + Raises when exact is False + + """ if exact: if n < 1-k: return 0L @@ -110,14 +132,29 @@ def comb(N,k,exact=0): - """Combinations of N things taken k at a time. + """ + Combinations of N things taken k at a time. - If exact==0, then floating point precision is used, otherwise - exact long integer is computed. + Parameters + ---------- + N : int, array + Nunmber of things. + k : int, array + Numner of elements taken. + exact : int, optional + If exact is 0, then floating point precision is used, otherwise + exact long integer is computed. - Notes: - - Array arguments accepted only for exact=0 case. - - If k > N, N < 0, or k < 0, then a 0 is returned. + Returns + ------- + val : int, array + The total number of combinations. + + Notes + ----- + - Array arguments accepted only for exact=0 case. + - If k > N, N < 0, or k < 0, then a 0 is returned. + """ if exact: if (k > N) or (N < 0) or (k < 0): @@ -137,13 +174,17 @@ return where(cond, vals, 0.0) def central_diff_weights(Np,ndiv=1): - """Return weights for an Np-point central derivative of order ndiv - assuming equally-spaced function points. + """ + Return weights for an Np-point central derivative of order ndiv + assuming equally-spaced function points. - If weights are in the vector w, then - derivative is w[0] * f(x-ho*dx) + ... + w[-1] * f(x+h0*dx) + If weights are in the vector w, then + derivative is w[0] * f(x-ho*dx) + ... + w[-1] * f(x+h0*dx) - Can be inaccurate for large number of points. + Notes + ----- + Can be inaccurate for large number of points. + """ assert (Np >= ndiv+1), "Number of points must be at least the derivative order + 1." assert (Np % 2 == 1), "Odd-number of points only." @@ -158,13 +199,31 @@ return w def derivative(func,x0,dx=1.0,n=1,args=(),order=3): - """Given a function, use a central difference formula with spacing dx to - compute the nth derivative at x0. + """ + Find the n-th derivative of a function at point x0. - order is the number of points to use and must be odd. + Given a function, use a central difference formula with spacing `dx` to + compute the n-th derivative at `x0`. - Warning: Decreasing the step size too small can result in - round-off error. + Parameters + ---------- + func : function + Input function. + x0 : float + The point at which nth derivative is found. + dx : int, optional + Spacing. + n : int, optional + Order of the derivative. Default is 1. + args : tuple, optional + Arguments + order : int, optional + Number of points to use, must be odd. + + Notes + ----- + Decreasing the step size too small can result in round-off error. + """ assert (order >= n+1), "Number of points must be at least the derivative order + 1." assert (order % 2 == 1), "Odd number of points only." Modified: trunk/scipy/misc/pilutil.py =================================================================== --- trunk/scipy/misc/pilutil.py 2010-05-24 13:10:10 UTC (rev 6403) +++ trunk/scipy/misc/pilutil.py 2010-05-24 13:10:27 UTC (rev 6404) @@ -15,6 +15,22 @@ # Returns a byte-scaled image def bytescale(data, cmin=None, cmax=None, high=255, low=0): + """ + Parameters + ---------- + im : PIL image + Input image. + flatten : bool + If true, convert the output to grey-scale + + Returns + ------- + img_array : ndarray + The different colour bands/channels are stored in the + third dimension, such that a grey-image is MxN, an + RGB-image MxNx3 and an RGBA-image MxNx4. + + """ if data.dtype == uint8: return data high = high - low @@ -25,39 +41,72 @@ return bytedata + cast[uint8](low) def imread(name,flatten=0): - """Read an image file from a filename. + """ + Read an image file from a filename. - Optional arguments: + Parameters + ---------- + name : str + The file name to be read. + flatten : bool, optional + If True, flattens the color layers into a single gray-scale layer. - - flatten (0): if true, the image is flattened by calling convert('F') on - the resulting image object. This flattens the color layers into a single - grayscale layer. + Returns + ------- + : nd_array + The array obtained by reading image. + + Notes + ----- + The image is flattened by calling convert('F') on + the resulting image object. + """ im = Image.open(name) return fromimage(im,flatten=flatten) def imsave(name, arr): - """Save an array to an image file. """ + Save an array to an image file. + + Parameters + ---------- + im : PIL image + Input image. + + flatten : bool + If true, convert the output to grey-scale. + + Returns + ------- + img_array : ndarray + The different colour bands/channels are stored in the + third dimension, such that a grey-image is MxN, an + RGB-image MxNx3 and an RGBA-image MxNx4. + + """ im = toimage(arr) im.save(name) return def fromimage(im, flatten=0): - """Return a copy of a PIL image as a numpy array. + """ + Return a copy of a PIL image as a numpy array. - :Parameters: - im : PIL image - Input image. - flatten : bool - If true, convert the output to grey-scale. + Parameters + ---------- + im : PIL image + Input image. + flatten : bool + If true, convert the output to grey-scale. - :Returns: - img_array : ndarray - The different colour bands/channels are stored in the - third dimension, such that a grey-image is MxN, an - RGB-image MxNx3 and an RGBA-image MxNx4. + Returns + ------- + img_array : ndarray + The different colour bands/channels are stored in the + third dimension, such that a grey-image is MxN, an + RGB-image MxNx3 and an RGBA-image MxNx4. """ if not Image.isImageType(im): @@ -171,12 +220,33 @@ return image def imrotate(arr,angle,interp='bilinear'): - """Rotate an image counter-clockwise by angle degrees. + """ + Rotate an image counter-clockwise by angle degrees. + Parameters + ---------- + arr : nd_array + Input array of image to be rotated. + angle : float + The angle of rotation. + interp : str, optional + Interpolation + + + Returns + ------- + : nd_array + The rotated array of image. + + Notes + ----- + Interpolation methods can be: - 'nearest' : for nearest neighbor - 'bilinear' : for bilinear - 'cubic' or 'bicubic' : for bicubic + * 'nearest' : for nearest neighbor + * 'bilinear' : for bilinear + * 'cubic' : cubic + * 'bicubic' : for bicubic + """ arr = asarray(arr) func = {'nearest':0,'bilinear':2,'bicubic':3,'cubic':3} @@ -215,11 +285,25 @@ raise RuntimeError('Could not execute image viewer.') def imresize(arr,size): - """Resize an image. + """ + Resize an image. - If size is an integer it is a percentage of current size. - If size is a float it is a fraction of current size. - If size is a tuple it is the size of the output image. + Parameters + ---------- + arr : nd_array + The array of image to be resized. + + size : int, float or tuple + * int - Percentage of current size. + * float - Fraction of current size. + * tuple - Size of the output image. + + Returns + ------- + + : nd_array + The resized array of image. + """ im = toimage(arr) ts = type(size) @@ -234,11 +318,29 @@ def imfilter(arr,ftype): - """Simple filtering of an image. + """ + Simple filtering of an image. - type can be: - 'blur', 'contour', 'detail', 'edge_enhance', 'edge_enhance_more', - 'emboss', 'find_edges', 'smooth', 'smooth_more', 'sharpen' + Parameters + ---------- + arr : ndarray + The array of Image in which the filter is to be applied. + ftype : str + The filter that has to be applied. Legal values are: + 'blur', 'contour', 'detail', 'edge_enhance', 'edge_enhance_more', + 'emboss', 'find_edges', 'smooth', 'smooth_more', 'sharpen'. + + Returns + ------- + res : nd_array + The array with filter applied. + + Raises + ------ + ValueError + *Unknown filter type.* . If the filter you are trying + to apply is unsupported. + """ _tdict = {'blur':ImageFilter.BLUR, 'contour':ImageFilter.CONTOUR, From scipy-svn at scipy.org Mon May 24 09:10:50 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:10:50 -0500 (CDT) Subject: [Scipy-svn] r6405 - trunk/scipy/ndimage Message-ID: <20100524131050.BC9D339CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:10:50 -0500 (Mon, 24 May 2010) New Revision: 6405 Modified: trunk/scipy/ndimage/fourier.py trunk/scipy/ndimage/interpolation.py trunk/scipy/ndimage/io.py trunk/scipy/ndimage/measurements.py trunk/scipy/ndimage/morphology.py Log: DOC: merge wiki edits - ndimage module. Modified: trunk/scipy/ndimage/fourier.py =================================================================== --- trunk/scipy/ndimage/fourier.py 2010-05-24 13:10:27 UTC (rev 6404) +++ trunk/scipy/ndimage/fourier.py 2010-05-24 13:10:50 UTC (rev 6405) @@ -72,15 +72,38 @@ return output, return_value def fourier_gaussian(input, sigma, n = -1, axis = -1, output = None): - """Multi-dimensional Gaussian fourier filter. + """ + Multi-dimensional Gaussian fourier filter. The array is multiplied with the fourier transform of a Gaussian - kernel. If the parameter n is negative, then the input is assumed to be - the result of a complex fft. If n is larger or equal to zero, the input - is assumed to be the result of a real fft, and n gives the length of - the of the array before transformation along the the real transform - direction. The axis of the real transform is given by the axis - parameter. + kernel. + + Parameters + ---------- + input : array_like + The input array. + sigma : float or sequence + The sigma of the Gaussian kernel. If a float, `sigma` is the same for + all axes. If a sequence, `sigma` has to contain one value for each + axis. + n : int, optional + If `n` is negative (default), then the input is assumed to be the + result of a complex fft. + If `n` is larger than or equal to zero, the input is assumed to be the + result of a real fft, and `n` gives the length of the array before + transformation along the real transform direction. + axis : int, optional + The axis of the real transform. + output : ndarray, optional + If given, the result of filtering the input is placed in this array. + None is returned in this case. + + Returns + ------- + return_value : ndarray or None + The filtered input. If `output` is given as a parameter, None is + returned. + """ input = numpy.asarray(input) output, return_value = _get_output_fourier(output, input) @@ -94,15 +117,38 @@ return return_value def fourier_uniform(input, size, n = -1, axis = -1, output = None): - """Multi-dimensional Uniform fourier filter. + """ + Multi-dimensional uniform fourier filter. The array is multiplied with the fourier transform of a box of given - sizes. If the parameter n is negative, then the input is assumed to be - the result of a complex fft. If n is larger or equal to zero, the input - is assumed to be the result of a real fft, and n gives the length of - the of the array before transformation along the the real transform - direction. The axis of the real transform is given by the axis - parameter. + size. + + Parameters + ---------- + input : array_like + The input array. + size : float or sequence + The size of the box used for filtering. + If a float, `size` is the same for all axes. If a sequence, `size` has + to contain one value for each axis. + n : int, optional + If `n` is negative (default), then the input is assumed to be the + result of a complex fft. + If `n` is larger than or equal to zero, the input is assumed to be the + result of a real fft, and `n` gives the length of the array before + transformation along the real transform direction. + axis : int, optional + The axis of the real transform. + output : ndarray, optional + If given, the result of filtering the input is placed in this array. + None is returned in this case. + + Returns + ------- + return_value : ndarray or None + The filtered input. If `output` is given as a parameter, None is + returned. + """ input = numpy.asarray(input) output, return_value = _get_output_fourier(output, input) @@ -115,16 +161,42 @@ return return_value def fourier_ellipsoid(input, size, n = -1, axis = -1, output = None): - """Multi-dimensional ellipsoid fourier filter. + """ + Multi-dimensional ellipsoid fourier filter. The array is multiplied with the fourier transform of a ellipsoid of - given sizes. If the parameter n is negative, then the input is assumed - to be the result of a complex fft. If n is larger or equal to zero, the - input is assumed to be the result of a real fft, and n gives the length - of the of the array before transformation along the the real transform - direction. The axis of the real transform is given by the axis - parameter. This function is implemented for arrays of - rank 1, 2, or 3. + given sizes. + + Parameters + ---------- + input : array_like + The input array. + size : float or sequence + The size of the box used for filtering. + If a float, `size` is the same for all axes. If a sequence, `size` has + to contain one value for each axis. + n : int, optional + If `n` is negative (default), then the input is assumed to be the + result of a complex fft. + If `n` is larger than or equal to zero, the input is assumed to be the + result of a real fft, and `n` gives the length of the array before + transformation along the real transform direction. + axis : int, optional + The axis of the real transform. + output : ndarray, optional + If given, the result of filtering the input is placed in this array. + None is returned in this case. + + Returns + ------- + return_value : ndarray or None + The filtered input. If `output` is given as a parameter, None is + returned. + + Notes + ----- + This function is implemented for arrays of rank 1, 2, or 3. + """ input = numpy.asarray(input) output, return_value = _get_output_fourier(output, input) @@ -137,16 +209,38 @@ return return_value def fourier_shift(input, shift, n = -1, axis = -1, output = None): - """Multi-dimensional fourier shift filter. + """ + Multi-dimensional fourier shift filter. - The array is multiplied with the fourier transform of a shift operation - If the parameter n is negative, then the input is assumed to be the - result of a complex fft. If n is larger or equal to zero, the input is - assumed to be the result of a real fft, and n gives the length of the - of the array before transformation along the the real transform - direction. The axis of the real transform is given by the axis - parameter. - """ + The array is multiplied with the fourier transform of a shift operation. + + Parameters + ---------- + input : array_like + The input array. + shift : float or sequence + The size of the box used for filtering. + If a float, `shift` is the same for all axes. If a sequence, `shift` + has to contain one value for each axis. + n : int, optional + If `n` is negative (default), then the input is assumed to be the + result of a complex fft. + If `n` is larger than or equal to zero, the input is assumed to be the + result of a real fft, and `n` gives the length of the array before + transformation along the real transform direction. + axis : int, optional + The axis of the real transform. + output : ndarray, optional + If given, the result of shifting the input is placed in this array. + None is returned in this case. + + Returns + ------- + return_value : ndarray or None + The shifted input. If `output` is given as a parameter, None is + returned. + + """ input = numpy.asarray(input) output, return_value = _get_output_fourier_complex(output, input) axis = _ni_support._check_axis(axis, input.ndim) Modified: trunk/scipy/ndimage/interpolation.py =================================================================== --- trunk/scipy/ndimage/interpolation.py 2010-05-24 13:10:27 UTC (rev 6404) +++ trunk/scipy/ndimage/interpolation.py 2010-05-24 13:10:50 UTC (rev 6405) @@ -39,10 +39,33 @@ def spline_filter1d(input, order = 3, axis = -1, output = numpy.float64, output_type = None): - """Calculates a one-dimensional spline filter along the given axis. + """ + Calculates a one-dimensional spline filter along the given axis. The lines of the array along the given axis are filtered by a spline filter. The order of the spline must be >= 2 and <= 5. + + Parameters + ---------- + input : array_like + The input array. + order : int, optional + The order of the spline, default is 3. + axis : int, optional + The axis along which the spline filter is applied. Default is the last + axis. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. Default is `numpy.float64`. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + + Returns + ------- + return_value : ndarray or None + The filtered input. If `output` is given as a parameter, None is + returned. + """ if order < 0 or order > 5: raise RuntimeError, 'spline order not supported' @@ -61,13 +84,23 @@ def spline_filter(input, order = 3, output = numpy.float64, output_type = None): - """Multi-dimensional spline filter. + """ + Multi-dimensional spline filter. - Note: The multi-dimensional filter is implemented as a sequence of + For more details, see `spline_filter1d`. + + See Also + -------- + spline_filter1d + + Notes + ----- + The multi-dimensional filter is implemented as a sequence of one-dimensional spline filters. The intermediate arrays are stored in the same data type as the output. Therefore, for output types with a limited precision, the results may be imprecise because intermediate results may be stored with insufficient precision. + """ if order < 2 or order > 5: raise RuntimeError, 'spline order not supported' @@ -88,37 +121,71 @@ output_type = None, output = None, order = 3, mode = 'constant', cval = 0.0, prefilter = True, extra_arguments = (), extra_keywords = {}): - """Apply an arbritrary geometric transform. + """ + Apply an arbritrary geometric transform. The given mapping function is used to find, for each point in the output, the corresponding coordinates in the input. The value of the input at those coordinates is determined by spline interpolation of the requested order. - mapping must be a callable object that accepts a tuple of length - equal to the output array rank and returns the corresponding input - coordinates as a tuple of length equal to the input array - rank. Points outside the boundaries of the input are filled - according to the given mode ('constant', 'nearest', 'reflect' or - 'wrap'). The output shape can optionally be given. If not given, - it is equal to the input shape. The parameter prefilter determines - if the input is pre-filtered before interpolation (necessary for - spline interpolation of order > 1). If False it is assumed that - the input is already filtered. The extra_arguments and - extra_keywords arguments can be used to provide extra arguments - and keywords that are passed to the mapping function at each call. + Parameters + ---------- + input : array_like + The input array. + mapping : callable + A callable object that accepts a tuple of length equal to the output + array rank, and returns the corresponding input coordinates as a tuple + of length equal to the input array rank. + output_shape : tuple of ints + Shape tuple. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + order : int, optional + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. + mode : str, optional + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. + cval : scalar, optional + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 + prefilter : bool, optional + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. + extra_arguments : tuple, optional + Extra arguments passed to `mapping`. + extra_keywords : dict, optional + Extra keywords passed to `mapping`. - Example + Returns ------- - >>> a = arange(12.).reshape((4,3)) - >>> def shift_func(output_coordinates): - ... return (output_coordinates[0]-0.5, output_coordinates[1]-0.5) + return_value : ndarray or None + The filtered input. If `output` is given as a parameter, None is + returned. + + See Also + -------- + map_coordinates, affine_transform, spline_filter1d + + Examples + -------- + >>> a = np.arange(12.).reshape((4, 3)) + >>> def shift_func(output_coords): + ... return (output_coords[0] - 0.5, output_coords[1] - 0.5) ... - >>> print geometric_transform(a,shift_func) - array([[ 0. , 0. , 0. ], - [ 0. , 1.3625, 2.7375], - [ 0. , 4.8125, 6.1875], - [ 0. , 8.2625, 9.6375]]) + >>> sp.ndimage.geometric_transform(a, shift_func) + array([[ 0. , 0. , 0. ], + [ 0. , 1.362, 2.738], + [ 0. , 4.812, 6.187], + [ 0. , 8.263, 9.637]]) + """ if order < 0 or order > 5: raise RuntimeError, 'spline order not supported' @@ -159,39 +226,36 @@ Parameters ---------- input : ndarray - The input array + The input array. coordinates : array_like - The coordinates at which `input` is evaluated. - output_type : deprecated - Use `output` instead. - output : dtype, optional - If the output has to have a certain type, specify the dtype. - The default behavior is for the output to have the same type - as `input`. + The coordinates at which `input` is evaluated. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional - The order of the spline interpolation, default is 3. - The order has to be in the range 0-5. + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. mode : str, optional - Points outside the boundaries of the input are filled according - to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). - Default is 'constant'. + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. cval : scalar, optional - Value used for points outside the boundaries of the input if - `mode='constant`. Default is 0.0 + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 prefilter : bool, optional - The parameter prefilter determines if the input is - pre-filtered with `spline_filter`_ before interpolation - (necessary for spline interpolation of order > 1). - If False, it is assumed that the input is already filtered. + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. Returns ------- return_value : ndarray - The result of transforming the input. The shape of the - output is derived from that of `coordinates` by dropping - the first axis. + The result of transforming the input. The shape of the output is + derived from that of `coordinates` by dropping the first axis. - See Also -------- spline_filter, geometric_transform, scipy.interpolate @@ -199,8 +263,8 @@ Examples -------- >>> import scipy.ndimage - >>> a = np.arange(12.).reshape((4,3)) - >>> print a + >>> a = np.arange(12.).reshape((4, 3)) + >>> a array([[ 0., 1., 2.], [ 3., 4., 5.], [ 6., 7., 8.], @@ -248,22 +312,58 @@ def affine_transform(input, matrix, offset = 0.0, output_shape = None, output_type = None, output = None, order = 3, mode = 'constant', cval = 0.0, prefilter = True): - """Apply an affine transformation. + """ + Apply an affine transformation. The given matrix and offset are used to find for each point in the output the corresponding coordinates in the input by an affine transformation. The value of the input at those coordinates is determined by spline interpolation of the requested order. Points outside the boundaries of the input are filled according to the given - mode. The output shape can optionally be given. If not given it is - equal to the input shape. The parameter prefilter determines if the - input is pre-filtered before interpolation, if False it is assumed - that the input is already filtered. + mode. - The matrix must be two-dimensional or can also be given as a - one-dimensional sequence or array. In the latter case, it is - assumed that the matrix is diagonal. A more efficient algorithms - is then applied that exploits the separability of the problem. + Parameters + ---------- + input : ndarray + The input array. + matrix : ndarray + The matrix must be two-dimensional or can also be given as a + one-dimensional sequence or array. In the latter case, it is assumed + that the matrix is diagonal. A more efficient algorithms is then + applied that exploits the separability of the problem. + offset : float or sequence, optional + The offset into the array where the transform is applied. If a float, + `offset` is the same for each axis. If a sequence, `offset` should + contain one value for each axis. + output_shape : tuple of ints, optional + Shape tuple. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + order : int, optional + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. + mode : str, optional + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. + cval : scalar, optional + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 + prefilter : bool, optional + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. + + Returns + ------- + return_value : ndarray or None + The transformed input. If `output` is given as a parameter, None is + returned. + """ if order < 0 or order > 5: raise RuntimeError, 'spline order not supported' @@ -307,13 +407,47 @@ def shift(input, shift, output_type = None, output = None, order = 3, mode = 'constant', cval = 0.0, prefilter = True): - """Shift an array. + """ + Shift an array. - The array is shifted using spline interpolation of the requested - order. Points outside the boundaries of the input are filled according - to the given mode. The parameter prefilter determines if the input is - pre-filtered before interpolation, if False it is assumed that the - input is already filtered. + The array is shifted using spline interpolation of the requested order. + Points outside the boundaries of the input are filled according to the + given mode. + + Parameters + ---------- + input : ndarray + The input array. + shift : float or sequence, optional + The shift along the axes. If a float, `shift` is the same for each + axis. If a sequence, `shift` should contain one value for each axis. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + order : int, optional + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. + mode : str, optional + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. + cval : scalar, optional + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 + prefilter : bool, optional + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. + + Returns + ------- + return_value : ndarray or None + The shifted input. If `output` is given as a parameter, None is + returned. + """ if order < 0 or order > 5: raise RuntimeError, 'spline order not supported' @@ -340,13 +474,45 @@ def zoom(input, zoom, output_type = None, output = None, order = 3, mode = 'constant', cval = 0.0, prefilter = True): - """Zoom an array. + """ + Zoom an array. The array is zoomed using spline interpolation of the requested order. - Points outside the boundaries of the input are filled according to the - given mode. The parameter prefilter determines if the input is pre- - filtered before interpolation, if False it is assumed that the input - is already filtered. + + Parameters + ---------- + input : ndarray + The input array. + zoom : float or sequence, optional + The zoom factor along the axes. If a float, `zoom` is the same for each + axis. If a sequence, `zoom` should contain one value for each axis. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + order : int, optional + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. + mode : str, optional + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. + cval : scalar, optional + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 + prefilter : bool, optional + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. + + Returns + ------- + return_value : ndarray or None + The zoomed input. If `output` is given as a parameter, None is + returned. + """ if order < 0 or order > 5: raise RuntimeError, 'spline order not supported' @@ -384,16 +550,51 @@ def rotate(input, angle, axes = (1, 0), reshape = True, output_type = None, output = None, order = 3, mode = 'constant', cval = 0.0, prefilter = True): - """Rotate an array. + """ + Rotate an array. The array is rotated in the plane defined by the two axes given by the - axes parameter using spline interpolation of the requested order. The - angle is given in degrees. Points outside the boundaries of the input - are filled according to the given mode. If reshape is true, the output - shape is adapted so that the input array is contained completely in - the output. The parameter prefilter determines if the input is pre- - filtered before interpolation, if False it is assumed that the input - is already filtered. + `axes` parameter using spline interpolation of the requested order. + + Parameters + ---------- + input : ndarray + The input array. + angle : float + The rotation angle in degrees. + axes : tuple of 2 ints, optional + The two axes that define the plane of rotation. Default is the first + two axes. + reshape : bool, optional + If `reshape` is true, the output shape is adapted so that the input + array is contained completely in the output. Default is True. + output : ndarray or dtype, optional + The array in which to place the output, or the dtype of the returned + array. + output_type : dtype, optional + DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. + order : int, optional + The order of the spline interpolation, default is 3. + The order has to be in the range 0-5. + mode : str, optional + Points outside the boundaries of the input are filled according + to the given mode ('constant', 'nearest', 'reflect' or 'wrap'). + Default is 'constant'. + cval : scalar, optional + Value used for points outside the boundaries of the input if + ``mode='constant'``. Default is 0.0 + prefilter : bool, optional + The parameter prefilter determines if the input is pre-filtered with + `spline_filter` before interpolation (necessary for spline + interpolation of order > 1). If False, it is assumed that the input is + already filtered. Default is True. + + Returns + ------- + return_value : ndarray or None + The rotated input. If `output` is given as a parameter, None is + returned. + """ input = numpy.asarray(input) axes = list(axes) Modified: trunk/scipy/ndimage/io.py =================================================================== --- trunk/scipy/ndimage/io.py 2010-05-24 13:10:27 UTC (rev 6404) +++ trunk/scipy/ndimage/io.py 2010-05-24 13:10:50 UTC (rev 6405) @@ -3,14 +3,15 @@ from numpy import array def imread(fname, flatten=False): - """Load an image from file. + """ + Load an image from file. Parameters ---------- - fname : string + fname : str Image file name, e.g. ``test.jpg``. - flatten : bool - If true, convert the output to grey-scale. + flatten : bool, optional + If true, convert the output to grey-scale. Default is False. Returns ------- @@ -19,6 +20,11 @@ third dimension, such that a grey-image is MxN, an RGB-image MxNx3 and an RGBA-image MxNx4. + Raises + ------ + ImportError + If the Python Imaging Library (PIL) can not be imported. + """ try: from PIL import Image Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-05-24 13:10:27 UTC (rev 6404) +++ trunk/scipy/ndimage/measurements.py 2010-05-24 13:10:50 UTC (rev 6405) @@ -336,17 +336,35 @@ def sum(input, labels = None, index = None): - """Calculate the sum of the values of the array. + """ + Calculate the sum of the values of the array. - :Parameters: - labels : array of integers, same shape as input - Assign labels to the values of the array. + Parameters + ---------- - index : scalar or array - A single label number or a sequence of label numbers of - the objects to be measured. If index is None, all - values are used where 'labels' is larger than zero. + input : array_like + Values of `input` inside the regions defined by `labels` + are summed together. + labels : array of integers, same shape as input + Assign labels to the values of the array. + + index : scalar or array + A single label number or a sequence of label numbers of + the objects to be measured. + + Returns + ------- + + output : list + A list of the sums of the values of `input` inside the regions + defined by `labels`. + + See also + -------- + + mean + Examples -------- @@ -483,22 +501,147 @@ return result def minimum(input, labels = None, index = None): - """Calculate the minimum of the values of an array at labels. + """ + Calculate the minimum of the values of an array over labeled regions. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + input: array-like + Array-like of values. For each region specified by `labels`, the + minimal values of `input` over the region is computed. + + labels: array-like, optional + An array-like of integers marking different regions over which the + minimum value of `input` is to be computed. `labels` must have the + same shape as `input`. If `labels` is not specified, the minimum + over the whole array is returned. + + index: array-like, optional + A list of region labels that are taken into account for computing the + minima. If index is None, the minimum over all elements where `labels` + is non-zero is returned. + + Returns + ------- + output : float or list of floats + List of minima of `input` over the regions determined by `labels` and + whose index is in `index`. If `index` or `labels` are not specified, a + float is returned: the minimal value of `input` if `labels` is None, + and the minimal value of elements where `labels` is greater than zero + if `index` is None. + + See also + -------- + + label, maximum, minimum_position, extrema, sum, mean, variance, + standard_deviation + + Notes + ----- + + The function returns a Python list and not a Numpy array, use + `np.array` to convert the list to an array. + + Examples + -------- + + >>> a = np.array([[1, 2, 0, 0], + ... [5, 3, 0, 4], + ... [0, 0, 0, 7], + ... [9, 3, 0, 0]]) + >>> labels, labels_nb = ndimage.label(a) + >>> labels + array([[1, 1, 0, 0], + [1, 1, 0, 2], + [0, 0, 0, 2], + [3, 3, 0, 0]]) + >>> ndimage.minimum(a, labels=labels, index=np.arange(1, labels_nb + 1)) + [1.0, 4.0, 3.0] + >>> ndimage.minimum(a) + 0.0 + >>> ndimage.minimum(a, labels=labels) + 1.0 + """ return _select(input, labels, index, find_min=True)[0] def maximum(input, labels = None, index = None): - """Calculate the maximum of the values of an array at labels. + """ + Calculate the maximum of the values of an array over labeled regions. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- + input : array_like + Array-like of values. For each region specified by `labels`, the + maximal values of `input` over the region is computed. + labels : array_like, optional + An array of integers marking different regions over which the + maximum value of `input` is to be computed. `labels` must have the + same shape as `input`. If `labels` is not specified, the maximum + over the whole array is returned. + index : array_like, optional + A list of region labels that are taken into account for computing the + maxima. If index is None, the maximum over all elements where `labels` + is non-zero is returned. - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + output : float or list of floats + List of maxima of `input` over the regions determined by `labels` and + whose index is in `index`. If `index` or `labels` are not specified, a + float is returned: the maximal value of `input` if `labels` is None, + and the maximal value of elements where `labels` is greater than zero + if `index` is None. + + See also + -------- + label, minimum, maximum_position, extrema, sum, mean, variance, + standard_deviation + + Notes + ----- + The function returns a Python list and not a Numpy array, use + `np.array` to convert the list to an array. + + Examples + -------- + + >>> a = np.arange(16).reshape((4,4)) + >>> a + array([[ 0, 1, 2, 3], + [ 4, 5, 6, 7], + [ 8, 9, 10, 11], + [12, 13, 14, 15]]) + >>> labels = np.zeros_like(a) + >>> labels[:2,:2] = 1 + >>> labels[2:, 1:3] = 2 + >>> labels + array([[1, 1, 0, 0], + [1, 1, 0, 0], + [0, 2, 2, 0], + [0, 2, 2, 0]]) + >>> from scipy import ndimage + >>> ndimage.maximum(a) + 15.0 + >>> ndimage.maximum(a, labels=labels, index=[1,2]) + [5.0, 14.0] + >>> ndimage.maximum(a, labels=labels) + 14.0 + + >>> b = np.array([[1, 2, 0, 0], + [5, 3, 0, 4], + [0, 0, 0, 7], + [9, 3, 0, 0]]) + >>> labels, labels_nb = ndimage.label(b) + >>> labels + array([[1, 1, 0, 0], + [1, 1, 0, 2], + [0, 0, 0, 2], + [3, 3, 0, 0]]) + >>> ndimage.maximum(b, labels=labels, index=np.arange(1, labels_nb + 1)) + [5.0, 7.0, 9.0] + """ return _select(input, labels, index, find_max=True)[0] Modified: trunk/scipy/ndimage/morphology.py =================================================================== --- trunk/scipy/ndimage/morphology.py 2010-05-24 13:10:27 UTC (rev 6404) +++ trunk/scipy/ndimage/morphology.py 2010-05-24 13:10:50 UTC (rev 6405) @@ -41,11 +41,60 @@ return bool(structure[coor]) def iterate_structure(structure, iterations, origin = None): - """Iterate a structure by dilating it with itself. + """ + Iterate a structure by dilating it with itself. - If origin is None, only the iterated structure is returned. If - not, a tuple of the iterated structure and the modified origin is - returned. + Parameters + ---------- + + structure : array_like + Structuring element (an array of bools, for example), to be dilated with + itself. + + iterations : int + number of dilations performed on the structure with itself + + origin : optional + If origin is None, only the iterated structure is returned. If + not, a tuple of the iterated structure and the modified origin is + returned. + + + Returns + ------- + + output: ndarray of bools + A new structuring element obtained by dilating `structure` + (`iterations` - 1) times with itself. + + See also + -------- + + generate_binary_structure + + Examples + -------- + + >>> struct = ndimage.generate_binary_structure(2, 1) + >>> struct.astype(int) + array([[0, 1, 0], + [1, 1, 1], + [0, 1, 0]]) + >>> ndimage.iterate_structure(struct, 2).astype(int) + array([[0, 0, 1, 0, 0], + [0, 1, 1, 1, 0], + [1, 1, 1, 1, 1], + [0, 1, 1, 1, 0], + [0, 0, 1, 0, 0]]) + >>> ndimage.iterate_structure(struct, 3).astype(int) + array([[0, 0, 0, 1, 0, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1], + [0, 1, 1, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 0, 1, 0, 0, 0]]) + """ structure = numpy.asarray(structure) if iterations < 2: @@ -66,10 +115,93 @@ return out, origin def generate_binary_structure(rank, connectivity): - """Generate a binary structure for binary morphological operations. + """ + Generate a binary structure for binary morphological operations. - The inputs are the rank of the array to which the structure will - be applied and the square of the connectivity of the structure. + Parameters + ---------- + + rank : int + Number of dimensions of the array to which the structuring element + will be applied, as returned by `np.ndim`. + + connectivity : int + `connectivity` determines which elements of the output array belong + to the structure, i.e. are considered as neighbors of the central + element. Elements up to a squared distance of `connectivity` from + the center are considered neighbors. `connectivity` may range from 1 + (no diagonal elements are neighbors) to `rank` (all elements are + neighbors). + + + Returns + ------- + + output : ndarray of bools + Structuring element which may be used for binary morphological + operations, with `rank` dimensions and all dimensions equal to 3. + + See also + -------- + + iterate_structure, binary_dilation, binary_erosion + + + Notes + ----- + + `generate_binary_structure` can only create structuring elements with + dimensions equal to 3, i.e. minimal dimensions. For larger structuring + elements, that are useful e.g. for eroding large objects, one may either + use `iterate_structure`, or create directly custom arrays with + numpy functions such as `numpy.ones`. + + Examples + -------- + + >>> struct = ndimage.generate_binary_structure(2, 1) + >>> struct + array([[False, True, False], + [ True, True, True], + [False, True, False]], dtype=bool) + >>> a = np.zeros((5,5)) + >>> a[2, 2] = 1 + >>> a + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> b = ndimage.binary_dilation(a, structure=struct).astype(a.dtype) + >>> b + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> ndimage.binary_dilation(b, structure=struct).astype(a.dtype) + array([[ 0., 0., 1., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 1., 1., 1., 1., 1.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 1., 0., 0.]]) + >>> struct = ndimage.generate_binary_structure(2, 2) + >>> struct + array([[ True, True, True], + [ True, True, True], + [ True, True, True]], dtype=bool) + >>> struct = ndimage.generate_binary_structure(3, 1) + >>> struct # no diagonal elements + array([[[False, False, False], + [False, True, False], + [False, False, False]], + [[False, True, False], + [ True, True, True], + [False, True, False]], + [[False, False, False], + [False, True, False], + [False, False, False]]], dtype=bool) + """ if connectivity < 1: connectivity = 1 @@ -159,33 +291,231 @@ def binary_erosion(input, structure = None, iterations = 1, mask = None, output = None, border_value = 0, origin = 0, brute_force = False): - """Multi-dimensional binary erosion with the given structure. + """ + Multi-dimensional binary erosion with a given structuring element. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. The border_value parameter gives the value of the array - outside the border. The erosion operation is repeated iterations - times. If iterations is less than 1, the erosion is repeated until - the result does not change anymore. If a mask is given, only those - elements with a true value at the corresponding mask element are - modified at each iteration. + Binary erosion is a mathematical morphology operation used for image + processing. + + Parameters + ---------- + + input : array_like + Binary image to be eroded. Non-zero (True) elements form + the subset to be eroded. + + structure : array_like, optional + Structuring element used for the erosion. Non-zero elements are + considered True. If no structuring element is provided, an element + is generated with a square connectivity equal to one. + + iterations : {int, float}, optional + The erosion is repeated `iterations` times (one, by default). + If iterations is less than 1, the erosion is repeated until the + result does not change anymore. + + mask : array_like, optional + If a mask is given, only those elements with a True value at + the corresponding mask element are modified at each iteration. + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin: int or tuple of ints, optional + Placement of the filter, by default 0. + + border_value: int (cast to 0 or 1) + Value at the border in the output array. + + + Returns + ------- + + out: ndarray of bools + Erosion of the input by the structuring element. + + + See also + -------- + + grey_erosion, binary_dilation, binary_closing, binary_opening, + generate_binary_structure + + Notes + ----- + + Erosion [1]_ is a mathematical morphology operation [2]_ that uses a + structuring element for shrinking the shapes in an image. The binary + erosion of an image by a structuring element is the locus of the points + where a superimposition of the structuring element centered on the point + is entirely contained in the set of non-zero elements of the image. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Erosion_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[1:6, 2:5] = 1 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.binary_erosion(a).astype(a.dtype) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> #Erosion removes objects smaller than the structure + >>> ndimage.binary_erosion(a, structure=np.ones((5,5))).astype(a.dtype) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + """ return _binary_erosion(input, structure, iterations, mask, output, border_value, origin, 0, brute_force) def binary_dilation(input, structure = None, iterations = 1, mask = None, output = None, border_value = 0, origin = 0, brute_force = False): - """Multi-dimensional binary dilation with the given structure. + """ + Multi-dimensional binary dilation with the given structuring element. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. The dilation operation is repeated iterations times. If - iterations is less than 1, the dilation is repeated until the - result does not change anymore. If a mask is given, only those - elements with a true value at the corresponding mask element are - modified at each iteration. + + Parameters + ---------- + + input : array_like + Binary array_like to be dilated. Non-zero (True) elements form + the subset to be dilated. + + structure : array_like, optional + Structuring element used for the dilation. Non-zero elements are + considered True. If no structuring element is provided an element + is generated with a square connectivity equal to one. + + iterations : {int, float}, optional + The dilation is repeated `iterations` times (one, by default). + If iterations is less than 1, the dilation is repeated until the + result does not change anymore. + + mask : array_like, optional + If a mask is given, only those elements with a True value at + the corresponding mask element are modified at each iteration. + + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin : int or tuple of ints, optional + Placement of the filter, by default 0. + + border_value : int (cast to 0 or 1) + Value at the border in the output array. + + + Returns + ------- + + out : ndarray of bools + Dilation of the input by the structuring element. + + + See also + -------- + + grey_dilation, binary_erosion, binary_closing, binary_opening, + generate_binary_structure + + Notes + ----- + + Dilation [1]_ is a mathematical morphology operation [2]_ that uses a + structuring element for expanding the shapes in an image. The binary + dilation of an image by a structuring element is the locus of the points + covered by the structuring element, when its center lies within the + non-zero points of the image. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Dilation_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((5, 5)) + >>> a[2, 2] = 1 + >>> a + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> ndimage.binary_dilation(a) + array([[False, False, False, False, False], + [False, False, True, False, False], + [False, True, True, True, False], + [False, False, True, False, False], + [False, False, False, False, False]], dtype=bool) + >>> ndimage.binary_dilation(a).astype(a.dtype) + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> # 3x3 structuring element with connectivity 1, used by default + >>> struct1 = ndimage.generate_binary_structure(2, 1) + >>> struct1 + array([[False, True, False], + [ True, True, True], + [False, True, False]], dtype=bool) + >>> # 3x3 structuring element with connectivity 2 + >>> struct2 = ndimage.generate_binary_structure(2, 2) + >>> struct2 + array([[ True, True, True], + [ True, True, True], + [ True, True, True]], dtype=bool) + >>> ndimage.binary_dilation(a, structure=struct1).astype(a.dtype) + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> ndimage.binary_dilation(a, structure=struct2).astype(a.dtype) + array([[ 0., 0., 0., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 0., 0., 0.]]) + >>> ndimage.binary_dilation(a, structure=struct1,\\ + ... iterations=2).astype(a.dtype) + array([[ 0., 0., 1., 0., 0.], + [ 0., 1., 1., 1., 0.], + [ 1., 1., 1., 1., 1.], + [ 0., 1., 1., 1., 0.], + [ 0., 0., 1., 0., 0.]]) + """ input = numpy.asarray(input) if structure is None: @@ -204,13 +534,109 @@ def binary_opening(input, structure = None, iterations = 1, output = None, origin = 0): - """Multi-dimensional binary opening with the given structure. + """ + Multi-dimensional binary opening with the given structuring element. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. The iterations parameter gives the number of times the - erosions and then the dilations are done. + The *opening* of an input image by a structuring element is the + *dilation* of the *erosion* of the image by the structuring element. + + Parameters + ---------- + + input : array_like + Binary array_like to be opened. Non-zero (True) elements form + the subset to be opened. + + structure : array_like, optional + Structuring element used for the opening. Non-zero elements are + considered True. If no structuring element is provided an element + is generated with a square connectivity equal to one (i.e., only + nearest neighbors are connected to the center, diagonally-connected + elements are not considered neighbors). + + iterations : {int, float}, optional + The erosion step of the opening, then the dilation step are each + repeated `iterations` times (one, by default). If `iterations` is + less than 1, each operation is repeated until the result does + not change anymore. + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin : int or tuple of ints, optional + Placement of the filter, by default 0. + + Returns + ------- + + out : ndarray of bools + Opening of the input by the structuring element. + + + See also + -------- + + grey_opening, binary_closing, binary_erosion, binary_dilation, + generate_binary_structure + + Notes + ----- + + *Opening* [1]_ is a mathematical morphology operation [2]_ that + consists in the succession of an erosion and a dilation of the + input with the same structuring element. Opening therefore removes + objects smaller than the structuring element. + + Together with *closing* (`binary_closing`), opening can be used for + noise removal. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Opening_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((5,5), dtype=np.int) + >>> a[1:4, 1:4] = 1; a[4, 4] = 1 + >>> a + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 1]]) + >>> # Opening removes small objects + >>> ndimage.binary_opening(a, structure=np.ones((3,3))).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + >>> # Opening can also smooth corners + >>> ndimage.binary_opening(a).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 0, 1, 0, 0], + [0, 1, 1, 1, 0], + [0, 0, 1, 0, 0], + [0, 0, 0, 0, 0]]) + >>> # Opening is the dilation of the erosion of the input + >>> ndimage.binary_erosion(a).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 1, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0]]) + >>> ndimage.binary_dilation(ndimage.binary_erosion(a)).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 0, 1, 0, 0], + [0, 1, 1, 1, 0], + [0, 0, 1, 0, 0], + [0, 0, 0, 0, 0]]) + """ input = numpy.asarray(input) if structure is None: @@ -224,13 +650,132 @@ def binary_closing(input, structure = None, iterations = 1, output = None, origin = 0): - """Multi-dimensional binary closing with the given structure. + """ + Multi-dimensional binary closing with the given structuring element. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. The iterations parameter gives the number of times the - dilations and then the erosions are done. + The *closing* of an input image by a structuring element is the + *erosion* of the *dilation* of the image by the structuring element. + + Parameters + ---------- + + input : array_like + Binary array_like to be closed. Non-zero (True) elements form + the subset to be closed. + + structure : array_like, optional + Structuring element used for the closing. Non-zero elements are + considered True. If no structuring element is provided an element + is generated with a square connectivity equal to one (i.e., only + nearest neighbors are connected to the center, diagonally-connected + elements are not considered neighbors). + + iterations : {int, float}, optional + The dilation step of the closing, then the erosion step are each + repeated `iterations` times (one, by default). If iterations is + less than 1, each operations is repeated until the result does + not change anymore. + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin : int or tuple of ints, optional + Placement of the filter, by default 0. + + Returns + ------- + + out : ndarray of bools + Closing of the input by the structuring element. + + + See also + -------- + + grey_closing, binary_opening, binary_dilation, binary_erosion, + generate_binary_structure + + Notes + ----- + + *Closing* [1]_ is a mathematical morphology operation [2]_ that + consists in the succession of a dilation and an erosion of the + input with the same structuring element. Closing therefore fills + holes smaller than the structuring element. + + Together with *opening* (`binary_opening`), closing can be used for + noise removal. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Closing_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((5,5), dtype=np.int) + >>> a[1:-1, 1:-1] = 1; a[2,2] = 0 + >>> a + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 0, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + >>> # Closing removes small holes + >>> ndimage.binary_closing(a).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + >>> # Closing is the erosion of the dilation of the input + >>> ndimage.binary_dilation(a).astype(np.int) + array([[0, 1, 1, 1, 0], + [1, 1, 1, 1, 1], + [1, 1, 1, 1, 1], + [1, 1, 1, 1, 1], + [0, 1, 1, 1, 0]]) + >>> ndimage.binary_erosion(ndimage.binary_dilation(a)).astype(np.int) + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[1:6, 2:5] = 1; a[1:3,3] = 0 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 0, 1, 0, 0], + [0, 0, 1, 0, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> # In addition to removing holes, closing can also + >>> # coarsen boundaries with fine hollows. + >>> ndimage.binary_closing(a).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 0, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.binary_closing(a, structure=np.ones((2,2))).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + """ input = numpy.asarray(input) if structure is None: @@ -244,15 +789,104 @@ def binary_hit_or_miss(input, structure1 = None, structure2 = None, output = None, origin1 = 0, origin2 = None): - """Multi-dimensional binary hit-or-miss transform. + """ + Multi-dimensional binary hit-or-miss transform. - An output array can optionally be provided. The origin parameters - controls the placement of the structuring elements. If the first - structuring element is not given one is generated with a squared - connectivity equal to one. If the second structuring element is - not provided, it set equal to the inverse of the first structuring - element. If the origin for the second structure is equal to None - it is set equal to the origin of the first. + The hit-or-miss transform finds the locations of a given pattern + inside the input image. + + Parameters + ---------- + + input : array_like (cast to booleans) + Binary image where a pattern is to be detected. + + structure1 : array_like (cast to booleans), optional + Part of the structuring element to be fitted to the foreground + (non-zero elements) of `input`. If no value is provided, a + structure of square connectivity 1 is chosen. + + structure2 : array_like (cast to booleans), optional + Second part of the structuring element that has to miss completely + the foreground. If no value is provided, the complementary of + `structure1` is taken. + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin1 : int or tuple of ints, optional + Placement of the first part of the structuring element `structure1`, + by default 0 for a centered structure. + + origin2 : int or tuple of ints, optional + Placement of the second part of the structuring element `structure2`, + by default 0 for a centered structure. If a value is provided for + `origin1` and not for `origin2`, then `origin2` is set to `origin1`. + + Returns + ------- + + output : ndarray + Hit-or-miss transform of `input` with the given structuring + element (`structure1`, `structure2`). + + See also + -------- + + ndimage.morphology, binary_erosion + + + Notes + ----- + + + + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Hit-or-miss_transform + + Examples + -------- + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[1, 1] = 1; a[2:4, 2:4] = 1; a[4:6, 4:6] = 1 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 0, 0, 0], + [0, 0, 1, 1, 0, 0, 0], + [0, 0, 0, 0, 1, 1, 0], + [0, 0, 0, 0, 1, 1, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> structure1 = np.array([[1, 0, 0], [0, 1, 1], [0, 1, 1]]) + >>> structure1 + array([[1, 0, 0], + [0, 1, 1], + [0, 1, 1]]) + >>> # Find the matches of structure1 in the array a + >>> ndimage.binary_hit_or_miss(a, structure1=structure1).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> # Change the origin of the filter + >>> # origin1=1 is equivalent to origin1=(1,1) here + >>> ndimage.binary_hit_or_miss(a, structure1=structure1,\\ + ... origin1=1).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 1, 0], + [0, 0, 0, 0, 0, 0, 0]]) + """ input = numpy.asarray(input) if structure1 is None: @@ -279,28 +913,218 @@ def binary_propagation(input, structure = None, mask = None, output = None, border_value = 0, origin = 0): - """Multi-dimensional binary propagation with the given structure. + """ + Multi-dimensional binary propagation with the given structuring element. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. If a mask is given, only those elements with a true value at - the corresponding mask element are. + Parameters + ---------- + + input : array_like + Binary image to be propagated inside `mask`. + + structure : array_like + Structuring element used in the successive dilations. The output + may depend on the structuring element, especially if `mask` has + several connex components. If no structuring element is + provided, an element is generated with a squared connectivity equal + to one. + + mask : array_like + Binary mask defining the region into which `input` is allowed to + propagate. + + output : ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin : int or tuple of ints, optional + Placement of the filter, by default 0. + + Returns + ------- + + ouput : ndarray + Binary propagation of `input` inside `mask`. + + Notes + ----- + This function is functionally equivalent to calling binary_dilation with the number of iterations less then one: iterative dilation until the result does not change anymore. + + The succession of an erosion and propagation inside the original image + can be used instead of an *opening* for deleting small objects while + keeping the contours of larger objects untouched. + + References + ---------- + + .. [1] http://cmm.ensmp.fr/~serra/cours/pdf/en/ch6en.pdf, slide 15. + + .. [2] http://www.qi.tnw.tudelft.nl/Courses/FIP/noframes/fip-Morpholo.html#Heading102 + + Examples + -------- + + >>> input = np.zeros((8, 8), dtype=np.int) + >>> input[2, 2] = 1 + >>> mask = np.zeros((8, 8), dtype=np.int) + >>> mask[1:4, 1:4] = mask[4, 4] = mask[6:8, 6:8] = 1 + >>> input + array([[0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0]]) + >>> mask + array([[0, 0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 1, 1], + [0, 0, 0, 0, 0, 0, 1, 1]]) + >>> ndimage.binary_propagation(input, mask=mask).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.binary_propagation(input, mask=mask,\\ + ... structure=np.ones((3,3))).astype(np.int) + array([[0, 0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 1, 1, 1, 0, 0, 0, 0], + [0, 0, 0, 0, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0]]) + + >>> # Comparison between opening and erosion+propagation + >>> a = np.zeros((6,6), dtype=np.int) + >>> a[2:5, 2:5] = 1; a[0, 0] = 1; a[5, 5] = 1 + >>> a + array([[1, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 0, 0, 0, 1]]) + >>> ndimage.binary_opening(a).astype(np.int) + array([[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 0, 1, 0, 0], + [0, 0, 0, 0, 0, 0]]) + >>> b = ndimage.binary_erosion(a) + >>> b.astype(int) + array([[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 1, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0]]) + >>> ndimage.binary_propagation(b, mask=a).astype(np.int) + array([[0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 1, 1, 1, 0], + [0, 0, 0, 0, 0, 0]]) + """ return binary_dilation(input, structure, -1, mask, output, border_value, origin) def binary_fill_holes(input, structure = None, output = None, origin = 0): - """Fill the holes in binary objects. + """ + Fill the holes in binary objects. - An output array can optionally be provided. The origin parameter - controls the placement of the filter. If no structuring element is - provided an element is generated with a squared connectivity equal - to one. + + Parameters + ---------- + + input: array_like + n-dimensional binary array with holes to be filled + + structure: array_like, optional + Structuring element used in the computation; large-size elements + make computations faster but may miss holes separated from the + background by thin regions. The default element (with a square + connectivity equal to one) yields the intuitive result where all + holes in the input have been filled. + + output: ndarray, optional + Array of the same shape as input, into which the output is placed. + By default, a new array is created. + + origin: int, tuple of ints, optional + Position of the structuring element. + + Returns + ------- + + out: ndarray + Transformation of the initial image `input` where holes have been + filled. + + See also + -------- + + binary_dilation, binary_propagation, label + + Notes + ----- + + The algorithm used in this function consists in invading the complementary + of the shapes in `input` from the outer boundary of the image, + using binary dilations. Holes are not connected to the boundary and are + therefore not invaded. The result is the complementary subset of the + invaded region. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Mathematical_morphology + + + Examples + -------- + + >>> a = np.zeros((5, 5), dtype=int) + >>> a[1:4, 1:4] = 1 + >>> a[2,2] = 0 + >>> a + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 0, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + >>> ndimage.binary_fill_holes(a).astype(int) + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + >>> # Too big structuring element + >>> ndimage.binary_fill_holes(a, structure=np.ones((5,5))).astype(int) + array([[0, 0, 0, 0, 0], + [0, 1, 1, 1, 0], + [0, 1, 0, 1, 0], + [0, 1, 1, 1, 0], + [0, 0, 0, 0, 0]]) + """ mask = numpy.logical_not(input) tmp = numpy.zeros(mask.shape, bool) @@ -316,13 +1140,123 @@ def grey_erosion(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Calculate a grey values erosion. + """ + Calculate a greyscale erosion, using either a structuring element, + or a footprint corresponding to a flat structuring element. - Either a size or a footprint, or the structure must be provided. An - output array can optionally be provided. The origin parameter - controls the placement of the filter. The mode parameter - determines how the array borders are handled, where cval is the - value when mode is equal to 'constant'. + Grayscale erosion is a mathematical morphology operation. For the + simple case of a full and flat structuring element, it can be viewed + as a minimum filter over a sliding window. + + Parameters + ---------- + + input : array_like + Array over which the grayscale erosion is to be computed. + + size : tuple of ints + Shape of a flat and full structuring element used for the + grayscale erosion. Optional if `footprint` is provided. + + footprint : array of ints, optional + Positions of non-infinite elements of a flat structuring element + used for the grayscale erosion. Non-zero values give the set of + neighbors of the center over which the minimum is chosen. + + structure : array of ints, optional + Structuring element used for the grayscale erosion. `structure` + may be a non-flat structuring element. + + output : array, optional + An array used for storing the ouput of the erosion may be provided. + + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The `mode` parameter determines how the array borders are + handled, where `cval` is the value when mode is equal to + 'constant'. Default is 'reflect' + + cval : scalar, optional + Value to fill past edges of input if `mode` is 'constant'. Default + is 0.0. + + origin : scalar, optional + The `origin` parameter controls the placement of the filter. + Default 0 + + + Returns + ------- + + output : ndarray + Grayscale erosion of `input`. + + See also + -------- + + binary_erosion, grey_dilation, grey_opening, grey_closing + + generate_binary_structure + + ndimage.minimum_filter + + Notes + ----- + + The grayscale erosion of an image input by a structuring element s defined + over a domain E is given by: + + (input+s)(x) = min {input(y) - s(x-y), for y in E} + + In particular, for structuring elements defined as + s(y) = 0 for y in E, the grayscale erosion computes the minimum of the + input image inside a sliding window defined by E. + + Grayscale erosion [1]_ is a *mathematical morphology* operation [2]_. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Erosion_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[1:6, 1:6] = 3 + >>> a[4,4] = 2; a[2,3] = 1 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 3, 3, 3, 3, 3, 0], + [0, 3, 3, 1, 3, 3, 0], + [0, 3, 3, 3, 3, 3, 0], + [0, 3, 3, 3, 2, 3, 0], + [0, 3, 3, 3, 3, 3, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.grey_erosion(a, size=(3,3)) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 3, 2, 2, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> footprint = ndimage.generate_binary_structure(2, 1) + >>> footprint + array([[False, True, False], + [ True, True, True], + [False, True, False]], dtype=bool) + >>> # Diagonally-connected elements are not considered neighbors + >>> ndimage.grey_erosion(a, size=(3,3), footprint=footprint) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 3, 1, 2, 0, 0], + [0, 0, 3, 2, 2, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + """ return filters._min_or_max_filter(input, size, footprint, structure, output, mode, cval, origin, 1) @@ -330,13 +1264,139 @@ def grey_dilation(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Calculate a grey values dilation. + """ + Calculate a greyscale dilation, using either a structuring element, + or a footprint corresponding to a flat structuring element. - Either a size or a footprint, or the structure must be - provided. An output array can optionally be provided. The origin - parameter controls the placement of the filter. The mode parameter - determines how the array borders are handled, where cval is the - value when mode is equal to 'constant'. + Grayscale dilation is a mathematical morphology operation. For the + simple case of a full and flat structuring element, it can be viewed + as a maximum filter over a sliding window. + + Parameters + ---------- + + input : array_like + Array over which the grayscale dilation is to be computed. + + size : tuple of ints + Shape of a flat and full structuring element used for the + grayscale dilation. Optional if `footprint` is provided. + + footprint : array of ints, optional + Positions of non-infinite elements of a flat structuring element + used for the grayscale dilation. Non-zero values give the set of + neighbors of the center over which the maximum is chosen. + + structure : array of ints, optional + Structuring element used for the grayscale dilation. `structure` + may be a non-flat structuring element. + + output : array, optional + An array used for storing the ouput of the dilation may be provided. + + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The `mode` parameter determines how the array borders are + handled, where `cval` is the value when mode is equal to + 'constant'. Default is 'reflect' + + cval : scalar, optional + Value to fill past edges of input if `mode` is 'constant'. Default + is 0.0. + + origin : scalar, optional + The `origin` parameter controls the placement of the filter. + Default 0 + + + Returns + ------- + + output : ndarray + Grayscale dilation of `input`. + + See also + -------- + + binary_dilation, grey_erosion, grey_closing, grey_opening + + generate_binary_structure + + ndimage.maximum_filter + + Notes + ----- + + The grayscale dilation of an image input by a structuring element s defined + over a domain E is given by: + + (input+s)(x) = max {input(y) + s(x-y), for y in E} + + In particular, for structuring elements defined as + s(y) = 0 for y in E, the grayscale dilation computes the maximum of the + input image inside a sliding window defined by E. + + Grayscale dilation [1]_ is a *mathematical morphology* operation [2]_. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Dilation_%28morphology%29 + + .. [2] http://en.wikipedia.org/wiki/Mathematical_morphology + + + Examples + -------- + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[2:5, 2:5] = 1 + >>> a[4,4] = 2; a[2,3] = 3 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 3, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 2, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.grey_dilation(a, size=(3,3)) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 3, 3, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.grey_dilation(a, footprint=np.ones((3,3))) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 3, 3, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> s = ndimage.generate_binary_structure(2,1) + >>> s + array([[False, True, False], + [ True, True, True], + [False, True, False]], dtype=bool) + >>> ndimage.grey_dilation(a, footprint=s) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 3, 1, 0, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 1, 3, 2, 1, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 0, 1, 1, 2, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.grey_dilation(a, size=(3,3), structure=np.ones((3,3))) + array([[1, 1, 1, 1, 1, 1, 1], + [1, 2, 4, 4, 4, 2, 1], + [1, 2, 4, 4, 4, 2, 1], + [1, 2, 4, 4, 4, 3, 1], + [1, 2, 2, 3, 3, 3, 1], + [1, 2, 2, 3, 3, 3, 1], + [1, 1, 1, 1, 1, 1, 1]]) + """ if structure is not None: structure = numpy.asarray(structure) @@ -362,13 +1422,92 @@ def grey_opening(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Multi-dimensional grey valued opening. + """ + Multi-dimensional greyscale opening. - Either a size or a footprint, or the structure must be provided. An - output array can optionally be provided. The origin parameter - controls the placement of the filter. The mode parameter - determines how the array borders are handled, where cval is the - value when mode is equal to 'constant'. + A greyscale opening consists in the succession of a greyscale erosion, + and a greyscale dilation. + + Parameters + ---------- + + input : array_like + Array over which the grayscale opening is to be computed. + + size : tuple of ints + Shape of a flat and full structuring element used for the + grayscale opening. Optional if `footprint` is provided. + + footprint : array of ints, optional + Positions of non-infinite elements of a flat structuring element + used for the grayscale opening. + + structure : array of ints, optional + Structuring element used for the grayscale opening. `structure` + may be a non-flat structuring element. + + output : array, optional + An array used for storing the ouput of the opening may be provided. + + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The `mode` parameter determines how the array borders are + handled, where `cval` is the value when mode is equal to + 'constant'. Default is 'reflect' + + cval : scalar, optional + Value to fill past edges of input if `mode` is 'constant'. Default + is 0.0. + + origin : scalar, optional + The `origin` parameter controls the placement of the filter. + Default 0 + + Returns + ------- + + output : ndarray + Result of the grayscale opening of `input` with `structure`. + + See also + -------- + + binary_opening, grey_dilation, grey_erosion, grey_closing + + generate_binary_structure + + Notes + ----- + + The action of a grayscale opening with a flat structuring element amounts + to smoothen high local maxima, whereas binary opening erases small objects. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Mathematical_morphology + + + Examples + -------- + + >>> a = np.arange(36).reshape((6,6)) + >>> a[3, 3] = 50 + >>> a + array([[ 0, 1, 2, 3, 4, 5], + [ 6, 7, 8, 9, 10, 11], + [12, 13, 14, 15, 16, 17], + [18, 19, 20, 50, 22, 23], + [24, 25, 26, 27, 28, 29], + [30, 31, 32, 33, 34, 35]]) + >>> ndimage.grey_opening(a, size=(3,3)) + array([[ 0, 1, 2, 3, 4, 4], + [ 6, 7, 8, 9, 10, 10], + [12, 13, 14, 15, 16, 16], + [18, 19, 20, 22, 22, 22], + [24, 25, 26, 27, 28, 28], + [24, 25, 26, 27, 28, 28]]) + >>> # Note that the local maximum a[3,3] has disappeared + """ tmp = grey_erosion(input, size, footprint, structure, None, mode, cval, origin) @@ -378,13 +1517,92 @@ def grey_closing(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Multi-dimensional grey valued closing. + """ + Multi-dimensional greyscale closing. - Either a size or a footprint, or the structure must be provided. An - output array can optionally be provided. The origin parameter - controls the placement of the filter. The mode parameter - determines how the array borders are handled, where cval is the - value when mode is equal to 'constant'. + A greyscale closing consists in the succession of a greyscale dilation, + and a greyscale erosion. + + Parameters + ---------- + + input : array_like + Array over which the grayscale closing is to be computed. + + size : tuple of ints + Shape of a flat and full structuring element used for the + grayscale closing. Optional if `footprint` is provided. + + footprint : array of ints, optional + Positions of non-infinite elements of a flat structuring element + used for the grayscale closing. + + structure : array of ints, optional + Structuring element used for the grayscale closing. `structure` + may be a non-flat structuring element. + + output : array, optional + An array used for storing the ouput of the closing may be provided. + + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The `mode` parameter determines how the array borders are + handled, where `cval` is the value when mode is equal to + 'constant'. Default is 'reflect' + + cval : scalar, optional + Value to fill past edges of input if `mode` is 'constant'. Default + is 0.0. + + origin : scalar, optional + The `origin` parameter controls the placement of the filter. + Default 0 + + Returns + ------- + + output : ndarray + Result of the grayscale closing of `input` with `structure`. + + See also + -------- + + binary_closing, grey_dilation, grey_erosion, grey_opening + + generate_binary_structure + + Notes + ----- + + The action of a grayscale closing with a flat structuring element amounts + to smoothen deep local minima, whereas binary closing fills small holes. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Mathematical_morphology + + + Examples + -------- + + >>> a = np.arange(36).reshape((6,6)) + >>> a[3,3] = 0 + >>> a + array([[ 0, 1, 2, 3, 4, 5], + [ 6, 7, 8, 9, 10, 11], + [12, 13, 14, 15, 16, 17], + [18, 19, 20, 0, 22, 23], + [24, 25, 26, 27, 28, 29], + [30, 31, 32, 33, 34, 35]]) + >>> ndimage.grey_closing(a, size=(3,3)) + array([[ 7, 7, 8, 9, 10, 11], + [ 7, 7, 8, 9, 10, 11], + [13, 13, 14, 15, 16, 17], + [19, 19, 20, 20, 22, 23], + [25, 25, 26, 27, 28, 29], + [31, 31, 32, 33, 34, 35]]) + >>> # Note that the local minimum a[3,3] has disappeared + """ tmp = grey_dilation(input, size, footprint, structure, None, mode, cval, origin) @@ -395,13 +1613,120 @@ def morphological_gradient(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Multi-dimensional morphological gradient. + """ + Multi-dimensional morphological gradient. - Either a size or a footprint, or the structure must be provided. An - output array can optionally be provided. The origin parameter - controls the placement of the filter. The mode parameter - determines how the array borders are handled, where cval is the - value when mode is equal to 'constant'. + The morphological gradient is calculated as the difference between a + dilation and an erosion of the input with a given structuring element. + + + Parameters + ---------- + + input : array_like + Array over which to compute the morphlogical gradient. + + size : tuple of ints + Shape of a flat and full structuring element used for the + mathematical morphology operations. Optional if `footprint` + is provided. A larger `size` yields a more blurred gradient. + + footprint : array of ints, optional + Positions of non-infinite elements of a flat structuring element + used for the morphology operations. Larger footprints + give a more blurred morphological gradient. + + structure : array of ints, optional + Structuring element used for the morphology operations. + `structure` may be a non-flat structuring element. + + output : array, optional + An array used for storing the ouput of the morphological gradient + may be provided. + + mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional + The `mode` parameter determines how the array borders are + handled, where `cval` is the value when mode is equal to + 'constant'. Default is 'reflect' + + cval : scalar, optional + Value to fill past edges of input if `mode` is 'constant'. Default + is 0.0. + + origin : scalar, optional + The `origin` parameter controls the placement of the filter. + Default 0 + + Returns + ------- + + output : ndarray + Morphological gradient of `input`. + + See also + -------- + + grey_dilation, grey_erosion + + ndimage.gaussian_gradient_magnitude + + Notes + ----- + + For a flat structuring element, the morphological gradient + computed at a given point corresponds to the maximal difference + between elements of the input among the elements covered by the + structuring element centered on the point. + + References + ---------- + + .. [1] http://en.wikipedia.org/wiki/Mathematical_morphology + + Examples + -------- + + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[2:5, 2:5] = 1 + >>> ndimage.morphological_gradient(a, size=(3,3)) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 0, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> # The morphological gradient is computed as the difference + >>> # between a dilation and an erosion + >>> ndimage.grey_dilation(a, size=(3,3)) -\\ + ... ndimage.grey_erosion(a, size=(3,3)) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 0, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> a = np.zeros((7,7), dtype=np.int) + >>> a[2:5, 2:5] = 1 + >>> a[4,4] = 2; a[2,3] = 3 + >>> a + array([[0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 1, 3, 1, 0, 0], + [0, 0, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 2, 0, 0], + [0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0]]) + >>> ndimage.morphological_gradient(a, size=(3,3)) + array([[0, 0, 0, 0, 0, 0, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 3, 3, 1, 0], + [0, 1, 3, 2, 3, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 1, 1, 2, 2, 2, 0], + [0, 0, 0, 0, 0, 0, 0]]) + """ tmp = grey_dilation(input, size, footprint, structure, None, mode, cval, origin) @@ -470,13 +1795,26 @@ def black_tophat(input, size = None, footprint = None, structure = None, output = None, mode = "reflect", cval = 0.0, origin = 0): - """Multi-dimensional black tophat filter. + """ + Multi-dimensional black tophat filter. Either a size or a footprint, or the structure must be provided. An output array can optionally be provided. The origin parameter controls the placement of the filter. The mode parameter determines how the array borders are handled, where cval is the value when mode is equal to 'constant'. + + See also + -------- + + grey_opening, grey_closing + + References + ---------- + + .. [1] http://cmm.ensmp.fr/Micromorph/course/sld011.htm, and following slides + .. [2] http://en.wikipedia.org/wiki/Top-hat_transform + """ tmp = grey_dilation(input, size, footprint, structure, None, mode, cval, origin) From scipy-svn at scipy.org Mon May 24 09:11:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:11:07 -0500 (CDT) Subject: [Scipy-svn] r6406 - trunk/scipy/stats Message-ID: <20100524131107.B2FE739CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:11:07 -0500 (Mon, 24 May 2010) New Revision: 6406 Modified: trunk/scipy/stats/kde.py trunk/scipy/stats/stats.py Log: DOC: merge wiki edits - stats module. Modified: trunk/scipy/stats/kde.py =================================================================== --- trunk/scipy/stats/kde.py 2010-05-24 13:10:50 UTC (rev 6405) +++ trunk/scipy/stats/kde.py 2010-05-24 13:11:07 UTC (rev 6406) @@ -62,6 +62,8 @@ integrate pdf over a rectangular space between low_bounds and high_bounds kde.integrate_kde(other_kde) : float integrate two kernel density estimates multiplied together + kde.resample(size=None) : array + randomly sample a dataset from the estimated pdf. Internal Methods ---------------- Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-05-24 13:10:50 UTC (rev 6405) +++ trunk/scipy/stats/stats.py 2010-05-24 13:11:07 UTC (rev 6406) @@ -26,8 +26,8 @@ A collection of basic statistical functions for python. The function names appear below. - *** Some scalar functions defined here are also available in the scipy.special - package where they work on arbitrary sized arrays. **** + Some scalar functions defined here are also available in the scipy.special + package where they work on arbitrary sized arrays. Disclaimers: The function list is obviously incomplete and, worse, the functions are not optimized. All functions have been tested (some more @@ -353,9 +353,10 @@ def gmean(a, axis=0, dtype=None): - """Compute the geometric mean along the specified axis. + """ + Compute the geometric mean along the specified axis. - Returns the geometric average of the array elements. + Returns the geometric average of the array elements. That is: n-th root of (x1 * x2 * ... * xn) Parameters @@ -365,14 +366,16 @@ axis : int, optional, default axis=0 Axis along which the geometric mean is computed. dtype : dtype, optional - Type of the returned array and of the accumulator in which the elements are summed. - If dtype is not specified, it defaults to the dtype of a, unless a has an integer - dtype with a precision less than that of the default platform integer. In that case, - the default platform integer is used. + Type of the returned array and of the accumulator in which the + elements are summed. If dtype is not specified, it defaults to the + dtype of a, unless a has an integer dtype with a precision less than + that of the default platform integer. In that case, the default + platform integer is used. Returns ------- - gmean : ndarray, see dtype parameter above + gmean : ndarray, + see dtype parameter above See Also -------- @@ -381,14 +384,14 @@ hmean: Harmonic mean Notes - ------- + ----- The geometric average is computed over a single dimension of the input array, axis=0 by default, or all values in the array if axis=None. float64 intermediate and return values are used for integer inputs. - Use masked arrays to ignore any non-finite values in the input or that arise in the - calculations such as Not a Number and infinity because masked arrays automatically - mask any non-finite values. + Use masked arrays to ignore any non-finite values in the input or that + arise in the calculations such as Not a Number and infinity because masked + arrays automatically mask any non-finite values. """ if not isinstance(a, np.ndarray): #if not an ndarray object attempt to convert it @@ -403,7 +406,8 @@ return np.exp(log_a.mean(axis=axis)) def hmean(a, axis=0, dtype=None): - """Calculates the harmonic mean along the specified axis. + """ + Calculates the harmonic mean along the specified axis. That is: n / (1/x1 + 1/x2 + ... + 1/xn) @@ -414,14 +418,16 @@ axis : int, optional, default axis=0 Axis along which the harmonic mean is computed. dtype : dtype, optional - Type of the returned array and of the accumulator in which the elements are summed. - If dtype is not specified, it defaults to the dtype of a, unless a has an integer - dtype with a precision less than that of the default platform integer. In that case, - the default platform integer is used. + Type of the returned array and of the accumulator in which the + elements are summed. If dtype is not specified, it defaults to the + dtype of a, unless a has an integer dtype with a precision less than + that of the default platform integer. In that case, the default + platform integer is used. Returns ------- - hmean : ndarray, see dtype parameter above + hmean : ndarray, + see dtype parameter above See Also -------- @@ -430,13 +436,13 @@ gmean: Geometric mean Notes - ------- + ----- The harmonic mean is computed over a single dimension of the input array, axis=0 by default, or all values in the array if axis=None. float64 intermediate and return values are used for integer inputs. - Use masked arrays to ignore any non-finite values in the input or that arise in the - calculations such as Not a Number and infinity. + Use masked arrays to ignore any non-finite values in the input or that + arise in the calculations such as Not a Number and infinity. """ if not isinstance(a, np.ndarray): @@ -457,7 +463,8 @@ def mean(a, axis=0): - """Returns the arithmetic mean of m along the given dimension. + """ + Returns the arithmetic mean of m along the given dimension. That is: (x1 + x2 + .. + xn) / n @@ -471,6 +478,22 @@ The arithmetic mean computed over a single dimension of the input array or all values in the array if axis=None. The return value will have a floating point dtype even if the input data are integers. + + + Notes + ----- + scipy.stats.mean is deprecated; please update your code to use numpy.mean. + + Please note that: + - numpy.mean axis argument defaults to None, not 0 + - numpy.mean has a ddof argument to replace bias in a more general + manner. + - scipy.stats.mean(a, bias=True) can be replaced by :: + + numpy.mean(x, axis=0, ddof=1) + + removed in scipy 0.8.0 + """ raise DeprecationWarning("""\ scipy.stats.mean is deprecated; please update your code to use numpy.mean. @@ -843,21 +866,29 @@ ##################################### def moment(a, moment=1, axis=0): - """Calculates the nth moment about the mean for a sample. + """ + Calculates the nth moment about the mean for a sample. Generally used to calculate coefficients of skewness and kurtosis. Parameters ---------- - a : array + a : array_like + data moment : int + order of central moment that is returned axis : int or None + Axis along which the central moment is computed. If None, then the data + array is raveled. The default axis is zero. Returns ------- - The appropriate moment along the given axis or over all values if axis is - None. + n-th central moment : ndarray or float + The appropriate moment along the given axis or over all values if axis + is None. The denominator for the moment calculation is the number of + observations, no degrees of freedom correction is done. + """ a, axis = _chk_asarray(a, axis) if moment == 1: @@ -900,7 +931,8 @@ def skew(a, axis=0, bias=True): - """Computes the skewness of a data set. + """ + Computes the skewness of a data set. For normally distributed data, the skewness should be about 0. A skewness value > 0 means that there is more weight in the left tail of the @@ -909,15 +941,18 @@ Parameters ---------- - a : array + a : ndarray + data axis : int or None + axis along which skewness is calculated bias : bool If False, then the calculations are corrected for statistical bias. Returns ------- - The skewness of values along an axis, returning 0 where all values are - equal. + skewness : ndarray + The skewness of values along an axis, returning 0 where all values are + equal. References ---------- @@ -946,21 +981,24 @@ return vals def kurtosis(a, axis=0, fisher=True, bias=True): - """Computes the kurtosis (Fisher or Pearson) of a dataset. + """ + Computes the kurtosis (Fisher or Pearson) of a dataset. - Kurtosis is the fourth central moment divided by the square of the variance. - If Fisher's definition is used, then 3.0 is subtracted from the result to - give 0.0 for a normal distribution. + Kurtosis is the fourth central moment divided by the square of the + variance. If Fisher's definition is used, then 3.0 is subtracted from + the result to give 0.0 for a normal distribution. If bias is False then the kurtosis is calculated using k statistics to - eliminate bias comming from biased moment estimators + eliminate bias coming from biased moment estimators Use kurtosistest() to see if result is close enough to normal. Parameters ---------- a : array + data for which the kurtosis is calculated axis : int or None + Axis along which the kurtosis is calculated fisher : bool If True, Fisher's definition is used (normal ==> 0.0). If False, Pearson's definition is used (normal ==> 3.0). @@ -969,8 +1007,9 @@ Returns ------- - The kurtosis of values along an axis. If all values are equal, return -3 for Fisher's - definition and 0 for Pearson's definition. + kurtosis : array + The kurtosis of values along an axis. If all values are equal, + return -3 for Fisher's definition and 0 for Pearson's definition. References @@ -1005,21 +1044,40 @@ return vals def describe(a, axis=0): - """Computes several descriptive statistics of the passed array. + """ + Computes several descriptive statistics of the passed array. Parameters ---------- - a : array + a : array_like + data axis : int or None + axis along which statistics are calculated. If axis is None, then data + array is raveled. The default axis is zero. Returns ------- - (size of the data, - (min, max), - arithmetic mean, - unbiased variance, - biased skewness, - biased kurtosis) + size of the data : int + length of data along axis + (min, max): tuple of ndarrays or floats + minimum and maximum value of data array + arithmetic mean : ndarray or float + mean of data along axis + unbiased variance : ndarray or float + variance of the data along axis, denominator is number of observations + minus one. + biased skewness : ndarray or float + skewness, based on moment calculations with denominator equal to the + number of observations, i.e. no degrees of freedom correction + biased kurtosis : ndarray or float + kurtosis (Fisher), the kurtosis is normalized so that it is zero for the + normal distribution. No degrees of freedom or bias correction is used. + + See Also + -------- + skew + kurtosis + """ a, axis = _chk_asarray(a, axis) n = a.shape[axis] @@ -1351,9 +1409,9 @@ def histogram(a, numbins=10, defaultlimits=None, weights=None, printextras=False): """ - Separates the range into several bins and returns the number of instances of a - in each bin. This histogram is based on numpy's histogram but has a larger - range by default if defaultlimits is not set. + Separates the range into several bins and returns the number of instances + of a in each bin. This histogram is based on numpy's histogram but has a + larger range by default if default limits is not set. Parameters ---------- @@ -1363,14 +1421,15 @@ The number of bins to use for the histogram. Default is 10. defaultlimits: tuple (lower, upper), optional The lower and upper values for the range of the histogram. - If no value is given, a range slightly larger then the range of the values - in a is used. Specifically (a.min() - s, a.max() + s), + If no value is given, a range slightly larger then the range of the + values in a is used. Specifically (a.min() - s, a.max() + s), where s is (1/2)(a.max() - a.min()) / (numbins - 1) weights: array like, same length as a, optional - The weights for each value in a. Default is None, which gives each value a - weight of 1.0 + The weights for each value in a. Default is None, which gives each + value a weight of 1.0 printextras: boolean, optional - If True, the number of extra points is printed to standard output. Default is False + If True, the number of extra points is printed to standard output. + Default is False Returns ------- @@ -1386,6 +1445,7 @@ See Also -------- numpy.histogram + """ a = np.ravel(a) # flatten any >1D arrays if defaultlimits is None: @@ -2076,6 +2136,9 @@ as the one computed from these datasets. The p-values are not entirely reliable but are probably reasonable for datasets larger than 500 or so. + spearmanr currently does not do any tie correction, and is only correct + if there are no ties in the data. + Parameters ---------- x : 1D array @@ -2253,12 +2316,28 @@ slope of the regression line intercept : float intercept of the regression line + r-value : float + correlation coefficient p-value : float two-sided p-value for a hypothesis test whose null hypothesis is that the slope is zero. stderr : float Standard error of the estimate + + Examples + -------- + >>> from scipy import stats + >>> import numpy as np + >>> x = np.random.random(10) + >>> y = np.random.random(10) + >>> slope, intercept, r_value, p_value, std_err = stats.linregress(x,y) + + # To get coefficient of determination (r_squared) + + >>> print "r-squared:", r_value**2 + r-squared: 0.15286643777 + """ TINY = 1.0e-20 if len(args) == 1: # more than 1D array? From scipy-svn at scipy.org Mon May 24 09:11:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:11:26 -0500 (CDT) Subject: [Scipy-svn] r6407 - in trunk/doc/source: . tutorial Message-ID: <20100524131126.295CD39CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:11:26 -0500 (Mon, 24 May 2010) New Revision: 6407 Modified: trunk/doc/source/fftpack.rst trunk/doc/source/maxentropy.rst trunk/doc/source/special.rst trunk/doc/source/tutorial/interpolate.rst trunk/doc/source/tutorial/signal.rst trunk/doc/source/weave.rst Log: DOC: merge wiki edits - scipy-docs. Modified: trunk/doc/source/fftpack.rst =================================================================== --- trunk/doc/source/fftpack.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/fftpack.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -1,4 +1,149 @@ ========================================= +Fourier Transforms (:mod:`scipy.fftpack`) +========================================= + +.. sectionauthor:: Scipy Developers + +.. currentmodule:: scipy.fftpack + +.. warning:: + + This is currently a stub page + + +.. contents:: + + +Fourier analysis is fundamentally a method for expressing a function as a +sum of periodic components, and for recovering the signal from those +components. When both the function and its Fourier transform are +replaced with discretized counterparts, it is called the discrete Fourier +transform (DFT). The DFT has become a mainstay of numerical computing in +part because of a very fast algorithm for computing it, called the Fast +Fourier Transform (FFT), which was known to Gauss (1805) and was brought +to light in its current form by Cooley and Tukey [CT]_. Press et al. [NR]_ +provide an accessible introduction to Fourier analysis and its +applications. + + +Fast Fourier transforms +----------------------- + +One dimensional discrete Fourier transforms +------------------------------------------- + +fft, ifft, rfft, irfft + + +Two and n dimensional discrete Fourier transforms +------------------------------------------------- + +fft in more than one dimension + + +Discrete Cosine Transforms +-------------------------- + + +Return the Discrete Cosine Transform [Mak]_ of arbitrary type sequence ``x``. + +For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to +matlab ``dct(x)``. + +There are theoretically 8 types of the DCT [WP]_, only the first 3 types are +implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' +Inverse DCT generally refers to DCT type 3. + +type I +~~~~~~ + +There are several definitions of the DCT-I; we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = x_0 + (-1)^k x_{N-1} + 2\sum_{n=1}^{N-2} x_n + \cos\left({\pi nk\over N-1}\right), + \qquad 0 \le k < N. \] + +Only None is supported as normalization mode for DCT-I. Note also that the +DCT-I is only supported for input size > 1 + +type II +~~~~~~~ + +There are several definitions of the DCT-II; we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = 2 \sum_{n=0}^{N-1} x_n + \cos \left({\pi(2n+1)k \over 2N} \right) + \qquad 0 \le k < N.\] + +If ``norm='ortho'``, :math:`y_k` is multiplied by a scaling factor `f`: + +.. math:: + :nowrap: + + \[f = \begin{cases} \sqrt{1/(4N)}, & \text{if $k = 0$} \\ + \sqrt{1/(2N)}, & \text{otherwise} \end{cases} \] + + +Which makes the corresponding matrix of coefficients orthonormal +(`OO' = Id`). + +type III +~~~~~~~~ + +There are several definitions, we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = x_0 + 2 \sum_{n=1}^{N-1} x_n + \cos\left({\pi n(2k+1) \over 2N}\right) + \qquad 0 \le k < N,\] + +or, for ``norm='ortho'``: + +.. math:: + :nowrap: + + \[ y_k = {x_0\over\sqrt{N}} + {1\over\sqrt{N}} \sum_{n=1}^{N-1} + x_n \cos\left({\pi n(2k+1) \over 2N}\right) + \qquad 0 \le k < N.\] + +The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up +to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of the +orthonormalized DCT-II. + +References +~~~~~~~~~~ + +.. [CT] Cooley, James W., and John W. Tukey, 1965, "An algorithm for the + machine calculation of complex Fourier series," *Math. Comput.* + 19: 297-301. + +.. [NR] Press, W., Teukolsky, S., Vetterline, W.T., and Flannery, B.P., + 2007, *Numerical Recipes: The Art of Scientific Computing*, ch. + 12-13. Cambridge Univ. Press, Cambridge, UK. + +.. [Mak] J. Makhoul, 1980, 'A Fast Cosine Transform in One and Two Dimensions', + `IEEE Transactions on acoustics, speech and signal processing` + vol. 28(1), pp. 27-34, http://dx.doi.org/10.1109/TASSP.1980.1163351 + +.. [WP] http://en.wikipedia.org/wiki/Discrete_cosine_transform + + +FFT convolution +--------------- + +scipy.fftpack.convolve performs a convolution of two one-dimensional +arrays in frequency domain. Fourier transforms (:mod:`scipy.fftpack`) ========================================= Modified: trunk/doc/source/maxentropy.rst =================================================================== --- trunk/doc/source/maxentropy.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/maxentropy.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -4,36 +4,40 @@ .. automodule:: scipy.maxentropy - Models ====== +.. autoclass:: scipy.maxentropy.basemodel -.. autoclass:: model +.. autosummary:: + :toctree: generated/ + basemodel.beginlogging + basemodel.endlogging + basemodel.clearcache + basemodel.crossentropy + basemodel.dual + basemodel.fit + basemodel.grad + basemodel.log + basemodel.logparams + basemodel.normconst + basemodel.reset + basemodel.setcallback + basemodel.setparams + basemodel.setsmooth + +.. autoclass:: scipy.maxentropy.model + .. autosummary:: :toctree: generated/ - model.beginlogging - model.endlogging - model.clearcache - model.crossentropy - model.dual - model.fit - model.grad - model.log - model.logparams - model.normconst - model.reset - model.setcallback - model.setparams - model.setsmooth model.expectations model.lognormconst model.logpmf model.pmf_function model.setfeaturesandsamplespace -.. autoclass:: bigmodel +.. autoclass:: scipy.maxentropy.bigmodel .. autosummary:: :toctree: generated/ @@ -48,7 +52,7 @@ bigmodel.stochapprox bigmodel.test -.. autoclass:: conditionalmodel +.. autoclass:: scipy.maxentropy.conditionalmodel .. autosummary:: :toctree: generated/ Modified: trunk/doc/source/special.rst =================================================================== --- trunk/doc/source/special.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/special.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -160,7 +160,7 @@ sph_kn sph_inkn -Ricatti-Bessel Functions +Riccati-Bessel Functions ^^^^^^^^^^^^^^^^^^^^^^^^ These are not universal functions: Modified: trunk/doc/source/tutorial/interpolate.rst =================================================================== --- trunk/doc/source/tutorial/interpolate.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/tutorial/interpolate.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -11,7 +11,8 @@ first facility is an interpolation class which performs linear 1-dimensional interpolation. The second facility is based on the FORTRAN library FITPACK and provides functions for 1- and -2-dimensional (smoothed) cubic-spline interpolation. +2-dimensional (smoothed) cubic-spline interpolation. There are both +procedural and object-oriented interfaces for the FITPACK library. Linear 1-d interpolation (:class:`interp1d`) @@ -22,11 +23,11 @@ anywhere within the domain defined by the given data using linear interpolation. An instance of this class is created by passing the 1-d vectors comprising the data. The instance of this class defines a -:meth:`__call__ ` method and can therefore by -treated like a function which interpolates between known data values -to obtain unknown values (it also has a docstring for help). Behavior -at the boundary can be specified at instantiation time. The following -example demonstrates it's use. +__call__ method and can therefore by treated like a function which +interpolates between known data values to obtain unknown values (it +also has a docstring for help). Behavior at the boundary can be +specified at instantiation time. The following example demonstrates +it's use. .. plot:: @@ -45,13 +46,13 @@ .. class :obj:`interpolate.interp1d` -Spline interpolation in 1-d (interpolate.splXXX) ------------------------------------------------- +Spline interpolation in 1-d: Procedural (interpolate.splXXX) +------------------------------------------------------------ Spline interpolation requires two essential steps: (1) a spline representation of the curve is computed, and (2) the spline is evaluated at the desired points. In order to find the spline -representation, there are two different was to represent a curve and +representation, there are two different ways to represent a curve and obtain (smoothing) spline coefficients: directly and parametrically. The direct method finds the spline representation of a curve in a two- dimensional plane using the function :obj:`splrep`. The @@ -84,7 +85,7 @@ Once the spline representation of the data has been determined, functions are available for evaluating the spline (:func:`splev`) and its derivatives -(:func:`splev`, :func:`splade`) at any point +(:func:`splev`, :func:`spalde`) at any point and the integral of the spline between any two points ( :func:`splint`). In addition, for cubic splines ( :math:`k=3` ) with 8 or more knots, the roots of the spline can be estimated ( @@ -160,10 +161,81 @@ >>> plt.title('Spline of parametrically-defined curve') >>> plt.show() +Spline interpolation in 1-d: Object-oriented (:class:`UnivariateSpline`) +----------------------------------------------------------------------------- -Two-dimensional spline representation (:func:`bisplrep`) --------------------------------------------------------- +The spline-fitting capabilities described above are also available via +an objected-oriented interface. The one dimensional splines are +objects of the `UnivariateSpline` class, and are created with the +:math:`x` and :math:`y` components of the curve provided as arguments +to the constructor. The class defines __call__, allowing the object +to be called with the x-axis values at which the spline should be +evaluated, returning the interpolated y-values. This is shown in +the example below for the subclass `InterpolatedUnivariateSpline`. +The methods :meth:`integral `, +:meth:`derivatives `, and +:meth:`roots ` methods are also available +on `UnivariateSpline` objects, allowing definite integrals, +derivatives, and roots to be computed for the spline. +The UnivariateSpline class can also be used to smooth data by +providing a non-zero value of the smoothing parameter `s`, with the +same meaning as the `s` keyword of the :obj:`splrep` function +described above. This results in a spline that has fewer knots +than the number of data points, and hence is no longer strictly +an interpolating spline, but rather a smoothing spline. If this +is not desired, the `InterpolatedUnivariateSpline` class is available. +It is a subclass of `UnivariateSpline` that always passes through all +points (equivalent to forcing the smoothing parameter to 0). This +class is demonstrated in the example below. + +The `LSQUnivarateSpline` is the other subclass of `UnivarateSpline`. +It allows the user to specify the number and location of internal +knots as explicitly with the parameter `t`. This allows creation +of customized splines with non-linear spacing, to interpolate in +some domains and smooth in others, or change the character of the +spline. + + +.. plot:: + + >>> import numpy as np + >>> import matplotlib.pyplot as plt + >>> from scipy import interpolate + + InterpolatedUnivariateSpline + + >>> x = np.arange(0,2*np.pi+np.pi/4,2*np.pi/8) + >>> y = np.sin(x) + >>> s = interpolate.InterpolatedUnivariateSpline(x,y) + >>> xnew = np.arange(0,2*np.pi,np.pi/50) + >>> ynew = s(xnew) + + >>> plt.figure() + >>> plt.plot(x,y,'x',xnew,ynew,xnew,np.sin(xnew),x,y,'b') + >>> plt.legend(['Linear','InterpolatedUnivariateSpline', 'True']) + >>> plt.axis([-0.05,6.33,-1.05,1.05]) + >>> plt.title('InterpolatedUnivariateSpline') + >>> plt.show() + + LSQUnivarateSpline with non-uniform knots + + >>> t = [np.pi/2-.1,np.pi/2-.1,3*np.pi/2-.1,3*np.pi/2+.1] + >>> s = interpolate.LSQUnivariateSpline(x,y,t) + >>> ynew = s(xnew) + + >>> plt.figure() + >>> plt.plot(x,y,'x',xnew,ynew,xnew,np.sin(xnew),x,y,'b') + >>> plt.legend(['Linear','LSQUnivariateSpline', 'True']) + >>> plt.axis([-0.05,6.33,-1.05,1.05]) + >>> plt.title('Spline with Specified Interior Knots') + >>> plt.show() + + + +Two-dimensional spline representation: Procedural (:func:`bisplrep`) +-------------------------------------------------------------------- + For (smooth) spline-fitting to a two dimensional surface, the function :func:`bisplrep` is available. This function takes as required inputs the **1-D** arrays *x*, *y*, and *z* which represent points on the @@ -234,6 +306,18 @@ .. :caption: Example of two-dimensional spline interpolation. + +Two-dimensional spline representation: Object-oriented (:class:`BivariateSpline`) +--------------------------------------------------------------------------------- + +The :class:`BivariateSpline` class is the 2-dimensional analog of the +:class:`UnivariateSpline` class. It and its subclasses implement +the FITPACK functions described above in an object oriented fashion, +allowing objects to be instantiated that can be called to compute +the spline value by passing in the two coordinates as the two +arguments. + + Using radial basis functions for smoothing/interpolation --------------------------------------------------------- @@ -274,7 +358,7 @@ >>> plt.subplot(2, 1, 2) >>> plt.plot(x, y, 'bo') - >>> plt.plot(xi, yi, 'g') + >>> plt.plot(xi, fi, 'g') >>> plt.plot(xi, np.sin(xi), 'r') >>> plt.title('Interpolation using RBF - multiquadrics') >>> plt.show() @@ -313,4 +397,3 @@ >>> plt.xlim(-2, 2) >>> plt.ylim(-2, 2) >>> plt.colorbar() - Modified: trunk/doc/source/tutorial/signal.rst =================================================================== --- trunk/doc/source/tutorial/signal.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/tutorial/signal.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -159,10 +159,10 @@ of the flattened Numpy array by an appropriate matrix resulting in another flattened Numpy array. Of course, this is not usually the best way to compute the filter as the matrices and vectors involved may be -huge. For example filtering a :math:`512\times512` image with this -method would require multiplication of a :math:`512^{2}x512^{2}` -matrix with a :math:`512^{2}` vector. Just trying to store the -:math:`512^{2}\times512^{2}` matrix using a standard Numpy array would +huge. For example filtering a :math:`512 \times 512` image with this +method would require multiplication of a :math:`512^2 \times 512^2` +matrix with a :math:`512^2` vector. Just trying to store the +:math:`512^2 \times 512^2` matrix using a standard Numpy array would require :math:`68,719,476,736` elements. At 4 bytes per element this would require :math:`256\textrm{GB}` of memory. In most applications most of the elements of this matrix are zero and a different method @@ -439,106 +439,106 @@ .. .. Detrend .. """"""" -.. +.. .. Filter design .. ------------- -.. -.. +.. +.. .. Finite-impulse response design .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Inifinite-impulse response design .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Analog filter frequency response .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Digital filter frequency response .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Linear Time-Invariant Systems .. ----------------------------- -.. -.. +.. +.. .. LTI Object .. ^^^^^^^^^^ -.. -.. +.. +.. .. Continuous-Time Simulation .. ^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Step response .. ^^^^^^^^^^^^^ -.. -.. +.. +.. .. Impulse response .. ^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Input/Output .. ============ -.. -.. +.. +.. .. Binary .. ------ -.. -.. +.. +.. .. Arbitrary binary input and output (fopen) .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Read and write Matlab .mat files .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Saving workspace .. ^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Text-file .. --------- -.. -.. +.. +.. .. Read text-files (read_array) .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Write a text-file (write_array) .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. -.. +.. +.. .. Fourier Transforms .. ================== -.. -.. +.. +.. .. One-dimensional .. --------------- -.. -.. +.. +.. .. Two-dimensional .. --------------- -.. -.. +.. +.. .. N-dimensional .. ------------- -.. -.. +.. +.. .. Shifting .. -------- -.. -.. +.. +.. .. Sample frequencies .. ------------------ -.. -.. +.. +.. .. Hilbert transform .. ----------------- -.. -.. +.. +.. .. Tilbert transform .. ----------------- Modified: trunk/doc/source/weave.rst =================================================================== --- trunk/doc/source/weave.rst 2010-05-24 13:11:07 UTC (rev 6406) +++ trunk/doc/source/weave.rst 2010-05-24 13:11:26 UTC (rev 6407) @@ -8,3 +8,12 @@ .. automodule:: scipy.weave :members: + + +.. autosummary:: + :toctree: generated/ + + inline + blitz + ext_tools + accelerate From scipy-svn at scipy.org Mon May 24 09:11:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:11:41 -0500 (CDT) Subject: [Scipy-svn] r6408 - trunk/scipy/fftpack Message-ID: <20100524131141.9694F39CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:11:41 -0500 (Mon, 24 May 2010) New Revision: 6408 Modified: trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/pseudo_diffs.py trunk/scipy/fftpack/realtransforms.py Log: DOC: merge wiki edits - fftpack module. Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2010-05-24 13:11:26 UTC (rev 6407) +++ trunk/scipy/fftpack/basic.py 2010-05-24 13:11:41 UTC (rev 6408) @@ -408,19 +408,23 @@ def ifftn(x, shape=None, axes=None, overwrite_x=0): - """ ifftn(x, s=None, axes=None, overwrite_x=0) -> y - + """ Return inverse multi-dimensional discrete Fourier transform of arbitrary type sequence x. - The returned array contains + The returned array contains:: y[j_1,..,j_d] = 1/p * sum[k_1=0..n_1-1, ..., k_d=0..n_d-1] x[k_1,..,k_d] * prod[i=1..d] exp(sqrt(-1)*2*pi/n_i * j_i * k_i) - where d = len(x.shape), n = x.shape, and p = prod[i=1..d] n_i. + where ``d = len(x.shape)``, ``n = x.shape``, and ``p = prod[i=1..d] n_i``. - Optional input: see fftn.__doc__ + For description of parameters see `fftn`. + + See Also + -------- + fftn : for detailed information. + """ return _raw_fftn_dispatch(x, shape, axes, overwrite_x, -1) Modified: trunk/scipy/fftpack/pseudo_diffs.py =================================================================== --- trunk/scipy/fftpack/pseudo_diffs.py 2010-05-24 13:11:26 UTC (rev 6407) +++ trunk/scipy/fftpack/pseudo_diffs.py 2010-05-24 13:11:41 UTC (rev 6408) @@ -252,26 +252,30 @@ _cache = {} def sc_diff(x, a, b, period=None, _cache = _cache): - """ sc_diff(x, a, b, period=2*pi) -> y - + """ Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x - and y, respectively, then + and y, respectively, then:: y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j y_0 = 0 - Input: - a,b + Parameters + ---------- + x : array_like + Input array. + a,b : float Defines the parameters of the sinh/cosh pseudo-differential operator. - period + period : float, optional The period of the sequence x. Default is 2*pi. - Notes: - sc_diff(cs_diff(x,a,b),b,a) == x - For even len(x), the Nyquist mode of x is taken zero. + Notes + ----- + ``sc_diff(cs_diff(x,a,b),b,a) == x`` + For even ``len(x)``, the Nyquist mode of x is taken as zero. + """ tmp = asarray(x) if iscomplexobj(tmp): Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2010-05-24 13:11:26 UTC (rev 6407) +++ trunk/scipy/fftpack/realtransforms.py 2010-05-24 13:11:41 UTC (rev 6408) @@ -20,20 +20,25 @@ Parameters ---------- x : array-like - input array. - type : {1, 2, 3} - type of the DCT (see Notes). + The input array. + type : {1, 2, 3}, optional + Type of the DCT (see Notes). Default type is 2. n : int, optional Length of the transform. axis : int, optional - axis over which to compute the transform. - norm : {None, 'ortho'} - normalization mode (see Notes). + Axis over which to compute the transform. + norm : {None, 'ortho'}, optional + Normalization mode (see Notes). Default is None. Returns ------- - y : real ndarray + y : ndarray of real + The transformed input array. + See Also + -------- + idct + Notes ----- For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to @@ -46,12 +51,11 @@ type I ~~~~~~ There are several definitions of the DCT-I; we use the following - (for ``norm=None``): + (for ``norm=None``):: - .. math:: - y_k = x_0 + (-1)^k x_{N-1} + 2\\sum_{n=1}^{N-2} x_n - \\cos\\left({\\pi nk\\over N-1}\\right), - \\qquad 0 \\le k < N. + N-2 + y[k] = x[0] + (-1)**k x[N-1] + 2 * sum x[n]*cos(pi*k*n/(N-1)) + n=1 Only None is supported as normalization mode for DCT-I. Note also that the DCT-I is only supported for input size > 1 @@ -59,43 +63,40 @@ type II ~~~~~~~ There are several definitions of the DCT-II; we use the following - (for ``norm=None``): + (for ``norm=None``):: - .. math:: - y_k = 2 \\sum_{n=0}^{N-1} x_n - \\cos\\left({\\pi(2n+1)k\\over 2N}\\right) - \\qquad 0 \\le k < N. - If ``norm='ortho'``, :math:`y_k` is multiplied by a scaling factor `f`: + N-1 + y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. + n=0 - .. math:: - f = \\begin{cases} \\sqrt{1/(4N)}, & \\text{if $k = 0$} \\\\ - \t\t\\sqrt{1/(2N)}, & \\text{otherwise} \\end{cases} + If ``norm='ortho'``, ``y[k]`` is multiplied by a scaling factor `f`:: + f = sqrt(1/(4*N)) if k = 0, + f = sqrt(1/(2*N)) otherwise. + Which makes the corresponding matrix of coefficients orthonormal - (`OO' = Id`). + (``OO' = Id``). type III ~~~~~~~~ There are several definitions, we use the following - (for ``norm=None``): + (for ``norm=None``):: - .. math:: - y_k = x_0 + 2 \\sum_{n=1}^{N-1} x_n - \\cos\\left({\\pi n(2k+1) \\over 2N}\\right) - \\qquad 0 \\le k < N, + N-1 + y[k] = x[0] + 2 * sum x[n]*cos(pi*(k+0.5)*n/N), 0 <= k < N. + n=1 - or, for ``norm='ortho'``: + or, for ``norm='ortho'`` and 0 <= k < N:: - .. math:: - y_k = {x_0\\over\\sqrt{N}} + {1\\over\\sqrt{N}} \\sum_{n=1}^{N-1} - x_n \\cos\\left({\\pi n(2k+1) \\over 2N}\\right) - \\qquad 0 \\le k < N. + N-1 + y[k] = x[0] / sqrt(N) + sqrt(1/N) * sum x[n]*cos(pi*(k+0.5)*n/N) + n=1 The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up - to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of the - orthonormalized DCT-II. + to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of + the orthonormalized DCT-II. References ---------- @@ -119,33 +120,36 @@ Parameters ---------- x : array-like - input array. - type : {1, 2, 3} - type of the IDCT (see Notes). + The input array. + type : {1, 2, 3}, optional + Type of the DCT (see Notes). Default type is 2. n : int, optional Length of the transform. axis : int, optional - axis over which to compute the transform. - norm : {None, 'ortho'} - normalization mode (see Notes). + Axis over which to compute the transform. + norm : {None, 'ortho'}, optional + Normalization mode (see Notes). Default is None. Returns ------- - y : real ndarray + y : ndarray of real + The transformed input array. + See Also + -------- + dct + Notes ----- - For a single dimension array x, idct(x, norm='ortho') is equal to matlab - idct(x) + For a single dimension array `x`, ``idct(x, norm='ortho')`` is equal to + matlab ``idct(x)``. 'The' IDCT is the IDCT of type 2, which is the same as DCT of type 3. IDCT of type 1 is the DCT of type 1, IDCT of type 2 is the DCT of type 3, - and IDCT of type 3 is the DCT of type 2. + and IDCT of type 3 is the DCT of type 2. For the definition of these types, + see `dct`. - See Also - -------- - dct """ if type == 1 and norm is not None: raise NotImplementedError( From scipy-svn at scipy.org Mon May 24 09:11:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:11:59 -0500 (CDT) Subject: [Scipy-svn] r6409 - in trunk/scipy: linalg maxentropy sparse Message-ID: <20100524131159.F14EF39CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:11:58 -0500 (Mon, 24 May 2010) New Revision: 6409 Modified: trunk/scipy/linalg/basic.py trunk/scipy/maxentropy/maxentropy.py trunk/scipy/sparse/dok.py Log: DOC: merge wiki edits - linalg, maxentropy and sparse. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-05-24 13:11:41 UTC (rev 6408) +++ trunk/scipy/linalg/basic.py 2010-05-24 13:11:58 UTC (rev 6409) @@ -292,38 +292,50 @@ ### Linear Least Squares def lstsq(a, b, cond=None, overwrite_a=False, overwrite_b=False): - """Compute least-squares solution to equation :m:`a x = b` + """ + Compute least-squares solution to equation Ax = b. - Compute a vector x such that the 2-norm :m:`|b - a x|` is minimised. + Compute a vector x such that the 2-norm ``|b - A x|`` is minimized. Parameters ---------- a : array, shape (M, N) + Left hand side matrix (2-D array). b : array, shape (M,) or (M, K) - cond : float + Right hand side matrix or vector (1-D or 2-D array). + cond : float, optional Cutoff for 'small' singular values; used to determine effective - rank of a. Singular values smaller than rcond*largest_singular_value - are considered zero. - overwrite_a : boolean - Discard data in a (may enhance performance) - overwrite_b : boolean - Discard data in b (may enhance performance) + rank of a. Singular values smaller than + ``rcond * largest_singular_value`` are considered zero. + overwrite_a : bool, optional + Discard data in `a` (may enhance performance). Default is False. + overwrite_b : bool, optional + Discard data in `b` (may enhance performance). Default is False. Returns ------- x : array, shape (N,) or (N, K) depending on shape of b - Least-squares solution - residues : array, shape () or (1,) or (K,) - Sums of residues, squared 2-norm for each column in :m:`b - a x` + Least-squares solution. + residues : ndarray, shape () or (1,) or (K,) + Sums of residues, squared 2-norm for each column in ``b - a x``. If rank of matrix a is < N or > M this is an empty array. - If b was 1-d, this is an (1,) shape array, otherwise the shape is (K,) - rank : integer - Effective rank of matrix a + If b was 1-D, this is an (1,) shape array, otherwise the shape is (K,). + rank : int + Effective rank of matrix `a`. s : array, shape (min(M,N),) - Singular values of a. The condition number of a is abs(s[0]/s[-1]). + Singular values of `a`. The condition number of a is + ``abs(s[0]/s[-1])``. - Raises LinAlgError if computation does not converge + Raises + ------ + LinAlgError : + If computation does not converge. + + See Also + -------- + optimize.nnls : linear least squares with non-negativity constraint + """ a1, b1 = map(asarray_chkfinite, (a, b)) if len(a1.shape) != 2: Modified: trunk/scipy/maxentropy/maxentropy.py =================================================================== --- trunk/scipy/maxentropy/maxentropy.py 2010-05-24 13:11:41 UTC (rev 6408) +++ trunk/scipy/maxentropy/maxentropy.py 2010-05-24 13:11:58 UTC (rev 6409) @@ -788,15 +788,16 @@ class conditionalmodel(model): - """A conditional maximum-entropy (exponential-form) model p(x|w) on a + """ + A conditional maximum-entropy (exponential-form) model p(x|w) on a discrete sample space. This is useful for classification problems: given the context w, what is the probability of each class x? - The form of such a model is + The form of such a model is:: p(x | w) = exp(theta . f(w, x)) / Z(w; theta) - where Z(w; theta) is a normalization term equal to + where Z(w; theta) is a normalization term equal to:: Z(w; theta) = sum_x exp(theta . f(w, x)). @@ -804,11 +805,11 @@ the constructor as the parameter 'samplespace'. Such a model form arises from maximizing the entropy of a conditional - model p(x | w) subject to the constraints: + model p(x | w) subject to the constraints:: K_i = E f_i(W, X) - where the expectation is with respect to the distribution + where the expectation is with respect to the distribution:: q(w) p(x | w) @@ -818,7 +819,7 @@ x) with respect to the empirical distribution. This method minimizes the Lagrangian dual L of the entropy, which is - defined for conditional models as + defined for conditional models as:: L(theta) = sum_w q(w) log Z(w; theta) - sum_{w,x} q(w,x) [theta . f(w,x)] @@ -827,8 +828,10 @@ entire sample space, since q(w,x) = 0 for all w,x not in the training set. - The partial derivatives of L are: + The partial derivatives of L are:: + dL / dtheta_i = K_i - E f_i(X, Y) + where the expectation is as defined above. """ Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2010-05-24 13:11:41 UTC (rev 6408) +++ trunk/scipy/sparse/dok.py 2010-05-24 13:11:58 UTC (rev 6409) @@ -13,12 +13,13 @@ from sputils import isdense, getdtype, isshape, isintlike, isscalarlike, upcast class dok_matrix(spmatrix, dict): - """Dictionary Of Keys based sparse matrix. + """ + Dictionary Of Keys based sparse matrix. This is an efficient structure for constructing sparse matrices incrementally. - This can be instatiated in several ways: + This can be instantiated in several ways: dok_matrix(D) with a dense matrix, D From scipy-svn at scipy.org Mon May 24 09:12:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 08:12:19 -0500 (CDT) Subject: [Scipy-svn] r6410 - trunk/scipy/signal Message-ID: <20100524131219.97C0239CAFF@scipy.org> Author: rgommers Date: 2010-05-24 08:12:19 -0500 (Mon, 24 May 2010) New Revision: 6410 Modified: trunk/scipy/signal/filter_design.py trunk/scipy/signal/ltisys.py trunk/scipy/signal/signaltools.py trunk/scipy/signal/waveforms.py trunk/scipy/signal/wavelets.py Log: DOC: merge wiki edits - signal module. Modified: trunk/scipy/signal/filter_design.py =================================================================== --- trunk/scipy/signal/filter_design.py 2010-05-24 13:11:58 UTC (rev 6409) +++ trunk/scipy/signal/filter_design.py 2010-05-24 13:12:19 UTC (rev 6410) @@ -78,16 +78,16 @@ def freqz(b, a=1, worN=None, whole=0, plot=None): """ - Compute frequency response of a digital filter. + Compute the frequency response of a digital filter. - Given the numerator (b) and denominator (a) of a digital filter compute - its frequency response. + Given the numerator ``b`` and denominator ``a`` of a digital filter compute + its frequency response:: jw -jw -jmw jw B(e) b[0] + b[1]e + .... + b[m]e H(e) = ---- = ------------------------------------ jw -jw -jnw - A(e) a[0] + a[2]e + .... + a[n]e + A(e) a[0] + a[1]e + .... + a[n]e Parameters ---------- @@ -110,6 +110,29 @@ h : ndarray The frequency response. + Examples + -------- + + >>> b = firwin(80, 0.5, window=('kaiser', 8)) + >>> h, w = freqz(b) + + >>> import matplotlib.pyplot as plt + >>> fig = plt.figure() + >>> plt.title('Digital filter frequency response') + >>> ax1 = fig.add_subplot(111) + + >>> plt.semilogy(h, np.abs(w), 'b') + >>> plt.ylabel('Amplitude (dB)', color='b') + >>> plt.xlabel('Frequency (rad/sample)') + >>> plt.grid() + >>> plt.legend() + + >>> ax2 = ax1.twinx() + >>> angles = np.unwrap(np.angle(w)) + >>> plt.plot(h, angles, 'g') + >>> plt.ylabel('Angle (radians)', color='g') + >>> plt.show() + """ b, a = map(atleast_1d, (b,a)) if whole: Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-05-24 13:11:58 UTC (rev 6409) +++ trunk/scipy/signal/ltisys.py 2010-05-24 13:12:19 UTC (rev 6410) @@ -295,17 +295,20 @@ def lsim2(system, U=None, T=None, X0=None, **kwargs): - """Simulate output of a continuous-time linear system, by using + """ + Simulate output of a continuous-time linear system, by using the ODE solver `scipy.integrate.odeint`. Parameters ---------- system : an instance of the LTI class or a tuple describing the system. The following gives the number of elements in the tuple and - the interpretation. - 2 (num, den) - 3 (zeros, poles, gain) - 4 (A, B, C, D) + the interpretation: + + * 2: (num, den) + * 3: (zeros, poles, gain) + * 4: (A, B, C, D) + U : ndarray or array-like (1D or 2D), optional An input array describing the input at each time T. Linear interpolation is used between given times. If there are @@ -319,7 +322,7 @@ X0 : ndarray or array-like (1D), optional The initial condition of the state vector. If `X0` is not given, the initial conditions are assumed to be 0. - **kwargs : + kwargs : dict Additional keyword arguments are passed on to the function odeint. See the notes below for more details. @@ -395,16 +398,19 @@ def lsim(system, U, T, X0=None, interp=1): - """Simulate output of a continuous-time linear system. + """ + Simulate output of a continuous-time linear system. Parameters ---------- system : an instance of the LTI class or a tuple describing the system. The following gives the number of elements in the tuple and - the interpretation. - 2 (num, den) - 3 (zeros, poles, gain) - 4 (A, B, C, D) + the interpretation: + + * 2: (num, den) + * 3: (zeros, poles, gain) + * 4: (A, B, C, D) + U : array_like An input array describing the input at each time `T` (interpolation is assumed between given times). If there are Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2010-05-24 13:11:58 UTC (rev 6409) +++ trunk/scipy/signal/signaltools.py 2010-05-24 13:12:19 UTC (rev 6410) @@ -56,13 +56,14 @@ def correlate(in1, in2, mode='full', old_behavior=True): - """Cross-correlate two N-dimensional arrays. + """ + Cross-correlate two N-dimensional arrays. Cross-correlate in1 and in2 with the output size determined by the mode argument. - Arguments - --------- + Parameters + ---------- in1: array first input. in2: array @@ -88,12 +89,13 @@ an N-dimensional array containing a subset of the discrete linear cross-correlation of in1 with in2. - Note - ---- + Notes + ----- The correlation z of two arrays x and y of rank d is defined as - z[...,k,...] = sum[..., i_l, ...] + z[...,k,...] = sum[..., i_l, ...] x[..., i_l,...] * conj(y[..., i_l + k,...]) + """ val = _valfrommode(mode) @@ -176,30 +178,36 @@ def convolve(in1, in2, mode='full', old_behavior=True): - """Convolve two N-dimensional arrays. + """ + Convolve two N-dimensional arrays. Convolve in1 and in2 with output size determined by mode. - Arguments - --------- + Parameters + ---------- in1: array first input. in2: array second input. Should have the same number of dimensions as in1. mode: str {'valid', 'same', 'full'} a string indicating the size of the output: - - 'valid': the output consists only of those elements that do not - rely on the zero-padding. - - 'same': the output is the same size as the largest input centered - with respect to the 'full' output. - - 'full': the output is the full discrete linear cross-correlation - of the inputs. (Default) + ``valid`` : the output consists only of those elements that do not + rely on the zero-padding. + + ``same`` : the output is the same size as the largest input centered + with respect to the 'full' output. + + ``full`` : the output is the full discrete linear cross-correlation + of the inputs. (Default) + + Returns ------- out: array an N-dimensional array containing a subset of the discrete linear cross-correlation of in1 with in2. + """ volume = asarray(in1) kernel = asarray(in2) @@ -233,30 +241,31 @@ return correlate(volume, kernel[slice_obj], mode, old_behavior=False) def order_filter(a, domain, rank): - """Perform an order filter on an N-dimensional array. + """ + Perform an order filter on an N-dimensional array. - Description: + Description: - Perform an order filter on the array in. The domain argument acts as a - mask centered over each pixel. The non-zero elements of domain are - used to select elements surrounding each input pixel which are placed - in a list. The list is sorted, and the output for that pixel is the - element corresponding to rank in the sorted list. + Perform an order filter on the array in. The domain argument acts as a + mask centered over each pixel. The non-zero elements of domain are + used to select elements surrounding each input pixel which are placed + in a list. The list is sorted, and the output for that pixel is the + element corresponding to rank in the sorted list. - Inputs: + Parameters + ---------- + in -- an N-dimensional input array. + domain -- a mask array with the same number of dimensions as in. Each + dimension should have an odd number of elements. + rank -- an non-negative integer which selects the element from the + sorted list (0 corresponds to the largest element, 1 is the + next largest element, etc.) - in -- an N-dimensional input array. - domain -- a mask array with the same number of dimensions as in. Each - dimension should have an odd number of elements. - rank -- an non-negative integer which selects the element from the - sorted list (0 corresponds to the largest element, 1 is the - next largest element, etc.) + Returns + ------- + out -- the results of the order filter in an array with the same + shape as in. - Output: (out,) - - out -- the results of the order filter in an array with the same - shape as in. - """ domain = asarray(domain) size = domain.shape @@ -728,12 +737,27 @@ return x def hilbert2(x,N=None): - """Compute the '2-D' analytic signal of `x` of length `N`. + """ + Compute the '2-D' analytic signal of `x` - See also - -------- - hilbert + Parameters + ---------- + x : array_like + 2-D signal data. + N : int, optional + Number of Fourier components. Default is ``x.shape`` + + Returns + ------- + xa : ndarray + Analytic signal of `x` taken along axes (0,1). + + References + ---------- + .. [1] Wikipedia, "Analytic signal", + http://en.wikipedia.org/wiki/Analytic_signal + """ x = asarray(x) x = asarray(x) Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-05-24 13:11:58 UTC (rev 6409) +++ trunk/scipy/signal/waveforms.py 2010-05-24 13:12:19 UTC (rev 6410) @@ -9,11 +9,31 @@ exp, cos, sin, polyval, polyint def sawtooth(t,width=1): - """Returns a periodic sawtooth waveform with period 2*pi - which rises from -1 to 1 on the interval 0 to width*2*pi - and drops from 1 to -1 on the interval width*2*pi to 2*pi - width must be in the interval [0,1] + """ + Return a periodic sawtooth waveform. + The sawtooth waveform has a period 2*pi, rises from -1 to 1 on the + interval 0 to width*2*pi and drops from 1 to -1 on the interval + width*2*pi to 2*pi. `width` must be in the interval [0,1]. + + Parameters + ---------- + t : array_like + Time. + width : float, optional + Width of the waveform. Default is 1. + + Returns + ------- + y : ndarray + Output array containing the sawtooth waveform. + + Examples + -------- + >>> import matplotlib.pyplot as plt + >>> x = np.linspace(0, 20*np.pi, 500) + >>> plt.plot(x, sp.signal.sawtooth(x)) + """ t,w = asarray(t), asarray(width) w = asarray(w + (t-t)) @@ -49,10 +69,24 @@ def square(t,duty=0.5): - """Returns a periodic square-wave waveform with period 2*pi - which is +1 from 0 to 2*pi*duty and -1 from 2*pi*duty to 2*pi - duty must be in the interval [0,1] + """ + Return a periodic square-wave waveform. + The square wave has a period 2*pi, has value +1 from 0 to 2*pi*duty + and -1 from 2*pi*duty to 2*pi. `duty` must be in the interval [0,1]. + + Parameters + ---------- + t : array_like + The input time array. + duty : float, optional + Duty cycle. + + Returns + ------- + y : array_like + The output square wave. + """ t,w = asarray(t), asarray(duty) w = asarray(w + (t-t)) @@ -87,24 +121,33 @@ return y def gausspulse(t,fc=1000,bw=0.5,bwr=-6,tpr=-60,retquad=0,retenv=0): - """Return a gaussian modulated sinusoid: exp(-a t^2) exp(1j*2*pi*fc) + """ + Return a gaussian modulated sinusoid: exp(-a t^2) exp(1j*2*pi*fc). - If retquad is non-zero, then return the real and imaginary parts - (inphase and quadrature) - If retenv is non-zero, then return the envelope (unmodulated signal). + If `retquad` is non-zero, then return the real and imaginary parts + (in-phase and quadrature) + If `retenv` is non-zero, then return the envelope (unmodulated signal). Otherwise, return the real part of the modulated sinusoid. - Inputs: + Parameters + ---------- + t : ndarray + Input array. + fc : int, optional + Center frequency (Hz). + bw : float, optional + Fractional bandwidth in frequency domain of pulse (Hz). + bwr: float, optional + Reference level at which fractional bandwidth is calculated (dB). + tpr : float, optional + If `t` is 'cutoff', then the function returns the cutoff + time for when the pulse amplitude falls below `tpr` (in dB). + retquad : int, optional + Return the quadrature (imaginary) as well as the real part + of the signal. + retenv : int, optional + Return the envelope of the signal. - t -- Input array. - fc -- Center frequency (Hz). - bw -- Fractional bandwidth in frequency domain of pulse (Hz). - bwr -- Reference level at which fractional bandwidth is calculated (dB). - tpr -- If t is 'cutoff', then the function returns the cutoff time for when the - pulse amplitude falls below tpr (in dB). - retquad -- Return the quadrature (imaginary) as well as the real part of the signal - retenv -- Return the envelope of th signal. - """ if fc < 0: raise ValueError, "Center frequency (fc=%.2f) must be >=0." % fc Modified: trunk/scipy/signal/wavelets.py =================================================================== --- trunk/scipy/signal/wavelets.py 2010-05-24 13:11:58 UTC (rev 6409) +++ trunk/scipy/signal/wavelets.py 2010-05-24 13:12:19 UTC (rev 6410) @@ -6,9 +6,17 @@ from scipy import linspace, pi, exp def daub(p): - """The coefficients for the FIR low-pass filter producing Daubechies wavelets. + """ + The coefficients for the FIR low-pass filter producing Daubechies wavelets. - p>=1 gives the order of the zero at f=1/2. There are 2p filter coefficients. + p>=1 gives the order of the zero at f=1/2. + There are 2p filter coefficients. + + Parameters + ---------- + p : int + Order of the zero at f=1/2, can have values from 1 to 34. + """ sqrt = np.sqrt assert(p>=1) @@ -170,7 +178,8 @@ return x, phi, psi def morlet(M, w=5.0, s=1.0, complete=True): - """Complex Morlet wavelet. + """ + Complex Morlet wavelet. Parameters ---------- @@ -183,8 +192,8 @@ complete : bool Whether to use the complete or the standard version. - Notes: - ------ + Notes + ----- The standard version: pi**-0.25 * exp(1j*w*x) * exp(-0.5*(x**2)) From scipy-svn at scipy.org Tue May 25 00:37:20 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 24 May 2010 23:37:20 -0500 (CDT) Subject: [Scipy-svn] r6411 - in trunk/doc/source: . tutorial Message-ID: <20100525043720.0469239C4B4@scipy.org> Author: warren.weckesser Date: 2010-05-24 23:37:19 -0500 (Mon, 24 May 2010) New Revision: 6411 Added: trunk/doc/source/tutorial/fftpack.rst Modified: trunk/doc/source/fftpack.rst trunk/doc/source/tutorial/index.rst Log: DOC: fftpack: Undo an undesired merger of two different rst files. Added josef's fftpack tutorial stub. Fixed rst markup of headers in the module-level rst for fftpack. Modified: trunk/doc/source/fftpack.rst =================================================================== --- trunk/doc/source/fftpack.rst 2010-05-24 13:12:19 UTC (rev 6410) +++ trunk/doc/source/fftpack.rst 2010-05-25 04:37:19 UTC (rev 6411) @@ -1,156 +1,10 @@ -========================================= -Fourier Transforms (:mod:`scipy.fftpack`) -========================================= - -.. sectionauthor:: Scipy Developers - -.. currentmodule:: scipy.fftpack - -.. warning:: - - This is currently a stub page - - -.. contents:: - - -Fourier analysis is fundamentally a method for expressing a function as a -sum of periodic components, and for recovering the signal from those -components. When both the function and its Fourier transform are -replaced with discretized counterparts, it is called the discrete Fourier -transform (DFT). The DFT has become a mainstay of numerical computing in -part because of a very fast algorithm for computing it, called the Fast -Fourier Transform (FFT), which was known to Gauss (1805) and was brought -to light in its current form by Cooley and Tukey [CT]_. Press et al. [NR]_ -provide an accessible introduction to Fourier analysis and its -applications. - - -Fast Fourier transforms ------------------------ - -One dimensional discrete Fourier transforms -------------------------------------------- - -fft, ifft, rfft, irfft - - -Two and n dimensional discrete Fourier transforms -------------------------------------------------- - -fft in more than one dimension - - -Discrete Cosine Transforms --------------------------- - - -Return the Discrete Cosine Transform [Mak]_ of arbitrary type sequence ``x``. - -For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to -matlab ``dct(x)``. - -There are theoretically 8 types of the DCT [WP]_, only the first 3 types are -implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' -Inverse DCT generally refers to DCT type 3. - -type I -~~~~~~ - -There are several definitions of the DCT-I; we use the following -(for ``norm=None``): - -.. math:: - :nowrap: - - \[ y_k = x_0 + (-1)^k x_{N-1} + 2\sum_{n=1}^{N-2} x_n - \cos\left({\pi nk\over N-1}\right), - \qquad 0 \le k < N. \] - -Only None is supported as normalization mode for DCT-I. Note also that the -DCT-I is only supported for input size > 1 - -type II -~~~~~~~ - -There are several definitions of the DCT-II; we use the following -(for ``norm=None``): - -.. math:: - :nowrap: - - \[ y_k = 2 \sum_{n=0}^{N-1} x_n - \cos \left({\pi(2n+1)k \over 2N} \right) - \qquad 0 \le k < N.\] - -If ``norm='ortho'``, :math:`y_k` is multiplied by a scaling factor `f`: - -.. math:: - :nowrap: - - \[f = \begin{cases} \sqrt{1/(4N)}, & \text{if $k = 0$} \\ - \sqrt{1/(2N)}, & \text{otherwise} \end{cases} \] - - -Which makes the corresponding matrix of coefficients orthonormal -(`OO' = Id`). - -type III -~~~~~~~~ - -There are several definitions, we use the following -(for ``norm=None``): - -.. math:: - :nowrap: - - \[ y_k = x_0 + 2 \sum_{n=1}^{N-1} x_n - \cos\left({\pi n(2k+1) \over 2N}\right) - \qquad 0 \le k < N,\] - -or, for ``norm='ortho'``: - -.. math:: - :nowrap: - - \[ y_k = {x_0\over\sqrt{N}} + {1\over\sqrt{N}} \sum_{n=1}^{N-1} - x_n \cos\left({\pi n(2k+1) \over 2N}\right) - \qquad 0 \le k < N.\] - -The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up -to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of the -orthonormalized DCT-II. - -References -~~~~~~~~~~ - -.. [CT] Cooley, James W., and John W. Tukey, 1965, "An algorithm for the - machine calculation of complex Fourier series," *Math. Comput.* - 19: 297-301. - -.. [NR] Press, W., Teukolsky, S., Vetterline, W.T., and Flannery, B.P., - 2007, *Numerical Recipes: The Art of Scientific Computing*, ch. - 12-13. Cambridge Univ. Press, Cambridge, UK. - -.. [Mak] J. Makhoul, 1980, 'A Fast Cosine Transform in One and Two Dimensions', - `IEEE Transactions on acoustics, speech and signal processing` - vol. 28(1), pp. 27-34, http://dx.doi.org/10.1109/TASSP.1980.1163351 - -.. [WP] http://en.wikipedia.org/wiki/Discrete_cosine_transform - - -FFT convolution ---------------- - -scipy.fftpack.convolve performs a convolution of two one-dimensional -arrays in frequency domain. Fourier transforms (:mod:`scipy.fftpack`) ========================================= .. module:: scipy.fftpack Fast Fourier transforms -======================= +----------------------- .. autosummary:: :toctree: generated/ @@ -165,7 +19,7 @@ irfft Differential and pseudo-differential operators -============================================== +---------------------------------------------- .. autosummary:: :toctree: generated/ @@ -182,7 +36,7 @@ shift Helper functions -================ +---------------- .. autosummary:: :toctree: generated/ @@ -193,7 +47,7 @@ rfftfreq Convolutions (:mod:`scipy.fftpack.convolve`) -============================================ +-------------------------------------------- .. module:: scipy.fftpack.convolve @@ -206,8 +60,8 @@ destroy_convolve_cache -:mod:`scipy.fftpack._fftpack` -============================= +Other (:mod:`scipy.fftpack._fftpack`) +------------------------------------- .. module:: scipy.fftpack._fftpack Added: trunk/doc/source/tutorial/fftpack.rst =================================================================== --- trunk/doc/source/tutorial/fftpack.rst (rev 0) +++ trunk/doc/source/tutorial/fftpack.rst 2010-05-25 04:37:19 UTC (rev 6411) @@ -0,0 +1,145 @@ +Fourier Transforms (:mod:`scipy.fftpack`) +========================================= + +.. sectionauthor:: Scipy Developers + +.. currentmodule:: scipy.fftpack + +.. warning:: + + This is currently a stub page + + +.. contents:: + + +Fourier analysis is fundamentally a method for expressing a function as a +sum of periodic components, and for recovering the signal from those +components. When both the function and its Fourier transform are +replaced with discretized counterparts, it is called the discrete Fourier +transform (DFT). The DFT has become a mainstay of numerical computing in +part because of a very fast algorithm for computing it, called the Fast +Fourier Transform (FFT), which was known to Gauss (1805) and was brought +to light in its current form by Cooley and Tukey [CT]_. Press et al. [NR]_ +provide an accessible introduction to Fourier analysis and its +applications. + + +Fast Fourier transforms +----------------------- + +One dimensional discrete Fourier transforms +------------------------------------------- + +fft, ifft, rfft, irfft + + +Two and n dimensional discrete Fourier transforms +------------------------------------------------- + +fft in more than one dimension + + +Discrete Cosine Transforms +-------------------------- + + +Return the Discrete Cosine Transform [Mak]_ of arbitrary type sequence ``x``. + +For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to +matlab ``dct(x)``. + +There are theoretically 8 types of the DCT [WP]_, only the first 3 types are +implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' +Inverse DCT generally refers to DCT type 3. + +type I +~~~~~~ + +There are several definitions of the DCT-I; we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = x_0 + (-1)^k x_{N-1} + 2\sum_{n=1}^{N-2} x_n + \cos\left({\pi nk\over N-1}\right), + \qquad 0 \le k < N. \] + +Only None is supported as normalization mode for DCT-I. Note also that the +DCT-I is only supported for input size > 1 + +type II +~~~~~~~ + +There are several definitions of the DCT-II; we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = 2 \sum_{n=0}^{N-1} x_n + \cos \left({\pi(2n+1)k \over 2N} \right) + \qquad 0 \le k < N.\] + +If ``norm='ortho'``, :math:`y_k` is multiplied by a scaling factor `f`: + +.. math:: + :nowrap: + + \[f = \begin{cases} \sqrt{1/(4N)}, & \text{if $k = 0$} \\ + \sqrt{1/(2N)}, & \text{otherwise} \end{cases} \] + + +Which makes the corresponding matrix of coefficients orthonormal +(`OO' = Id`). + +type III +~~~~~~~~ + +There are several definitions, we use the following +(for ``norm=None``): + +.. math:: + :nowrap: + + \[ y_k = x_0 + 2 \sum_{n=1}^{N-1} x_n + \cos\left({\pi n(2k+1) \over 2N}\right) + \qquad 0 \le k < N,\] + +or, for ``norm='ortho'``: + +.. math:: + :nowrap: + + \[ y_k = {x_0\over\sqrt{N}} + {1\over\sqrt{N}} \sum_{n=1}^{N-1} + x_n \cos\left({\pi n(2k+1) \over 2N}\right) + \qquad 0 \le k < N.\] + +The (unnormalized) DCT-III is the inverse of the (unnormalized) DCT-II, up +to a factor `2N`. The orthonormalized DCT-III is exactly the inverse of the +orthonormalized DCT-II. + +References +~~~~~~~~~~ + +.. [CT] Cooley, James W., and John W. Tukey, 1965, "An algorithm for the + machine calculation of complex Fourier series," *Math. Comput.* + 19: 297-301. + +.. [NR] Press, W., Teukolsky, S., Vetterline, W.T., and Flannery, B.P., + 2007, *Numerical Recipes: The Art of Scientific Computing*, ch. + 12-13. Cambridge Univ. Press, Cambridge, UK. + +.. [Mak] J. Makhoul, 1980, 'A Fast Cosine Transform in One and Two Dimensions', + `IEEE Transactions on acoustics, speech and signal processing` + vol. 28(1), pp. 27-34, http://dx.doi.org/10.1109/TASSP.1980.1163351 + +.. [WP] http://en.wikipedia.org/wiki/Discrete_cosine_transform + + +FFT convolution +--------------- + +scipy.fftpack.convolve performs a convolution of two one-dimensional +arrays in frequency domain. Modified: trunk/doc/source/tutorial/index.rst =================================================================== --- trunk/doc/source/tutorial/index.rst 2010-05-24 13:12:19 UTC (rev 6410) +++ trunk/doc/source/tutorial/index.rst 2010-05-25 04:37:19 UTC (rev 6411) @@ -13,6 +13,7 @@ integrate optimize interpolate + fftpack signal linalg stats From scipy-svn at scipy.org Tue May 25 01:55:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 25 May 2010 00:55:08 -0500 (CDT) Subject: [Scipy-svn] r6412 - trunk/scipy/linalg Message-ID: <20100525055508.99F7B39CB01@scipy.org> Author: warren.weckesser Date: 2010-05-25 00:55:08 -0500 (Tue, 25 May 2010) New Revision: 6412 Modified: trunk/scipy/linalg/special_matrices.py Log: DOC: linalg.special_matrices: merke wiki edits. Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-05-25 04:37:19 UTC (rev 6411) +++ trunk/scipy/linalg/special_matrices.py 2010-05-25 05:55:08 UTC (rev 6412) @@ -7,18 +7,22 @@ #----------------------------------------------------------------------------- def tri(N, M=None, k=0, dtype=None): - """Construct (N, M) matrix filled with ones at and below the k-th diagonal. + """ + Construct (N, M) matrix filled with ones at and below the k-th diagonal. The matrix has A[i,j] == 1 for i <= j + k Parameters ---------- N : integer - M : integer - Size of the matrix. If M is None, M == N is assumed. + The size of the first dimension of the matrix. + M : integer or None + The size of the second dimension of the matrix. If `M` is None, + `M = N` is assumed. k : integer Number of subdiagonal below which matrix is filled with ones. - k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. + `k` = 0 is the main diagonal, `k` < 0 subdiagonal and `k` > 0 + superdiagonal. dtype : dtype Data type of the matrix. @@ -111,7 +115,8 @@ def toeplitz(c, r=None): - """Construct a Toeplitz matrix. + """ + Construct a Toeplitz matrix. The Toepliz matrix has constant diagonals, with c as its first column and r as its first row. If r is not given, r == conjugate(c) is @@ -135,6 +140,17 @@ The Toeplitz matrix. dtype is the same as `(c[0] + r[0]).dtype`. + See also + -------- + circulant : circulant matrix + hankel : Hankel matrix + + Notes + ----- + The behavior when `c` or `r` is a scalar, or when `c` is complex and + `r` is None, was changed in version 0.8.0. The behavior in previous + versions was undocumented and is no longer supported. + Examples -------- >>> from scipy.linalg import toeplitz @@ -147,16 +163,6 @@ [ 2.+3.j, 1.+0.j, 2.-3.j], [ 4.-1.j, 2.+3.j, 1.+0.j]]) - See also - -------- - circulant : circulant matrix - hankel : Hankel matrix - - Notes - ----- - The behavior when `c` or `r` is a scalar, or when `c` is complex and - `r` is None, was changed in version 0.8.0. The behavior in previous - versions was undocumented and is no longer supported. """ c = np.asarray(c).ravel() if r is None: @@ -173,7 +179,8 @@ return vals[indx] def circulant(c): - """Construct a circulant matrix. + """ + Construct a circulant matrix. Parameters ---------- @@ -185,6 +192,15 @@ A : array, shape (len(c), len(c)) A circulant matrix whose first column is `c`. + See also + -------- + toeplitz : Toeplitz matrix + hankel : Hankel matrix + + Notes + ----- + .. versionadded:: 0.8.0 + Examples -------- >>> from scipy.linalg import circulant @@ -193,15 +209,6 @@ [2, 1, 3], [3, 2, 1]]) - See also - -------- - toeplitz : Toeplitz matrix - hankel : Hankel matrix - - Notes - ----- - .. versionadded:: 0.8.0 - """ c = np.asarray(c).ravel() a, b = np.ogrid[0:len(c), 0:-len(c):-1] @@ -211,7 +218,8 @@ return c[indx] def hankel(c, r=None): - """Construct a Hankel matrix. + """ + Construct a Hankel matrix. The Hankel matrix has constant anti-diagonals, with `c` as its first column and `r` as its last row. If `r` is not given, then @@ -223,9 +231,9 @@ First column of the matrix. Whatever the actual shape of `c`, it will be converted to a 1D array. r : array-like, 1D - Last row of the matrix. If None, `r` == 0 is assumed. + Last row of the matrix. If None, `r = zeros_like(c)` is assumed. `r[0]` is ignored; the last row of the returned matrix is - `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be + `[c[-1], r[1:]]`. Whatever the actual shape of `r`, it will be converted to a 1D array. Returns @@ -234,6 +242,11 @@ The Hankel matrix. dtype is the same as `(c[0] + r[0]).dtype`. + See also + -------- + toeplitz : Toeplitz matrix + circulant : circulant matrix + Examples -------- >>> from scipy.linalg import hankel @@ -247,11 +260,6 @@ [3, 4, 7, 7, 8], [4, 7, 7, 8, 9]]) - See also - -------- - toeplitz : Toeplitz matrix - circulant : circulant matrix - """ c = np.asarray(c).ravel() if r is None: @@ -268,8 +276,9 @@ return vals[indx] def hadamard(n, dtype=int): - """Construct a Hadamard matrix. - + """ + Construct a Hadamard matrix. + `hadamard(n)` constructs an n-by-n Hadamard matrix, using Sylvester's construction. `n` must be a power of 2. @@ -279,12 +288,16 @@ The order of the matrix. `n` must be a power of 2. dtype : numpy dtype The data type of the array to be constructed. - + Returns ------- H : ndarray with shape (n, n) The Hadamard matrix. + Notes + ----- + .. versionadded:: 0.8.0 + Examples -------- >>> hadamard(2, dtype=complex) @@ -296,10 +309,6 @@ [ 1, 1, -1, -1], [ 1, -1, -1, 1]]) - Notes - ----- - .. versionadded:: 0.8.0 - """ # This function is a slightly modified version of the From scipy-svn at scipy.org Wed May 26 15:29:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 26 May 2010 14:29:33 -0500 (CDT) Subject: [Scipy-svn] r6413 - in trunk/scipy/io/matlab: . tests Message-ID: <20100526192933.369A539C4B4@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-26 14:29:32 -0500 (Wed, 26 May 2010) New Revision: 6413 Modified: trunk/scipy/io/matlab/mio4.py trunk/scipy/io/matlab/mio5_utils.c trunk/scipy/io/matlab/mio5_utils.pyx trunk/scipy/io/matlab/mio_utils.c trunk/scipy/io/matlab/mio_utils.pyx trunk/scipy/io/matlab/tests/test_mio_utils.py Log: RF - simplify post-processing code Modified: trunk/scipy/io/matlab/mio4.py =================================================================== --- trunk/scipy/io/matlab/mio4.py 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/mio4.py 2010-05-26 19:29:32 UTC (rev 6413) @@ -11,7 +11,7 @@ read_dtype, convert_dtypes, arr_to_chars, arr_dtype_number, \ MatWriteError -from mio_utils import process_element +from mio_utils import squeeze_element, chars_to_strings SYS_LITTLE_ENDIAN = sys.byteorder == 'little' @@ -121,15 +121,15 @@ arr = self.read_full_array(hdr) elif mclass == mxCHAR_CLASS: arr = self.read_char_array(hdr) + if process and self.chars_as_strings: + arr = chars_to_strings(arr) elif mclass == mxSPARSE_CLASS: # no current processing (below) makes sense for sparse return self.read_sparse_array(hdr) else: raise TypeError, 'No reader for class code %s' % mclass - if process: - return process_element(arr, - self.chars_as_strings, - self.squeeze_me) + if process and self.squeeze_me: + return squeeze_element(arr) return arr def read_sub_array(self, hdr, copy=True): Modified: trunk/scipy/io/matlab/mio5_utils.c =================================================================== --- trunk/scipy/io/matlab/mio5_utils.c 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/mio5_utils.c 2010-05-26 19:29:32 UTC (rev 6413) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Wed Jan 6 10:21:24 2010 */ +/* Generated by Cython 0.12.1 on Wed May 26 12:20:26 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -15,7 +16,9 @@ #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -25,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -35,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -59,22 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type - #define PyString_CheckExact PyBytes_CheckExact + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -89,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -109,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -118,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -132,28 +153,25 @@ #endif #include #define __PYX_HAVE_API__scipy__io__matlab__mio5_utils +#include "stdio.h" #include "stdlib.h" -#include "stdio.h" #include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" #include "numpy_rephrasing.h" -#define __PYX_USE_C99_COMPLEX defined(_Complex_I) - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -static int __pyx_skip_dispatch = 0; - - /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 @@ -170,8 +188,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -235,9 +253,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -266,469 +284,30 @@ static const char *__pyx_filename; static const char **__pyx_f; -static char __pyx_mdoc[] = " Cython mio5 utility routines (-*- python -*- like)\n\n"; - -#ifdef CYTHON_REFNANNY -typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*NewContext)(const char*, int, const char*); - void (*FinishContext)(void**); -} __Pyx_RefnannyAPIStruct; -static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; -#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") -#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) -#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) -#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) -#else -#define __Pyx_INCREF(r) Py_INCREF(r) -#define __Pyx_DECREF(r) Py_DECREF(r) -#define __Pyx_GOTREF(r) -#define __Pyx_GIVEREF(r) -#define __Pyx_XDECREF(r) Py_XDECREF(r) -#define __Pyx_SetupRefcountContext(name) -#define __Pyx_FinishRefcountContext() -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - - -static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} - - -#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); -} - -#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } - } - return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); -} - - -#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ - __Pyx_GetItemInt_Generic(o, to_py_func(i))) - -static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); - } - else { - r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); - } - return r; -} - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) - -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static INLINE void __Pyx_RaiseTooManyValuesError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif #endif -Py_ssize_t __Pyx_zeros[] = {0}; -Py_ssize_t __Pyx_minusones[] = {-1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32); - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (PyList_Append(L, x) < 0) return NULL; - Py_INCREF(Py_None); - return Py_None; /* this is just to have an accurate signature */ - } - else { - PyObject *r, *m; - m = __Pyx_GetAttrString(L, "append"); - if (!m) return NULL; - r = PyObject_CallFunctionObjArgs(m, x, NULL); - Py_DECREF(m); - return r; - } -} - -static INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); - -#if __PYX_USE_C99_COMPLEX - #define __Pyx_REAL_PART(z) __real__(z) - #define __Pyx_IMAG_PART(z) __imag__(z) -#else - #define __Pyx_REAL_PART(z) ((z).real) - #define __Pyx_IMAG_PART(z) ((z).imag) +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif #endif -#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z)) - -#if __PYX_USE_C99_COMPLEX - - typedef double _Complex __pyx_t_double_complex; - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - - #define __pyx_t_double_complex_is_zero(a) ((a) == 0) - #define __pyx_t_double_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_double_complex_add(a, b) ((a)+(b)) - #define __pyx_t_double_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_double_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_double_complex_div(a, b) ((a)/(b)) - #define __pyx_t_double_complex_neg(a) (-(a)) - -#else - - typedef struct { double real, imag; } __pyx_t_double_complex; - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) & (a.imag == 0); - } - - static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj #endif -#if __PYX_USE_C99_COMPLEX - - typedef float _Complex __pyx_t_float_complex; - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - - #define __pyx_t_float_complex_is_zero(a) ((a) == 0) - #define __pyx_t_float_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_float_complex_add(a, b) ((a)+(b)) - #define __pyx_t_float_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_float_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_float_complex_div(a, b) ((a)/(b)) - #define __pyx_t_float_complex_neg(a) (-(a)) - -#else - - typedef struct { float real, imag; } __pyx_t_float_complex; - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) { - return (a.real == 0) & (a.imag == 0); - } - - static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - -#endif - -#if __PYX_USE_C99_COMPLEX - - typedef long double _Complex __pyx_t_long__double_complex; - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { - return x + y*(__pyx_t_long__double_complex)_Complex_I; - } - - #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0) - #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_long__double_complex_add(a, b) ((a)+(b)) - #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_long__double_complex_div(a, b) ((a)/(b)) - #define __pyx_t_long__double_complex_neg(a) (-(a)) - -#else - - typedef struct { long double real, imag; } __pyx_t_long__double_complex; - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { - __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) { - return (a.real == 0) & (a.imag == 0); - } - - static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - long double denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) { - __pyx_t_long__double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - -#endif - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *); - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ - -static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - -/* Type declarations */ - typedef npy_int8 __pyx_t_5numpy_int8_t; typedef npy_int16 __pyx_t_5numpy_int16_t; @@ -749,14 +328,14 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; -typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; - -typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; - typedef npy_long __pyx_t_5numpy_int_t; typedef npy_longlong __pyx_t_5numpy_long_t; +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + typedef npy_ulong __pyx_t_5numpy_uint_t; typedef npy_ulonglong __pyx_t_5numpy_ulong_t; @@ -767,6 +346,28 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +/* Type declarations */ + typedef npy_cfloat __pyx_t_5numpy_cfloat_t; typedef npy_cdouble __pyx_t_5numpy_cdouble_t; @@ -775,7 +376,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":6 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":6 * cdef object fobj * * cpdef int seek(self, long int offset, int whence=*) except -1 # <<<<<<<<<<<<<< @@ -788,7 +389,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":9 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":9 * cpdef long int tell(self) except -1 * cdef int read_into(self, void *buf, size_t n) except -1 * cdef object read_string(self, size_t n, void **pp, int copy=*) # <<<<<<<<<<<<<< @@ -801,7 +402,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":64 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":64 * * * cdef enum: # <<<<<<<<<<<<<< @@ -827,7 +428,7 @@ __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUTF32 = 18 }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":81 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":81 * miUTF32 = 18 * * cdef enum: # see comments in mio5_params # <<<<<<<<<<<<<< @@ -856,7 +457,7 @@ __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOBJECT_CLASS_FROM_MATRIX_H = 18 }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":288 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":288 * return 1 * * cdef object read_element(self, # <<<<<<<<<<<<<< @@ -869,7 +470,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 * self.cstream.seek(8 - mod8, 1) * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -882,7 +483,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":561 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":561 * return size * * cdef read_mi_matrix(self, int process=1): # <<<<<<<<<<<<<< @@ -895,7 +496,7 @@ int process; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -908,7 +509,7 @@ int process; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -922,7 +523,7 @@ PyObject *fobj; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":115 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":115 * * * cdef class VarHeader5: # <<<<<<<<<<<<<< @@ -943,7 +544,7 @@ size_t nzmax; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":127 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":127 * * * cdef class VarReader5: # <<<<<<<<<<<<<< @@ -971,7 +572,7 @@ }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -988,7 +589,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":127 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":127 * * * cdef class VarReader5: # <<<<<<<<<<<<<< @@ -1017,6 +618,356 @@ PyArrayObject *(*read_opaque)(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *, struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_vtabptr_5scipy_2io_6matlab_10mio5_utils_VarReader5; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (PyList_Append(L, x) < 0) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } + else { + PyObject *r, *m; + m = __Pyx_GetAttrString(L, "append"); + if (!m) return NULL; + r = PyObject_CallFunctionObjArgs(m, x, NULL); + Py_DECREF(m); + return r; + } +} + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} + +static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; } +static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) { + return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b); +} + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */ + +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0}; +Py_ssize_t __Pyx_minusones[] = {-1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32); + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from python_version */ /* Module declarations from python_ref */ @@ -1031,6 +982,8 @@ /* Module declarations from python_list */ +/* Module declarations from stdio */ + /* Module declarations from python_object */ /* Module declarations from python_sequence */ @@ -1047,6 +1000,8 @@ /* Module declarations from python_bool */ +/* Module declarations from python_unicode */ + /* Module declarations from python_long */ /* Module declarations from python_float */ @@ -1055,8 +1010,6 @@ /* Module declarations from python_string */ -/* Module declarations from python_unicode */ - /* Module declarations from python_dict */ /* Module declarations from python_instance */ @@ -1065,16 +1018,26 @@ /* Module declarations from python_method */ +/* Module declarations from python_weakref */ + +/* Module declarations from python_getargs */ + +/* Module declarations from python_cobject */ + +/* Module declarations from python_oldbuffer */ + /* Module declarations from python_set */ +/* Module declarations from python_buffer */ + +/* Module declarations from python_bytes */ + +/* Module declarations from python_pycapsule */ + /* Module declarations from python */ -/* Module declarations from python_buffer */ - /* Module declarations from stdlib */ -/* Module declarations from stdio */ - /* Module declarations from numpy */ /* Module declarations from numpy */ @@ -1083,7 +1046,15 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from scipy.io.matlab.streams */ static PyTypeObject *__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream = 0; @@ -1099,267 +1070,345 @@ int __pyx_module_is_main_scipy__io__matlab__mio5_utils = 0; /* Implementation of scipy.io.matlab.mio5_utils */ -static char __pyx_k_40[] = "<"; -static char __pyx_k_41[] = ">"; -static char __pyx_k_42[] = ">"; -static char __pyx_k_43[] = "<"; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_1; -static char __pyx_k___main__[] = "__main__"; -static PyObject *__pyx_kp___main__; -static char __pyx_k_31[] = "byteswap_u4"; -static PyObject *__pyx_kp_31; -static char __pyx_k___cinit__[] = "__cinit__"; -static PyObject *__pyx_kp___cinit__; -static char __pyx_k_set_stream[] = "set_stream"; -static PyObject *__pyx_kp_set_stream; -static char __pyx_k_read_tag[] = "read_tag"; -static PyObject *__pyx_kp_read_tag; -static char __pyx_k_read_numeric[] = "read_numeric"; -static PyObject *__pyx_kp_read_numeric; -static char __pyx_k_read_full_tag[] = "read_full_tag"; -static PyObject *__pyx_kp_read_full_tag; -static char __pyx_k_read_header[] = "read_header"; -static PyObject *__pyx_kp_read_header; -static char __pyx_k_array_from_header[] = "array_from_header"; -static PyObject *__pyx_kp_array_from_header; -static char __pyx_k_read_real_complex[] = "read_real_complex"; -static PyObject *__pyx_kp_read_real_complex; -static char __pyx_k_read_char[] = "read_char"; -static PyObject *__pyx_kp_read_char; -static char __pyx_k_read_cells[] = "read_cells"; -static PyObject *__pyx_kp_read_cells; -static char __pyx_k_read_fieldnames[] = "read_fieldnames"; -static PyObject *__pyx_kp_read_fieldnames; -static char __pyx_k_read_struct[] = "read_struct"; -static PyObject *__pyx_kp_read_struct; -static char __pyx_k_read_opaque[] = "read_opaque"; -static PyObject *__pyx_kp_read_opaque; -static char __pyx_k_32[] = "u4"; -static PyObject *__pyx_kp_32; -static char __pyx_k_preader[] = "preader"; -static PyObject *__pyx_kp_preader; -static char __pyx_k_fobj[] = "fobj"; -static PyObject *__pyx_kp_fobj; -static char __pyx_k_copy[] = "copy"; -static PyObject *__pyx_kp_copy; -static char __pyx_k_header[] = "header"; -static PyObject *__pyx_kp_header; -static char __pyx_k_process[] = "process"; -static PyObject *__pyx_kp_process; -static char __pyx_k_hdr[] = "hdr"; -static PyObject *__pyx_kp_hdr; -static char __pyx_k_sys[] = "sys"; -static PyObject *__pyx_kp_sys; -static char __pyx_k_pycopy[] = "pycopy"; -static PyObject *__pyx_kp_pycopy; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_33[] = "scipy.io.matlab.miobase"; -static PyObject *__pyx_kp_33; -static char __pyx_k_34[] = "*"; -static PyObject *__pyx_kp_34; -static char __pyx_k_miob[] = "miob"; -static PyObject *__pyx_kp_miob; -static char __pyx_k_35[] = "scipy.io.matlab.mio_utils"; -static PyObject *__pyx_kp_35; -static char __pyx_k_process_element[] = "process_element"; -static PyObject *__pyx_kp_process_element; -static char __pyx_k_36[] = "scipy.io.matlab.mio5_params"; -static PyObject *__pyx_kp_36; -static char __pyx_k_37[] = "mio5p"; -static PyObject *__pyx_kp_37; -static char __pyx_k_38[] = "scipy.sparse"; -static PyObject *__pyx_kp_38; -static char __pyx_k_scipy[] = "scipy"; -static PyObject *__pyx_kp_scipy; -static char __pyx_k_byteorder[] = "byteorder"; -static PyObject *__pyx_kp_byteorder; -static char __pyx_k_39[] = "little"; -static PyObject *__pyx_kp_39; -static char __pyx_k_sys_is_le[] = "sys_is_le"; -static PyObject *__pyx_kp_sys_is_le; -static char __pyx_k_native_code[] = "native_code"; -static PyObject *__pyx_kp_native_code; -static char __pyx_k_swapped_code[] = "swapped_code"; -static PyObject *__pyx_kp_swapped_code; -static char __pyx_k_OPAQUE_DTYPE[] = "OPAQUE_DTYPE"; -static PyObject *__pyx_kp_OPAQUE_DTYPE; -static char __pyx_k_byte_order[] = "byte_order"; -static PyObject *__pyx_kp_byte_order; -static char __pyx_k_struct_as_record[] = "struct_as_record"; -static PyObject *__pyx_kp_struct_as_record; -static char __pyx_k_codecs[] = "codecs"; -static PyObject *__pyx_kp_codecs; -static char __pyx_k_44[] = "uint16_codec"; -static PyObject *__pyx_kp_44; -static char __pyx_k_mat_stream[] = "mat_stream"; -static PyObject *__pyx_kp_mat_stream; -static char __pyx_k_mat_dtype[] = "mat_dtype"; -static PyObject *__pyx_kp_mat_dtype; -static char __pyx_k_chars_as_strings[] = "chars_as_strings"; -static PyObject *__pyx_kp_chars_as_strings; -static char __pyx_k_squeeze_me[] = "squeeze_me"; -static PyObject *__pyx_kp_squeeze_me; -static char __pyx_k_dtypes[] = "dtypes"; -static PyObject *__pyx_kp_dtypes; -static char __pyx_k_items[] = "items"; -static PyObject *__pyx_kp_items; -static char __pyx_k_basestring[] = "basestring"; -static PyObject *__pyx_kp_basestring; -static char __pyx_k_class_dtypes[] = "class_dtypes"; -static PyObject *__pyx_kp_class_dtypes; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_47[] = "bool"; -static PyObject *__pyx_kp_47; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_TypeError[] = "TypeError"; -static PyObject *__pyx_kp_TypeError; -static char __pyx_k_range[] = "range"; -static PyObject *__pyx_kp_range; -static char __pyx_k_append[] = "append"; -static PyObject *__pyx_kp_append; -static char __pyx_k_array[] = "array"; -static PyObject *__pyx_kp_array; -static char __pyx_k_astype[] = "astype"; -static PyObject *__pyx_kp_astype; -static char __pyx_k_MatlabObject[] = "MatlabObject"; -static PyObject *__pyx_kp_MatlabObject; -static char __pyx_k_MatlabFunction[] = "MatlabFunction"; -static PyObject *__pyx_kp_MatlabFunction; -static char __pyx_k_MatlabOpaque[] = "MatlabOpaque"; -static PyObject *__pyx_kp_MatlabOpaque; -static char __pyx_k_reshape[] = "reshape"; -static PyObject *__pyx_kp_reshape; -static char __pyx_k_T[] = "T"; -static PyObject *__pyx_kp_T; -static char __pyx_k_sparse[] = "sparse"; -static PyObject *__pyx_kp_sparse; -static char __pyx_k_csc_matrix[] = "csc_matrix"; -static PyObject *__pyx_kp_csc_matrix; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; -static char __pyx_k_53[] = "uint16_len"; -static PyObject *__pyx_kp_53; -static char __pyx_k_ndarray[] = "ndarray"; -static PyObject *__pyx_kp_ndarray; -static char __pyx_k_buffer[] = "buffer"; -static PyObject *__pyx_kp_buffer; -static char __pyx_k_54[] = "uint8"; -static PyObject *__pyx_kp_54; -static char __pyx_k_tostring[] = "tostring"; -static PyObject *__pyx_kp_tostring; -static char __pyx_k_55[] = "ascii"; -static PyObject *__pyx_kp_55; -static char __pyx_k_decode[] = "decode"; -static PyObject *__pyx_kp_decode; -static char __pyx_k_order[] = "order"; -static PyObject *__pyx_kp_order; -static char __pyx_k_58[] = "F"; -static PyObject *__pyx_kp_58; -static char __pyx_k_empty[] = "empty"; -static PyObject *__pyx_kp_empty; -static char __pyx_k_object[] = "object"; -static PyObject *__pyx_kp_object; -static char __pyx_k_mat_struct[] = "mat_struct"; -static PyObject *__pyx_kp_mat_struct; -static char __pyx_k__fieldnames[] = "_fieldnames"; -static PyObject *__pyx_kp__fieldnames; -static char __pyx_k___dict__[] = "__dict__"; -static PyObject *__pyx_kp___dict__; -static char __pyx_k_60[] = "s0"; -static PyObject *__pyx_kp_60; -static char __pyx_k_61[] = "s1"; -static PyObject *__pyx_kp_61; -static char __pyx_k_62[] = "s2"; -static PyObject *__pyx_kp_62; -static char __pyx_k_63[] = "arr"; -static PyObject *__pyx_kp_63; -static PyObject *__pyx_kp_40; -static PyObject *__pyx_kp_41; -static PyObject *__pyx_kp_42; -static PyObject *__pyx_kp_43; static PyObject *__pyx_builtin_basestring; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_object; -static PyObject *__pyx_kp_45; -static PyObject *__pyx_kp_46; -static char __pyx_k_45[] = "> 8 & 0xff00u)) | * (u4 >> 24)) # <<<<<<<<<<<<<< @@ -1384,11 +1433,11 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":108 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":108 * * * cpdef cnp.uint32_t byteswap_u4(cnp.uint32_t u4): # <<<<<<<<<<<<<< @@ -1401,7 +1450,7 @@ __pyx_t_5numpy_uint32_t __pyx_v_u4; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("byteswap_u4"); + __Pyx_RefNannySetupContext("byteswap_u4"); __pyx_self = __pyx_self; assert(__pyx_arg_u4); { __pyx_v_u4 = __Pyx_PyInt_from_py_npy_uint32(__pyx_arg_u4); if (unlikely((__pyx_v_u4 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1426,11 +1475,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":148 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":148 * int chars_as_strings * * def __new__(self, preader): # <<<<<<<<<<<<<< @@ -1445,18 +1494,17 @@ PyObject *__pyx_v_dt; PyObject *__pyx_v_bool_dtype; int __pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_preader,0}; - __Pyx_SetupRefcountContext("__cinit__"); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__preader,0}; + __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -1467,7 +1515,7 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_preader); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preader); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } @@ -1487,175 +1535,177 @@ __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.__cinit__"); return -1; __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_preader); __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); __pyx_v_dt = Py_None; __Pyx_INCREF(Py_None); __pyx_v_bool_dtype = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":149 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":149 * * def __new__(self, preader): * self.is_swapped = preader.byte_order == swapped_code # <<<<<<<<<<<<<< * if self.is_swapped: * self.little_endian = not sys_is_le */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_byte_order); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__byte_order); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_swapped_code); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__swapped_code); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped = __pyx_t_3; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":150 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":150 * def __new__(self, preader): * self.is_swapped = preader.byte_order == swapped_code * if self.is_swapped: # <<<<<<<<<<<<<< * self.little_endian = not sys_is_le * else: */ - __pyx_t_3 = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped; - if (__pyx_t_3) { + __pyx_t_4 = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped; + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":151 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":151 * self.is_swapped = preader.byte_order == swapped_code * if self.is_swapped: * self.little_endian = not sys_is_le # <<<<<<<<<<<<<< * else: * self.little_endian = sys_is_le */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys_is_le); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = (!__pyx_t_4); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = (!__pyx_t_5); goto __pyx_L6; } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":153 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":153 * self.little_endian = not sys_is_le * else: * self.little_endian = sys_is_le # <<<<<<<<<<<<<< * # option affecting reading of matlab struct arrays * self.struct_as_record = preader.struct_as_record */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys_is_le); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = __pyx_t_3; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = __pyx_t_4; } __pyx_L6:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":155 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":155 * self.little_endian = sys_is_le * # option affecting reading of matlab struct arrays * self.struct_as_record = preader.struct_as_record # <<<<<<<<<<<<<< * # store codecs for text matrix reading * self.codecs = preader.codecs */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_struct_as_record); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->struct_as_record = __pyx_t_3; + __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__struct_as_record); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->struct_as_record = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":157 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":157 * self.struct_as_record = preader.struct_as_record * # store codecs for text matrix reading * self.codecs = preader.codecs # <<<<<<<<<<<<<< * self.uint16_codec = preader.uint16_codec * # set c-optimized stream object from python file-like object */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_codecs); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__codecs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs); __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs = __pyx_t_2; - __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":158 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":158 * # store codecs for text matrix reading * self.codecs = preader.codecs * self.uint16_codec = preader.uint16_codec # <<<<<<<<<<<<<< * # set c-optimized stream object from python file-like object * self.set_stream(preader.mat_stream) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_44); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__uint16_codec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec); __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec = __pyx_t_2; - __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":160 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":160 * self.uint16_codec = preader.uint16_codec * # set c-optimized stream object from python file-like object * self.set_stream(preader.mat_stream) # <<<<<<<<<<<<<< - * # options for process_element + * # options for element processing * self.mat_dtype = preader.mat_dtype */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_set_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__set_stream); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_mat_stream); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":162 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":162 * self.set_stream(preader.mat_stream) - * # options for process_element + * # options for element processing * self.mat_dtype = preader.mat_dtype # <<<<<<<<<<<<<< * self.chars_as_strings = preader.chars_as_strings * self.squeeze_me = preader.squeeze_me */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_mat_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->mat_dtype = __pyx_t_3; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->mat_dtype = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":163 - * # options for process_element + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":163 + * # options for element processing * self.mat_dtype = preader.mat_dtype * self.chars_as_strings = preader.chars_as_strings # <<<<<<<<<<<<<< * self.squeeze_me = preader.squeeze_me * # copy refs to dtypes into object pointer array. Store preader */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_chars_as_strings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->chars_as_strings = __pyx_t_3; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__chars_as_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->chars_as_strings = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":164 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":164 * self.mat_dtype = preader.mat_dtype * self.chars_as_strings = preader.chars_as_strings * self.squeeze_me = preader.squeeze_me # <<<<<<<<<<<<<< * # copy refs to dtypes into object pointer array. Store preader * # to keep preader.dtypes, class_dtypes alive. We only need the */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_squeeze_me); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->squeeze_me = __pyx_t_3; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__squeeze_me); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->squeeze_me = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":168 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":168 * # to keep preader.dtypes, class_dtypes alive. We only need the * # integer-keyed dtypes * self.preader = preader # <<<<<<<<<<<<<< @@ -1668,83 +1718,83 @@ __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->preader); ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->preader = __pyx_v_preader; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":169 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":169 * # integer-keyed dtypes * self.preader = preader * for key, dt in preader.dtypes.items(): # <<<<<<<<<<<<<< * if isinstance(key, basestring): * continue */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_dtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__dtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_items); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = 0; __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; } else { - __pyx_t_1 = PyIter_Next(__pyx_t_5); - if (!__pyx_t_1) { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); } - if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { - PyObject* tuple = __pyx_t_1; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_2; - __pyx_2 = 0; + __pyx_v_key = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_3; - __pyx_3 = 0; + __pyx_v_dt = __pyx_t_7; + __pyx_t_7 = 0; } else { - __pyx_1 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_EndUnpack(__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_2; - __pyx_2 = 0; + __pyx_v_key = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_3; - __pyx_3 = 0; + __pyx_v_dt = __pyx_t_7; + __pyx_t_7 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":170 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":170 * self.preader = preader * for key, dt in preader.dtypes.items(): * if isinstance(key, basestring): # <<<<<<<<<<<<<< * continue * self.dtypes[key] = dt */ - __pyx_t_4 = PyObject_IsInstance(__pyx_v_key, __pyx_builtin_basestring); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + __pyx_t_5 = PyObject_IsInstance(__pyx_v_key, __pyx_builtin_basestring); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":171 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":171 * for key, dt in preader.dtypes.items(): * if isinstance(key, basestring): * continue # <<<<<<<<<<<<<< @@ -1756,96 +1806,96 @@ } __pyx_L9:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":172 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":172 * if isinstance(key, basestring): * continue * self.dtypes[key] = dt # <<<<<<<<<<<<<< * # copy refs to class_dtypes into object pointer array * for key, dt in preader.class_dtypes.items(): */ - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->dtypes[__pyx_t_7]) = ((PyObject *)__pyx_v_dt); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->dtypes[__pyx_t_9]) = ((PyObject *)__pyx_v_dt); __pyx_L7_continue:; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":174 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":174 * self.dtypes[key] = dt * # copy refs to class_dtypes into object pointer array * for key, dt in preader.class_dtypes.items(): # <<<<<<<<<<<<<< * if isinstance(key, basestring): * continue */ - __pyx_t_5 = PyObject_GetAttr(__pyx_v_preader, __pyx_kp_class_dtypes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_kp_items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__class_dtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_5; __Pyx_INCREF(__pyx_t_1); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; } else { - __pyx_t_5 = PyIter_Next(__pyx_t_1); - if (!__pyx_t_5) { + __pyx_t_1 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_1) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_1); } - if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { - PyObject* tuple = __pyx_t_5; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_2; - __pyx_2 = 0; + __pyx_v_key = __pyx_t_7; + __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_3; - __pyx_3 = 0; + __pyx_v_dt = __pyx_t_3; + __pyx_t_3 = 0; } else { - __pyx_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_2; - __pyx_2 = 0; + __pyx_v_key = __pyx_t_7; + __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_3; - __pyx_3 = 0; + __pyx_v_dt = __pyx_t_3; + __pyx_t_3 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":175 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":175 * # copy refs to class_dtypes into object pointer array * for key, dt in preader.class_dtypes.items(): * if isinstance(key, basestring): # <<<<<<<<<<<<<< * continue * self.class_dtypes[key] = dt */ - __pyx_t_4 = PyObject_IsInstance(__pyx_v_key, __pyx_builtin_basestring); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + __pyx_t_5 = PyObject_IsInstance(__pyx_v_key, __pyx_builtin_basestring); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":176 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":176 * for key, dt in preader.class_dtypes.items(): * if isinstance(key, basestring): * continue # <<<<<<<<<<<<<< @@ -1857,82 +1907,82 @@ } __pyx_L12:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":177 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":177 * if isinstance(key, basestring): * continue * self.class_dtypes[key] = dt # <<<<<<<<<<<<<< * # cache correctly byte ordered dtypes * if self.little_endian: */ - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->class_dtypes[__pyx_t_7]) = ((PyObject *)__pyx_v_dt); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->class_dtypes[__pyx_t_9]) = ((PyObject *)__pyx_v_dt); __pyx_L10_continue:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":179 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":179 * self.class_dtypes[key] = dt * # cache correctly byte ordered dtypes * if self.little_endian: # <<<<<<<<<<<<<< * self.U1_dtype = np.dtype('little_endian; - if (__pyx_t_3) { + __pyx_t_4 = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian; + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":180 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":180 * # cache correctly byte ordered dtypes * if self.little_endian: * self.U1_dtype = np.dtype('U1') */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_kp_45); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_45); - __Pyx_GIVEREF(__pyx_kp_45); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype); __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype)); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_2); - __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L13; } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":182 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":182 * self.U1_dtype = np.dtype('U1') # <<<<<<<<<<<<<< * bool_dtype = np.dtype('bool') * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_kp_46); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_46); - __Pyx_GIVEREF(__pyx_kp_46); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype); __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype)); @@ -1941,27 +1991,27 @@ } __pyx_L13:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":183 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":183 * else: * self.U1_dtype = np.dtype('>U1') * bool_dtype = np.dtype('bool') # <<<<<<<<<<<<<< * * def set_stream(self, fobj): */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_kp_47); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_47); - __Pyx_GIVEREF(__pyx_kp_47); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__bool)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bool)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bool)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_bool_dtype); __pyx_v_bool_dtype = __pyx_t_2; __pyx_t_2 = 0; @@ -1969,23 +2019,24 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); - __Pyx_XDECREF(__pyx_3); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.__cinit__"); __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(__pyx_v_key); __Pyx_DECREF(__pyx_v_dt); __Pyx_DECREF(__pyx_v_bool_dtype); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_preader); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":185 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":185 * bool_dtype = np.dtype('bool') * * def set_stream(self, fobj): # <<<<<<<<<<<<<< @@ -1998,9 +2049,9 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_set_stream(PyObject *__pyx_v_self, PyObject *__pyx_v_fobj) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("set_stream"); + __Pyx_RefNannySetupContext("set_stream"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":190 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":190 * Called from Python when initiating a variable read * ''' * self.cstream = streams.make_stream(fobj) # <<<<<<<<<<<<<< @@ -2023,11 +2074,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":192 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":192 * self.cstream = streams.make_stream(fobj) * * def read_tag(self): # <<<<<<<<<<<<<< @@ -2044,15 +2095,15 @@ int __pyx_v_tag_res; PyObject *__pyx_v_tag_data = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - __Pyx_SetupRefcountContext("read_tag"); + __Pyx_RefNannySetupContext("read_tag"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":213 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":213 * cdef char tag_ptr[4] * cdef int tag_res * cdef object tag_data = None # <<<<<<<<<<<<<< @@ -2062,7 +2113,7 @@ __Pyx_INCREF(Py_None); __pyx_v_tag_data = Py_None; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":214 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":214 * cdef int tag_res * cdef object tag_data = None * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) # <<<<<<<<<<<<<< @@ -2072,7 +2123,7 @@ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count), __pyx_v_tag_ptr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tag_res = __pyx_t_1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":215 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":215 * cdef object tag_data = None * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) * if tag_res == 2: # sde format # <<<<<<<<<<<<<< @@ -2082,23 +2133,23 @@ __pyx_t_2 = (__pyx_v_tag_res == 2); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":216 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":216 * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) * if tag_res == 2: # sde format * tag_data = tag_ptr[:byte_count] # <<<<<<<<<<<<<< * return (mdtype, byte_count, tag_data) * */ - __pyx_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_tag_ptr + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_1)); + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_tag_ptr + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_v_tag_data); - __pyx_v_tag_data = ((PyObject *)__pyx_1); - __pyx_1 = 0; + __pyx_v_tag_data = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":217 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":217 * if tag_res == 2: # sde format * tag_data = tag_ptr[:byte_count] * return (mdtype, byte_count, tag_data) # <<<<<<<<<<<<<< @@ -2111,7 +2162,7 @@ __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); @@ -2121,14 +2172,13 @@ __Pyx_GIVEREF(__pyx_v_tag_data); __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); @@ -2136,12 +2186,13 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tag_data); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":219 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":219 * return (mdtype, byte_count, tag_data) * * cdef int cread_tag(self, # <<<<<<<<<<<<<< @@ -2161,9 +2212,10 @@ int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - __Pyx_SetupRefcountContext("cread_tag"); + __Pyx_RefNannySetupContext("cread_tag"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":234 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":234 * cdef cnp.uint16_t mdtype_sde, byte_count_sde * cdef cnp.uint32_t mdtype * cdef cnp.uint32_t* u4_ptr = data_ptr # <<<<<<<<<<<<<< @@ -2172,7 +2224,7 @@ */ __pyx_v_u4_ptr = ((__pyx_t_5numpy_uint32_t *)__pyx_v_data_ptr); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":262 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":262 * # first four bytes are two little-endian uint16 values, first * # ``mdtype`` and second ``byte_count``. * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< @@ -2181,7 +2233,7 @@ */ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":263 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":263 * # ``mdtype`` and second ``byte_count``. * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< @@ -2191,7 +2243,7 @@ __pyx_t_1 = __pyx_v_self->is_swapped; if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":264 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":264 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * mdtype = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -2203,7 +2255,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":266 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":266 * mdtype = byteswap_u4(u4s[0]) * else: * mdtype = u4s[0] # <<<<<<<<<<<<<< @@ -2214,7 +2266,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":269 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":269 * # The most significant two bytes of a U4 *mdtype* will always be * # 0, if they are not, this must be SDE format * byte_count_sde = mdtype >> 16 # <<<<<<<<<<<<<< @@ -2223,7 +2275,7 @@ */ __pyx_v_byte_count_sde = (__pyx_v_mdtype >> 16); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":270 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":270 * # 0, if they are not, this must be SDE format * byte_count_sde = mdtype >> 16 * if byte_count_sde: # small data element format # <<<<<<<<<<<<<< @@ -2233,7 +2285,7 @@ __pyx_t_2 = __pyx_v_byte_count_sde; if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":271 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":271 * byte_count_sde = mdtype >> 16 * if byte_count_sde: # small data element format * mdtype_sde = mdtype & 0xffff # <<<<<<<<<<<<<< @@ -2242,7 +2294,7 @@ */ __pyx_v_mdtype_sde = (__pyx_v_mdtype & 0xffff); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":272 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":272 * if byte_count_sde: # small data element format * mdtype_sde = mdtype & 0xffff * if byte_count_sde > 4: # <<<<<<<<<<<<<< @@ -2252,7 +2304,7 @@ __pyx_t_3 = (__pyx_v_byte_count_sde > 4); if (__pyx_t_3) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":273 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":273 * mdtype_sde = mdtype & 0xffff * if byte_count_sde > 4: * raise ValueError('Error in SDE format data') # <<<<<<<<<<<<<< @@ -2260,18 +2312,18 @@ * u4_ptr[0] = u4s[1] */ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_kp_48); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_48); - __Pyx_GIVEREF(__pyx_kp_48); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":274 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":274 * if byte_count_sde > 4: * raise ValueError('Error in SDE format data') * return -1 # <<<<<<<<<<<<<< @@ -2284,7 +2336,7 @@ } __pyx_L5:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":275 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":275 * raise ValueError('Error in SDE format data') * return -1 * u4_ptr[0] = u4s[1] # <<<<<<<<<<<<<< @@ -2293,7 +2345,7 @@ */ (__pyx_v_u4_ptr[0]) = (__pyx_v_u4s[1]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":276 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":276 * return -1 * u4_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype_sde # <<<<<<<<<<<<<< @@ -2302,7 +2354,7 @@ */ (__pyx_v_mdtype_ptr[0]) = __pyx_v_mdtype_sde; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":277 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":277 * u4_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype_sde * byte_count_ptr[0] = byte_count_sde # <<<<<<<<<<<<<< @@ -2311,7 +2363,7 @@ */ (__pyx_v_byte_count_ptr[0]) = __pyx_v_byte_count_sde; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":278 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":278 * mdtype_ptr[0] = mdtype_sde * byte_count_ptr[0] = byte_count_sde * return 2 # <<<<<<<<<<<<<< @@ -2324,7 +2376,7 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":280 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":280 * return 2 * # regular element * if self.is_swapped: # <<<<<<<<<<<<<< @@ -2334,7 +2386,7 @@ __pyx_t_1 = __pyx_v_self->is_swapped; if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":281 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":281 * # regular element * if self.is_swapped: * byte_count_ptr[0] = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -2346,7 +2398,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":283 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":283 * byte_count_ptr[0] = byteswap_u4(u4s[1]) * else: * byte_count_ptr[0] = u4s[1] # <<<<<<<<<<<<<< @@ -2357,7 +2409,7 @@ } __pyx_L6:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":284 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":284 * else: * byte_count_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype # <<<<<<<<<<<<<< @@ -2366,7 +2418,7 @@ */ (__pyx_v_mdtype_ptr[0]) = __pyx_v_mdtype; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":285 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":285 * byte_count_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype * u4_ptr[0] = 0 # <<<<<<<<<<<<<< @@ -2375,7 +2427,7 @@ */ (__pyx_v_u4_ptr[0]) = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":286 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":286 * mdtype_ptr[0] = mdtype * u4_ptr[0] = 0 * return 1 # <<<<<<<<<<<<<< @@ -2393,11 +2445,12 @@ __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.cread_tag"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":288 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":288 * return 1 * * cdef object read_element(self, # <<<<<<<<<<<<<< @@ -2406,7 +2459,15 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, __pyx_t_5numpy_uint32_t *__pyx_v_mdtype_ptr, __pyx_t_5numpy_uint32_t *__pyx_v_byte_count_ptr, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element *__pyx_optional_args) { - int __pyx_v_copy = 1; + + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":292 + * cnp.uint32_t *byte_count_ptr, + * void **pp, + * int copy=True): # <<<<<<<<<<<<<< + * ''' Read data element into string buffer, return buffer + * + */ + int __pyx_v_copy = ((int)1); __pyx_t_5numpy_uint32_t __pyx_v_mdtype; __pyx_t_5numpy_uint32_t __pyx_v_byte_count; char __pyx_v_tag_data[4]; @@ -2414,21 +2475,22 @@ int __pyx_v_mod8; int __pyx_v_tag_res; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_1; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_2; int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - __Pyx_SetupRefcountContext("read_element"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_t_4; + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_5; + char *__pyx_t_6; + __Pyx_RefNannySetupContext("read_element"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":328 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":328 * cdef int tag_res = self.cread_tag(mdtype_ptr, * byte_count_ptr, * tag_data) # <<<<<<<<<<<<<< @@ -2438,7 +2500,7 @@ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, __pyx_v_tag_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tag_res = __pyx_t_1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":329 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":329 * byte_count_ptr, * tag_data) * mdtype = mdtype_ptr[0] # <<<<<<<<<<<<<< @@ -2447,7 +2509,7 @@ */ __pyx_v_mdtype = (__pyx_v_mdtype_ptr[0]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":330 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":330 * tag_data) * mdtype = mdtype_ptr[0] * byte_count = byte_count_ptr[0] # <<<<<<<<<<<<<< @@ -2456,7 +2518,7 @@ */ __pyx_v_byte_count = (__pyx_v_byte_count_ptr[0]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":331 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":331 * mdtype = mdtype_ptr[0] * byte_count = byte_count_ptr[0] * if tag_res == 1: # full format # <<<<<<<<<<<<<< @@ -2466,22 +2528,22 @@ __pyx_t_2 = (__pyx_v_tag_res == 1); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":335 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":335 * byte_count, * pp, * copy) # <<<<<<<<<<<<<< * # Seek to next 64-bit boundary * mod8 = byte_count % 8 */ - __pyx_1.__pyx_n = 1; - __pyx_1.copy = __pyx_v_copy; - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_string(__pyx_v_self->cstream, __pyx_v_byte_count, __pyx_v_pp, &__pyx_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.copy = __pyx_v_copy; + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_string(__pyx_v_self->cstream, __pyx_v_byte_count, __pyx_v_pp, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":337 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":337 * copy) * # Seek to next 64-bit boundary * mod8 = byte_count % 8 # <<<<<<<<<<<<<< @@ -2490,7 +2552,7 @@ */ __pyx_v_mod8 = (__pyx_v_byte_count % 8); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":338 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":338 * # Seek to next 64-bit boundary * mod8 = byte_count % 8 * if mod8: # <<<<<<<<<<<<<< @@ -2500,16 +2562,16 @@ __pyx_t_1 = __pyx_v_mod8; if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":339 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":339 * mod8 = byte_count % 8 * if mod8: * self.cstream.seek(8 - mod8, 1) # <<<<<<<<<<<<<< * else: # SDE format, make safer home for data * data = PyString_FromStringAndSize(tag_data, byte_count) */ - __pyx_2.__pyx_n = 1; - __pyx_2.whence = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.whence = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; @@ -2517,7 +2579,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":341 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":341 * self.cstream.seek(8 - mod8, 1) * else: # SDE format, make safer home for data * data = PyString_FromStringAndSize(tag_data, byte_count) # <<<<<<<<<<<<<< @@ -2530,19 +2592,19 @@ __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":342 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":342 * else: # SDE format, make safer home for data * data = PyString_FromStringAndSize(tag_data, byte_count) * pp[0] = data # <<<<<<<<<<<<<< * return data * */ - __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (__pyx_v_pp[0]) = ((char *)__pyx_t_4); + __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (__pyx_v_pp[0]) = ((char *)__pyx_t_6); } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":343 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":343 * data = PyString_FromStringAndSize(tag_data, byte_count) * pp[0] = data * return data # <<<<<<<<<<<<<< @@ -2562,12 +2624,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_data); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":345 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":345 * return data * * cdef void read_element_into(self, # <<<<<<<<<<<<<< @@ -2579,12 +2642,13 @@ int __pyx_v_mod8; int __pyx_v_res; __pyx_t_5numpy_uint32_t __pyx_v_byte_count; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; int __pyx_t_2; - __Pyx_SetupRefcountContext("read_element_into"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_3; + __Pyx_RefNannySetupContext("read_element_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":374 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":374 * mdtype_ptr, * byte_count_ptr, * ptr) # <<<<<<<<<<<<<< @@ -2594,7 +2658,7 @@ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, ((char *)__pyx_v_ptr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":375 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":375 * byte_count_ptr, * ptr) * cdef cnp.uint32_t byte_count = byte_count_ptr[0] # <<<<<<<<<<<<<< @@ -2603,7 +2667,7 @@ */ __pyx_v_byte_count = (__pyx_v_byte_count_ptr[0]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":376 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":376 * ptr) * cdef cnp.uint32_t byte_count = byte_count_ptr[0] * if res == 1: # full format # <<<<<<<<<<<<<< @@ -2613,7 +2677,7 @@ __pyx_t_2 = (__pyx_v_res == 1); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":377 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":377 * cdef cnp.uint32_t byte_count = byte_count_ptr[0] * if res == 1: # full format * res = self.cstream.read_into(ptr, byte_count) # <<<<<<<<<<<<<< @@ -2623,7 +2687,7 @@ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, __pyx_v_ptr, __pyx_v_byte_count); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":379 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":379 * res = self.cstream.read_into(ptr, byte_count) * # Seek to next 64-bit boundary * mod8 = byte_count % 8 # <<<<<<<<<<<<<< @@ -2632,7 +2696,7 @@ */ __pyx_v_mod8 = (__pyx_v_byte_count % 8); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":380 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":380 * # Seek to next 64-bit boundary * mod8 = byte_count % 8 * if mod8: # <<<<<<<<<<<<<< @@ -2642,16 +2706,16 @@ __pyx_t_1 = __pyx_v_mod8; if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":381 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":381 * mod8 = byte_count % 8 * if mod8: * self.cstream.seek(8 - mod8, 1) # <<<<<<<<<<<<<< * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): */ - __pyx_1.__pyx_n = 1; - __pyx_1.whence = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3.__pyx_n = 1; + __pyx_t_3.whence = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; @@ -2663,10 +2727,11 @@ __pyx_L1_error:; __Pyx_WriteUnraisable("scipy.io.matlab.mio5_utils.VarReader5.read_element_into"); __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 * self.cstream.seek(8 - mod8, 1) * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -2675,8 +2740,8 @@ */ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static INLINE PyArrayObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric *__pyx_optional_args) { - int __pyx_v_copy = 1; +static CYTHON_INLINE PyArrayObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric *__pyx_optional_args) { + int __pyx_v_copy = ((int)1); __pyx_t_5numpy_uint32_t __pyx_v_mdtype; __pyx_t_5numpy_uint32_t __pyx_v_byte_count; void *__pyx_v_data_ptr; @@ -2686,81 +2751,86 @@ PyArray_Descr *__pyx_v_dt = 0; int __pyx_v_flags; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element __pyx_2; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3; - int __pyx_t_4; - __Pyx_SetupRefcountContext("read_numeric"); + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element __pyx_t_4; + PyObject *__pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("read_numeric"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_el = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_numeric); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_numeric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":396 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":396 * cdef cnp.ndarray el * cdef object data = self.read_element( * &mdtype, &byte_count, &data_ptr, copy) # <<<<<<<<<<<<<< * cdef cnp.dtype dt = self.dtypes[mdtype] * el_count = byte_count // dt.itemsize */ - __pyx_2.__pyx_n = 1; - __pyx_2.copy = __pyx_v_copy; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.copy = __pyx_v_copy; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":397 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":397 * cdef object data = self.read_element( * &mdtype, &byte_count, &data_ptr, copy) * cdef cnp.dtype dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< * el_count = byte_count // dt.itemsize * cdef int flags = 0 */ - __pyx_t_3 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); - __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_3))); - __pyx_v_dt = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_5 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); + __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_5))); + __pyx_v_dt = ((PyArray_Descr *)__pyx_t_5); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":398 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":398 * &mdtype, &byte_count, &data_ptr, copy) * cdef cnp.dtype dt = self.dtypes[mdtype] * el_count = byte_count // dt.itemsize # <<<<<<<<<<<<<< * cdef int flags = 0 * if copy: */ + if (unlikely(__pyx_v_dt->elsize == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_el_count = (__pyx_v_byte_count / __pyx_v_dt->elsize); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":399 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":399 * cdef cnp.dtype dt = self.dtypes[mdtype] * el_count = byte_count // dt.itemsize * cdef int flags = 0 # <<<<<<<<<<<<<< @@ -2769,17 +2839,17 @@ */ __pyx_v_flags = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":400 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":400 * el_count = byte_count // dt.itemsize * cdef int flags = 0 * if copy: # <<<<<<<<<<<<<< * flags = cnp.NPY_WRITEABLE * Py_INCREF( dt) */ - __pyx_t_4 = __pyx_v_copy; - if (__pyx_t_4) { + __pyx_t_6 = __pyx_v_copy; + if (__pyx_t_6) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":401 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":401 * cdef int flags = 0 * if copy: * flags = cnp.NPY_WRITEABLE # <<<<<<<<<<<<<< @@ -2791,7 +2861,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":402 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":402 * if copy: * flags = cnp.NPY_WRITEABLE * Py_INCREF( dt) # <<<<<<<<<<<<<< @@ -2800,7 +2870,7 @@ */ Py_INCREF(((PyObject *)__pyx_v_dt)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":410 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":410 * data_ptr, * flags, * NULL) # <<<<<<<<<<<<<< @@ -2813,7 +2883,7 @@ __pyx_v_el = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":411 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":411 * flags, * NULL) * Py_INCREF( data) # <<<<<<<<<<<<<< @@ -2822,7 +2892,7 @@ */ Py_INCREF(__pyx_v_data); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":412 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":412 * NULL) * Py_INCREF( data) * PyArray_Set_BASE(el, data) # <<<<<<<<<<<<<< @@ -2831,7 +2901,7 @@ */ PyArray_Set_BASE(__pyx_v_el, __pyx_v_data); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":413 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":413 * Py_INCREF( data) * PyArray_Set_BASE(el, data) * return el # <<<<<<<<<<<<<< @@ -2846,21 +2916,22 @@ __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_numeric"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_el); __Pyx_XDECREF(__pyx_v_data); __Pyx_XDECREF((PyObject *)__pyx_v_dt); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":383 * self.cstream.seek(8 - mod8, 1) * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -2873,10 +2944,10 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_copy; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_1; PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_copy,0}; - __Pyx_SetupRefcountContext("read_numeric"); + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__copy,0}; + __Pyx_RefNannySetupContext("read_numeric"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -2888,7 +2959,7 @@ switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_copy); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy); if (unlikely(value)) { values[0] = value; kw_args--; } } } @@ -2898,10 +2969,10 @@ if (values[0]) { __pyx_v_copy = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_copy = 1; + __pyx_v_copy = ((int)1); } } else { - __pyx_v_copy = 1; + __pyx_v_copy = ((int)1); switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: __pyx_v_copy = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 0: break; @@ -2916,9 +2987,9 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.copy = __pyx_v_copy; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_numeric(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1, &__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.copy = __pyx_v_copy; + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_numeric(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2932,11 +3003,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":415 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":415 * return el * * cdef inline object read_int8_string(self): # <<<<<<<<<<<<<< @@ -2944,7 +3015,7 @@ * */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_int8_string(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_int8_string(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self) { __pyx_t_5numpy_uint32_t __pyx_v_mdtype; __pyx_t_5numpy_uint32_t __pyx_v_byte_count; void *__pyx_v_ptr; @@ -2953,10 +3024,11 @@ PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_int8_string"); + __Pyx_RefNannySetupContext("read_int8_string"); + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":427 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":427 * void *ptr * object data * data = self.read_element(&mdtype, &byte_count, &ptr) # <<<<<<<<<<<<<< @@ -2969,7 +3041,7 @@ __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":428 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":428 * object data * data = self.read_element(&mdtype, &byte_count, &ptr) * if mdtype != miINT8: # <<<<<<<<<<<<<< @@ -2979,7 +3051,7 @@ __pyx_t_2 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":429 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":429 * data = self.read_element(&mdtype, &byte_count, &ptr) * if mdtype != miINT8: * raise TypeError('Expecting miINT8 as data type') # <<<<<<<<<<<<<< @@ -2987,13 +3059,13 @@ * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_49); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_49); - __Pyx_GIVEREF(__pyx_kp_49); - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3001,7 +3073,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":430 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":430 * if mdtype != miINT8: * raise TypeError('Expecting miINT8 as data type') * return data # <<<<<<<<<<<<<< @@ -3022,12 +3094,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_data); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":432 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":432 * return data * * cdef int read_into_int32s(self, cnp.int32_t *int32p) except -1: # <<<<<<<<<<<<<< @@ -3045,9 +3118,11 @@ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - __Pyx_SetupRefcountContext("read_into_int32s"); + int __pyx_t_5; + __Pyx_RefNannySetupContext("read_into_int32s"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":449 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":449 * cnp.uint32_t mdtype, byte_count * int i * self.read_element_into(&mdtype, &byte_count, int32p) # <<<<<<<<<<<<<< @@ -3056,7 +3131,7 @@ */ ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element_into(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void *)__pyx_v_int32p)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":450 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":450 * int i * self.read_element_into(&mdtype, &byte_count, int32p) * if mdtype != miINT32: # <<<<<<<<<<<<<< @@ -3066,7 +3141,7 @@ __pyx_t_1 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT32); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":451 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":451 * self.read_element_into(&mdtype, &byte_count, int32p) * if mdtype != miINT32: * raise TypeError('Expecting miINT32 as data type') # <<<<<<<<<<<<<< @@ -3074,18 +3149,18 @@ * cdef int n_ints = byte_count // 4 */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_50); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_50); - __Pyx_GIVEREF(__pyx_kp_50); - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":452 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":452 * if mdtype != miINT32: * raise TypeError('Expecting miINT32 as data type') * return -1 # <<<<<<<<<<<<<< @@ -3098,7 +3173,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":453 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":453 * raise TypeError('Expecting miINT32 as data type') * return -1 * cdef int n_ints = byte_count // 4 # <<<<<<<<<<<<<< @@ -3107,7 +3182,7 @@ */ __pyx_v_n_ints = (__pyx_v_byte_count / 4); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":454 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":454 * return -1 * cdef int n_ints = byte_count // 4 * if self.is_swapped: # <<<<<<<<<<<<<< @@ -3117,17 +3192,18 @@ __pyx_t_4 = __pyx_v_self->is_swapped; if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":455 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":455 * cdef int n_ints = byte_count // 4 * if self.is_swapped: * for i in range(n_ints): # <<<<<<<<<<<<<< * int32p[i] = byteswap_u4(int32p[i]) * return n_ints */ - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_n_ints; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_4 = __pyx_v_n_ints; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":456 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":456 * if self.is_swapped: * for i in range(n_ints): * int32p[i] = byteswap_u4(int32p[i]) # <<<<<<<<<<<<<< @@ -3140,7 +3216,7 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":457 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":457 * for i in range(n_ints): * int32p[i] = byteswap_u4(int32p[i]) * return n_ints # <<<<<<<<<<<<<< @@ -3158,11 +3234,12 @@ __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_into_int32s"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":459 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":459 * return n_ints * * def read_full_tag(self): # <<<<<<<<<<<<<< @@ -3179,9 +3256,9 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_full_tag"); + __Pyx_RefNannySetupContext("read_full_tag"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":476 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":476 * ''' * cdef cnp.uint32_t mdtype, byte_count * self.cread_full_tag(&mdtype, &byte_count) # <<<<<<<<<<<<<< @@ -3190,7 +3267,7 @@ */ ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_full_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":477 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":477 * cdef cnp.uint32_t mdtype, byte_count * self.cread_full_tag(&mdtype, &byte_count) * return mdtype, byte_count # <<<<<<<<<<<<<< @@ -3203,14 +3280,14 @@ __pyx_t_2 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; @@ -3224,11 +3301,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":479 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":479 * return mdtype, byte_count * * cdef void cread_full_tag(self, # <<<<<<<<<<<<<< @@ -3239,9 +3316,10 @@ static void __pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_cread_full_tag(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, __pyx_t_5numpy_uint32_t *__pyx_v_mdtype, __pyx_t_5numpy_uint32_t *__pyx_v_byte_count) { __pyx_t_5numpy_uint32_t __pyx_v_u4s[2]; int __pyx_t_1; - __Pyx_SetupRefcountContext("cread_full_tag"); + __Pyx_RefNannySetupContext("cread_full_tag"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":484 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":484 * ''' C method for reading full u4, u4 tag from stream''' * cdef cnp.uint32_t u4s[2] * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< @@ -3250,7 +3328,7 @@ */ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":485 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":485 * cdef cnp.uint32_t u4s[2] * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< @@ -3260,7 +3338,7 @@ __pyx_t_1 = __pyx_v_self->is_swapped; if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":486 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":486 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * mdtype[0] = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -3269,7 +3347,7 @@ */ (__pyx_v_mdtype[0]) = __pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4((__pyx_v_u4s[0]), 0); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":487 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":487 * if self.is_swapped: * mdtype[0] = byteswap_u4(u4s[0]) * byte_count[0] = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -3281,7 +3359,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":489 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":489 * byte_count[0] = byteswap_u4(u4s[1]) * else: * mdtype[0] = u4s[0] # <<<<<<<<<<<<<< @@ -3290,7 +3368,7 @@ */ (__pyx_v_mdtype[0]) = (__pyx_v_u4s[0]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":490 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":490 * else: * mdtype[0] = u4s[0] * byte_count[0] = u4s[1] # <<<<<<<<<<<<<< @@ -3305,10 +3383,11 @@ __pyx_L1_error:; __Pyx_WriteUnraisable("scipy.io.matlab.mio5_utils.VarReader5.cread_full_tag"); __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":492 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":492 * byte_count[0] = u4s[1] * * cpdef VarHeader5 read_header(self): # <<<<<<<<<<<<<< @@ -3325,61 +3404,62 @@ int __pyx_v_i; struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header; struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_SetupRefcountContext("read_header"); + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("read_header"); + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)Py_None); __Pyx_INCREF(Py_None); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_header); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_header)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_header)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":506 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":506 * VarHeader5 header * # Read and discard mdtype and byte_count * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * # get array flags and nzmax * self.cstream.read_into(u4s, 8) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":508 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":508 * self.cstream.read_into(u4s, 8) * # get array flags and nzmax * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":509 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":509 * # get array flags and nzmax * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< * flags_class = byteswap_u4(u4s[0]) * nzmax = byteswap_u4(u4s[1]) */ - __pyx_t_2 = __pyx_v_self->is_swapped; - if (__pyx_t_2) { + __pyx_t_3 = __pyx_v_self->is_swapped; + if (__pyx_t_3) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":510 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":510 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -3388,7 +3468,7 @@ */ __pyx_v_flags_class = __pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4((__pyx_v_u4s[0]), 0); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":511 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":511 * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) * nzmax = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -3400,7 +3480,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":513 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":513 * nzmax = byteswap_u4(u4s[1]) * else: * flags_class = u4s[0] # <<<<<<<<<<<<<< @@ -3409,7 +3489,7 @@ */ __pyx_v_flags_class = (__pyx_v_u4s[0]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":514 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":514 * else: * flags_class = u4s[0] * nzmax = u4s[1] # <<<<<<<<<<<<<< @@ -3420,7 +3500,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":515 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":515 * flags_class = u4s[0] * nzmax = u4s[1] * header = VarHeader5() # <<<<<<<<<<<<<< @@ -3429,12 +3509,11 @@ */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_header)); __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":516 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":516 * nzmax = u4s[1] * header = VarHeader5() * mc = flags_class & 0xFF # <<<<<<<<<<<<<< @@ -3443,7 +3522,7 @@ */ __pyx_v_mc = (__pyx_v_flags_class & 0xFF); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":517 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":517 * header = VarHeader5() * mc = flags_class & 0xFF * header.mclass = mc # <<<<<<<<<<<<<< @@ -3452,7 +3531,7 @@ */ __pyx_v_header->mclass = __pyx_v_mc; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":518 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":518 * mc = flags_class & 0xFF * header.mclass = mc * header.is_logical = flags_class >> 9 & 1 # <<<<<<<<<<<<<< @@ -3461,7 +3540,7 @@ */ __pyx_v_header->is_logical = ((__pyx_v_flags_class >> 9) & 1); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":519 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":519 * header.mclass = mc * header.is_logical = flags_class >> 9 & 1 * header.is_global = flags_class >> 10 & 1 # <<<<<<<<<<<<<< @@ -3470,7 +3549,7 @@ */ __pyx_v_header->is_global = ((__pyx_v_flags_class >> 10) & 1); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":520 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":520 * header.is_logical = flags_class >> 9 & 1 * header.is_global = flags_class >> 10 & 1 * header.is_complex = flags_class >> 11 & 1 # <<<<<<<<<<<<<< @@ -3479,7 +3558,7 @@ */ __pyx_v_header->is_complex = ((__pyx_v_flags_class >> 11) & 1); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":521 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":521 * header.is_global = flags_class >> 10 & 1 * header.is_complex = flags_class >> 11 & 1 * header.nzmax = nzmax # <<<<<<<<<<<<<< @@ -3488,17 +3567,17 @@ */ __pyx_v_header->nzmax = __pyx_v_nzmax; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":524 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":524 * # all miMATRIX types except the mxOPAQUE_CLASS have dims and a * # name. * if mc == mxOPAQUE_CLASS: # <<<<<<<<<<<<<< * header.name = None * header.dims = None */ - __pyx_t_3 = (__pyx_v_mc == __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOPAQUE_CLASS); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_mc == __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOPAQUE_CLASS); + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":525 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":525 * # name. * if mc == mxOPAQUE_CLASS: * header.name = None # <<<<<<<<<<<<<< @@ -3511,7 +3590,7 @@ __Pyx_DECREF(__pyx_v_header->name); __pyx_v_header->name = Py_None; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":526 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":526 * if mc == mxOPAQUE_CLASS: * header.name = None * header.dims = None # <<<<<<<<<<<<<< @@ -3524,7 +3603,7 @@ __Pyx_DECREF(__pyx_v_header->dims); __pyx_v_header->dims = Py_None; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":527 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":527 * header.name = None * header.dims = None * return header # <<<<<<<<<<<<<< @@ -3539,27 +3618,27 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":528 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":528 * header.dims = None * return header * header.n_dims = self.read_into_int32s(header.dims_ptr) # <<<<<<<<<<<<<< * if header.n_dims > _MAT_MAXDIMS: * raise ValueError('Too many dimensions (%d) for numpy arrays' */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, __pyx_v_header->dims_ptr); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_header->n_dims = __pyx_t_2; + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, __pyx_v_header->dims_ptr); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_header->n_dims = __pyx_t_3; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":529 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":529 * return header * header.n_dims = self.read_into_int32s(header.dims_ptr) * if header.n_dims > _MAT_MAXDIMS: # <<<<<<<<<<<<<< * raise ValueError('Too many dimensions (%d) for numpy arrays' * % header.n_dims) */ - __pyx_t_3 = (__pyx_v_header->n_dims > 32); - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_v_header->n_dims > 32); + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":531 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":531 * if header.n_dims > _MAT_MAXDIMS: * raise ValueError('Too many dimensions (%d) for numpy arrays' * % header.n_dims) # <<<<<<<<<<<<<< @@ -3568,65 +3647,66 @@ */ __pyx_t_1 = PyInt_FromLong(__pyx_v_header->n_dims); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Remainder(__pyx_kp_51, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":533 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":533 * % header.n_dims) * # convert dims to list * header.dims = [] # <<<<<<<<<<<<<< * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __Pyx_GOTREF(__pyx_v_header->dims); __Pyx_DECREF(__pyx_v_header->dims); - __pyx_v_header->dims = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_header->dims = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":534 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":534 * # convert dims to list * header.dims = [] * for i in range(header.n_dims): # <<<<<<<<<<<<<< * header.dims.append(header.dims_ptr[i]) * header.name = self.read_int8_string() */ - for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_v_header->n_dims; __pyx_t_2+=1) { - __pyx_v_i = __pyx_t_2; + __pyx_t_3 = __pyx_v_header->n_dims; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":535 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":535 * header.dims = [] * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) # <<<<<<<<<<<<<< * header.name = self.read_int8_string() * return header */ - __pyx_t_4 = __Pyx_PyInt_to_py_npy_int32((__pyx_v_header->dims_ptr[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_header->dims, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32((__pyx_v_header->dims_ptr[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_header->dims, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":536 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":536 * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) * header.name = self.read_int8_string() # <<<<<<<<<<<<<< @@ -3641,7 +3721,7 @@ __pyx_v_header->name = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":537 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":537 * header.dims.append(header.dims_ptr[i]) * header.name = self.read_int8_string() * return header # <<<<<<<<<<<<<< @@ -3656,19 +3736,19 @@ __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_header"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_header); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":492 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":492 * byte_count[0] = u4s[1] * * cpdef VarHeader5 read_header(self): # <<<<<<<<<<<<<< @@ -3681,7 +3761,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_header(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_header"); + __Pyx_RefNannySetupContext("read_header"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -3697,11 +3777,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":539 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":539 * return header * * cdef inline size_t size_from_header(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -3709,7 +3789,7 @@ * */ -static INLINE size_t __pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_size_from_header(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header) { +static CYTHON_INLINE size_t __pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_size_from_header(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header) { size_t __pyx_v_size; PyObject *__pyx_v_i; size_t __pyx_r; @@ -3717,10 +3797,12 @@ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - __Pyx_SetupRefcountContext("size_from_header"); + __Pyx_RefNannySetupContext("size_from_header"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":556 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":556 * ''' * # calculate number of items in array from dims product * cdef size_t size = 1 # <<<<<<<<<<<<<< @@ -3729,7 +3811,7 @@ */ __pyx_v_size = 1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":557 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":557 * # calculate number of items in array from dims product * cdef size_t size = 1 * for i in range(header.n_dims): # <<<<<<<<<<<<<< @@ -3739,13 +3821,13 @@ __pyx_t_2 = PyInt_FromLong(__pyx_v_header->n_dims); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); } else { @@ -3772,7 +3854,7 @@ __pyx_v_i = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":558 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":558 * cdef size_t size = 1 * for i in range(header.n_dims): * size *= header.dims_ptr[i] # <<<<<<<<<<<<<< @@ -3784,7 +3866,7 @@ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":559 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":559 * for i in range(header.n_dims): * size *= header.dims_ptr[i] * return size # <<<<<<<<<<<<<< @@ -3803,11 +3885,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_i); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":561 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":561 * return size * * cdef read_mi_matrix(self, int process=1): # <<<<<<<<<<<<<< @@ -3816,26 +3900,26 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_mi_matrix(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_mi_matrix *__pyx_optional_args) { - int __pyx_v_process = 1; + int __pyx_v_process = ((int)1); struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header; __pyx_t_5numpy_uint32_t __pyx_v_mdtype; __pyx_t_5numpy_uint32_t __pyx_v_byte_count; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header __pyx_2; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_SetupRefcountContext("read_mi_matrix"); + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header __pyx_t_5; + __Pyx_RefNannySetupContext("read_mi_matrix"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_process = __pyx_optional_args->process; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)Py_None); __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":582 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":582 * object arr * # read full tag * self.cread_full_tag(&mdtype, &byte_count) # <<<<<<<<<<<<<< @@ -3844,7 +3928,7 @@ */ ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_full_tag(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":583 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":583 * # read full tag * self.cread_full_tag(&mdtype, &byte_count) * if mdtype != miMATRIX: # <<<<<<<<<<<<<< @@ -3854,7 +3938,7 @@ __pyx_t_1 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miMATRIX); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":584 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":584 * self.cread_full_tag(&mdtype, &byte_count) * if mdtype != miMATRIX: * raise TypeError('Expecting matrix here') # <<<<<<<<<<<<<< @@ -3862,13 +3946,13 @@ * if process and self.squeeze_me: */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_52); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_52); - __Pyx_GIVEREF(__pyx_kp_52); - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3876,7 +3960,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":585 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":585 * if mdtype != miMATRIX: * raise TypeError('Expecting matrix here') * if byte_count == 0: # empty matrix # <<<<<<<<<<<<<< @@ -3886,7 +3970,7 @@ __pyx_t_1 = (__pyx_v_byte_count == 0); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":586 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":586 * raise TypeError('Expecting matrix here') * if byte_count == 0: # empty matrix * if process and self.squeeze_me: # <<<<<<<<<<<<<< @@ -3900,7 +3984,7 @@ } if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":587 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":587 * if byte_count == 0: # empty matrix * if process and self.squeeze_me: * return np.array([]) # <<<<<<<<<<<<<< @@ -3908,30 +3992,30 @@ * return np.array([[]]) */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L5; } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":589 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":589 * return np.array([]) * else: * return np.array([[]]) # <<<<<<<<<<<<<< @@ -3939,29 +4023,29 @@ * return self.array_from_header(header, process) */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; } __pyx_L5:; @@ -3969,20 +4053,20 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":590 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":590 * else: * return np.array([[]]) * header = self.read_header() # <<<<<<<<<<<<<< * return self.array_from_header(header, process) * */ - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_header(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_header(__pyx_v_self, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_v_header)); - __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":591 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":591 * return np.array([[]]) * header = self.read_header() * return self.array_from_header(header, process) # <<<<<<<<<<<<<< @@ -3990,18 +4074,17 @@ * cpdef array_from_header(self, VarHeader5 header, int process=1): */ __Pyx_XDECREF(__pyx_r); - __pyx_2.__pyx_n = 1; - __pyx_2.process = __pyx_v_process; - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->array_from_header(__pyx_v_self, __pyx_v_header, 0, &__pyx_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.process = __pyx_v_process; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->array_from_header(__pyx_v_self, __pyx_v_header, 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -4009,12 +4092,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_header); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -4024,25 +4108,26 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header *__pyx_optional_args) { - int __pyx_v_process = 1; + int __pyx_v_process = ((int)1); PyObject *__pyx_v_arr; PyArray_Descr *__pyx_v_mat_dtype; int __pyx_v_mc; PyObject *__pyx_v_classname; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_SetupRefcountContext("array_from_header"); + int __pyx_t_5; + PyObject *__pyx_t_6; + __Pyx_RefNannySetupContext("array_from_header"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_process = __pyx_optional_args->process; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_arr = Py_None; __Pyx_INCREF(Py_None); __pyx_v_mat_dtype = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_classname = Py_None; __Pyx_INCREF(Py_None); @@ -4050,32 +4135,32 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_array_from_header); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__array_from_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_process); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_process); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":611 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":611 * object arr * cnp.dtype mat_dtype * cdef int mc = header.mclass # <<<<<<<<<<<<<< @@ -4084,7 +4169,7 @@ */ __pyx_v_mc = __pyx_v_header->mclass; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":612 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":612 * cnp.dtype mat_dtype * cdef int mc = header.mclass * if (mc == mxDOUBLE_CLASS # <<<<<<<<<<<<<< @@ -4093,7 +4178,7 @@ */ switch (__pyx_v_mc) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":613 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":613 * cdef int mc = header.mclass * if (mc == mxDOUBLE_CLASS * or mc == mxSINGLE_CLASS # <<<<<<<<<<<<<< @@ -4102,7 +4187,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxDOUBLE_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":614 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":614 * if (mc == mxDOUBLE_CLASS * or mc == mxSINGLE_CLASS * or mc == mxINT8_CLASS # <<<<<<<<<<<<<< @@ -4111,7 +4196,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSINGLE_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":615 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":615 * or mc == mxSINGLE_CLASS * or mc == mxINT8_CLASS * or mc == mxUINT8_CLASS # <<<<<<<<<<<<<< @@ -4120,7 +4205,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT8_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":616 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":616 * or mc == mxINT8_CLASS * or mc == mxUINT8_CLASS * or mc == mxINT16_CLASS # <<<<<<<<<<<<<< @@ -4129,7 +4214,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT8_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":617 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":617 * or mc == mxUINT8_CLASS * or mc == mxINT16_CLASS * or mc == mxUINT16_CLASS # <<<<<<<<<<<<<< @@ -4138,7 +4223,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT16_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":618 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":618 * or mc == mxINT16_CLASS * or mc == mxUINT16_CLASS * or mc == mxINT32_CLASS # <<<<<<<<<<<<<< @@ -4147,7 +4232,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT16_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":619 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":619 * or mc == mxUINT16_CLASS * or mc == mxINT32_CLASS * or mc == mxUINT32_CLASS # <<<<<<<<<<<<<< @@ -4156,7 +4241,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT32_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":620 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":620 * or mc == mxINT32_CLASS * or mc == mxUINT32_CLASS * or mc == mxINT64_CLASS # <<<<<<<<<<<<<< @@ -4165,7 +4250,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT32_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":621 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":621 * or mc == mxUINT32_CLASS * or mc == mxINT64_CLASS * or mc == mxUINT64_CLASS): # numeric matrix # <<<<<<<<<<<<<< @@ -4175,7 +4260,7 @@ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT64_CLASS: case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT64_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":622 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":622 * or mc == mxINT64_CLASS * or mc == mxUINT64_CLASS): # numeric matrix * arr = self.read_real_complex(header) # <<<<<<<<<<<<<< @@ -4188,7 +4273,7 @@ __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":623 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":623 * or mc == mxUINT64_CLASS): # numeric matrix * arr = self.read_real_complex(header) * if process and self.mat_dtype: # might need to recast # <<<<<<<<<<<<<< @@ -4196,23 +4281,23 @@ * mat_dtype = self.bool_dtype */ if (__pyx_v_process) { - __pyx_t_3 = __pyx_v_self->mat_dtype; + __pyx_t_4 = __pyx_v_self->mat_dtype; } else { - __pyx_t_3 = __pyx_v_process; + __pyx_t_4 = __pyx_v_process; } - if (__pyx_t_3) { + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":624 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":624 * arr = self.read_real_complex(header) * if process and self.mat_dtype: # might need to recast * if header.is_logical: # <<<<<<<<<<<<<< * mat_dtype = self.bool_dtype * else: */ - __pyx_t_4 = __pyx_v_header->is_logical; - if (__pyx_t_4) { + __pyx_t_5 = __pyx_v_header->is_logical; + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":625 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":625 * if process and self.mat_dtype: # might need to recast * if header.is_logical: * mat_dtype = self.bool_dtype # <<<<<<<<<<<<<< @@ -4226,48 +4311,48 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":627 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":627 * mat_dtype = self.bool_dtype * else: * mat_dtype = self.class_dtypes[mc] # <<<<<<<<<<<<<< * arr = arr.astype(mat_dtype) * elif mc == mxSPARSE_CLASS: */ - __pyx_t_5 = (__pyx_v_self->class_dtypes[__pyx_v_mc]); - if (!(__Pyx_TypeTest(((PyObject *)__pyx_t_5), __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_INCREF(((PyObject *)__pyx_t_5)); + __pyx_t_6 = (__pyx_v_self->class_dtypes[__pyx_v_mc]); + if (!(likely(((((PyObject *)__pyx_t_6)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_t_6), __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_v_mat_dtype)); - __pyx_v_mat_dtype = ((PyArray_Descr *)((PyObject *)__pyx_t_5)); + __pyx_v_mat_dtype = ((PyArray_Descr *)((PyObject *)__pyx_t_6)); } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":628 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":628 * else: * mat_dtype = self.class_dtypes[mc] * arr = arr.astype(mat_dtype) # <<<<<<<<<<<<<< * elif mc == mxSPARSE_CLASS: * arr = self.read_sparse(header) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_kp_astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_mat_dtype)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mat_dtype)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mat_dtype)); - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L3; } __pyx_L3:; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":629 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":629 * mat_dtype = self.class_dtypes[mc] * arr = arr.astype(mat_dtype) * elif mc == mxSPARSE_CLASS: # <<<<<<<<<<<<<< @@ -4276,20 +4361,20 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSPARSE_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":630 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":630 * arr = arr.astype(mat_dtype) * elif mc == mxSPARSE_CLASS: * arr = self.read_sparse(header) # <<<<<<<<<<<<<< * # no current processing makes sense for sparse * return arr */ - __pyx_t_6 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_sparse(__pyx_v_self, __pyx_v_header); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_sparse(__pyx_v_self, __pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":632 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":632 * arr = self.read_sparse(header) * # no current processing makes sense for sparse * return arr # <<<<<<<<<<<<<< @@ -4302,53 +4387,92 @@ goto __pyx_L0; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":633 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":633 * # no current processing makes sense for sparse * return arr * elif mc == mxCHAR_CLASS: # <<<<<<<<<<<<<< * arr = self.read_char(header) - * elif mc == mxCELL_CLASS: + * if process and self.chars_as_strings: */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxCHAR_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":634 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":634 * return arr * elif mc == mxCHAR_CLASS: * arr = self.read_char(header) # <<<<<<<<<<<<<< + * if process and self.chars_as_strings: + * arr = chars_to_strings(arr) + */ + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_char(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":635 + * elif mc == mxCHAR_CLASS: + * arr = self.read_char(header) + * if process and self.chars_as_strings: # <<<<<<<<<<<<<< + * arr = chars_to_strings(arr) * elif mc == mxCELL_CLASS: + */ + if (__pyx_v_process) { + __pyx_t_4 = __pyx_v_self->chars_as_strings; + } else { + __pyx_t_4 = __pyx_v_process; + } + if (__pyx_t_4) { + + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":636 + * arr = self.read_char(header) + * if process and self.chars_as_strings: + * arr = chars_to_strings(arr) # <<<<<<<<<<<<<< + * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_char(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); + __Pyx_GIVEREF(__pyx_v_arr); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_arr); + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L5; + } + __pyx_L5:; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":635 - * elif mc == mxCHAR_CLASS: - * arr = self.read_char(header) + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":637 + * if process and self.chars_as_strings: + * arr = chars_to_strings(arr) * elif mc == mxCELL_CLASS: # <<<<<<<<<<<<<< * arr = self.read_cells(header) * elif mc == mxSTRUCT_CLASS: */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxCELL_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":636 - * arr = self.read_char(header) + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":638 + * arr = chars_to_strings(arr) * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) # <<<<<<<<<<<<<< * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_cells(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_cells(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":637 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":639 * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) * elif mc == mxSTRUCT_CLASS: # <<<<<<<<<<<<<< @@ -4357,21 +4481,21 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSTRUCT_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":638 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":640 * arr = self.read_cells(header) * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) # <<<<<<<<<<<<<< * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = self.read_int8_string() */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":639 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":641 * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) * elif mc == mxOBJECT_CLASS: # like structs, but with classname # <<<<<<<<<<<<<< @@ -4380,62 +4504,62 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOBJECT_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":640 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":642 * arr = self.read_struct(header) * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = self.read_int8_string() # <<<<<<<<<<<<<< * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) */ - __pyx_t_6 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_classname); - __pyx_v_classname = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_classname = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":641 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":643 * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = self.read_int8_string() * arr = self.read_struct(header) # <<<<<<<<<<<<<< * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":642 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":644 * classname = self.read_int8_string() * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) # <<<<<<<<<<<<<< * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_1, __pyx_kp_MatlabObject); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__MatlabObject); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); __Pyx_INCREF(__pyx_v_classname); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_classname); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_classname); __Pyx_GIVEREF(__pyx_v_classname); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":643 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":645 * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type # <<<<<<<<<<<<<< @@ -4444,47 +4568,47 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxFUNCTION_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":644 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":646 * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() # <<<<<<<<<<<<<< * arr = mio5p.MatlabFunction(arr) - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 644; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_arr = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":645 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":647 * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() * arr = mio5p.MatlabFunction(arr) # <<<<<<<<<<<<<< - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze * return arr */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_MatlabFunction); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__MatlabFunction); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":647 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":649 * arr = mio5p.MatlabFunction(arr) - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze * return arr # <<<<<<<<<<<<<< * elif mc == mxOPAQUE_CLASS: * arr = self.read_opaque(header) @@ -4495,8 +4619,8 @@ goto __pyx_L0; break; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":648 - * # to make them more re-writeable - don't process + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":650 + * # to make them more re-writeable - don't squeeze * return arr * elif mc == mxOPAQUE_CLASS: # <<<<<<<<<<<<<< * arr = self.read_opaque(header) @@ -4504,50 +4628,50 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOPAQUE_CLASS: - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":649 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":651 * return arr * elif mc == mxOPAQUE_CLASS: * arr = self.read_opaque(header) # <<<<<<<<<<<<<< * arr = mio5p.MatlabOpaque(arr) - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze */ - __pyx_t_6 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_opaque(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_opaque(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_arr); - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_arr = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":650 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":652 * elif mc == mxOPAQUE_CLASS: * arr = self.read_opaque(header) * arr = mio5p.MatlabOpaque(arr) # <<<<<<<<<<<<<< - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze * return arr */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_6 = PyObject_GetAttr(__pyx_1, __pyx_kp_MatlabOpaque); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MatlabOpaque); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":652 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":654 * arr = mio5p.MatlabOpaque(arr) - * # to make them more re-writeable - don't process + * # to make them more re-writeable - don't squeeze * return arr # <<<<<<<<<<<<<< - * if process: - * return process_element(arr, + * if process and self.squeeze_me: + * return squeeze_element(arr) */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_arr); @@ -4556,71 +4680,49 @@ break; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":653 - * # to make them more re-writeable - don't process + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":655 + * # to make them more re-writeable - don't squeeze * return arr - * if process: # <<<<<<<<<<<<<< - * return process_element(arr, - * self.chars_as_strings, + * if process and self.squeeze_me: # <<<<<<<<<<<<<< + * return squeeze_element(arr) + * return arr */ - __pyx_t_4 = __pyx_v_process; + if (__pyx_v_process) { + __pyx_t_4 = __pyx_v_self->squeeze_me; + } else { + __pyx_t_4 = __pyx_v_process; + } if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":654 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":656 * return arr - * if process: - * return process_element(arr, # <<<<<<<<<<<<<< - * self.chars_as_strings, - * self.squeeze_me) + * if process and self.squeeze_me: + * return squeeze_element(arr) # <<<<<<<<<<<<<< + * return arr + * */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_process_element); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":655 - * if process: - * return process_element(arr, - * self.chars_as_strings, # <<<<<<<<<<<<<< - * self.squeeze_me) - * return arr - */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->chars_as_strings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":656 - * return process_element(arr, - * self.chars_as_strings, - * self.squeeze_me) # <<<<<<<<<<<<<< - * return arr - * - */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->squeeze_me); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_arr); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L6; } - __pyx_L5:; + __pyx_L6:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":657 - * self.chars_as_strings, - * self.squeeze_me) + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":657 + * if process and self.squeeze_me: + * return squeeze_element(arr) * return arr # <<<<<<<<<<<<<< * * cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): @@ -4633,22 +4735,23 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.array_from_header"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_arr); __Pyx_DECREF((PyObject *)__pyx_v_mat_dtype); __Pyx_DECREF(__pyx_v_classname); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":593 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -4662,10 +4765,10 @@ struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_header = 0; int __pyx_v_process; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header __pyx_1; PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_header,&__pyx_kp_process,0}; - __Pyx_SetupRefcountContext("array_from_header"); + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header __pyx_t_2; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__header,&__pyx_n_s__process,0}; + __Pyx_RefNannySetupContext("array_from_header"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -4677,12 +4780,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_header); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_process); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__process); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -4693,10 +4796,10 @@ if (values[1]) { __pyx_v_process = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_process = 1; + __pyx_v_process = ((int)1); } } else { - __pyx_v_process = 1; + __pyx_v_process = ((int)1); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_process = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)PyTuple_GET_ITEM(__pyx_args, 0)); @@ -4713,9 +4816,9 @@ __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.process = __pyx_v_process; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->array_from_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), __pyx_v_header, 1, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.process = __pyx_v_process; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->array_from_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), __pyx_v_header, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4729,11 +4832,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":659 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":659 * return arr * * cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -4746,120 +4849,120 @@ PyArrayObject *__pyx_v_res; PyArrayObject *__pyx_v_res_j; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_2; - PyObject *__pyx_3 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_SetupRefcountContext("read_real_complex"); + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_t_5; + __Pyx_RefNannySetupContext("read_real_complex"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_res_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_real_complex); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_real_complex)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_real_complex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_real_complex)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_header)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":663 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":663 * cdef: * cnp.ndarray res, res_j * if header.is_complex: # <<<<<<<<<<<<<< * # avoid array copy to save memory * res = self.read_numeric(False) */ - __pyx_t_3 = __pyx_v_header->is_complex; - if (__pyx_t_3) { + __pyx_t_4 = __pyx_v_header->is_complex; + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":665 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":665 * if header.is_complex: * # avoid array copy to save memory * res = self.read_numeric(False) # <<<<<<<<<<<<<< * res_j = self.read_numeric(False) * res = res + (res_j * 1j) */ - __pyx_2.__pyx_n = 1; - __pyx_2.copy = 0; - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.copy = 0; + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res)); - __pyx_v_res = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_res = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":666 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":666 * # avoid array copy to save memory * res = self.read_numeric(False) * res_j = self.read_numeric(False) # <<<<<<<<<<<<<< * res = res + (res_j * 1j) * else: */ - __pyx_2.__pyx_n = 1; - __pyx_2.copy = 0; - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.copy = 0; + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res_j)); - __pyx_v_res_j = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_res_j = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":667 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":667 * res = self.read_numeric(False) * res_j = self.read_numeric(False) * res = res + (res_j * 1j) # <<<<<<<<<<<<<< * else: * res = self.read_numeric() */ - __pyx_t_2 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_res_j), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_v_res), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_res_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_res), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_res)); - __pyx_v_res = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_res = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L3; } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":669 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":669 * res = res + (res_j * 1j) * else: * res = self.read_numeric() # <<<<<<<<<<<<<< * return res.reshape(header.dims[::-1]).T * */ - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res)); - __pyx_v_res = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_res = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":670 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":670 * else: * res = self.read_numeric() * return res.reshape(header.dims[::-1]).T # <<<<<<<<<<<<<< @@ -4867,49 +4970,49 @@ * cdef object read_sparse(self, VarHeader5 header): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_kp_reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_3); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_3); - __Pyx_GIVEREF(__pyx_3); - __pyx_3 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_kp_T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_3); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_real_complex"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_res); __Pyx_DECREF((PyObject *)__pyx_v_res_j); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":659 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":659 * return arr * * cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -4922,7 +5025,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_real_complex(PyObject *__pyx_v_self, PyObject *__pyx_v_header) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_real_complex"); + __Pyx_RefNannySetupContext("read_real_complex"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_real_complex(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4939,11 +5042,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":672 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":672 * return res.reshape(header.dims[::-1]).T * * cdef object read_sparse(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -4960,24 +5063,25 @@ size_t __pyx_v_N; size_t __pyx_v_nnz; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_t_3; + PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + size_t __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - __Pyx_SetupRefcountContext("read_sparse"); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + __Pyx_RefNannySetupContext("read_sparse"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_rowind = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_indptr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_data_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":676 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":676 * cdef cnp.ndarray rowind, indptr, data, data_j * cdef size_t M, N, nnz * rowind = self.read_numeric() # <<<<<<<<<<<<<< @@ -4990,7 +5094,7 @@ __pyx_v_rowind = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":677 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":677 * cdef size_t M, N, nnz * rowind = self.read_numeric() * indptr = self.read_numeric() # <<<<<<<<<<<<<< @@ -5003,7 +5107,7 @@ __pyx_v_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":678 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":678 * rowind = self.read_numeric() * indptr = self.read_numeric() * if header.is_complex: # <<<<<<<<<<<<<< @@ -5013,37 +5117,37 @@ __pyx_t_2 = __pyx_v_header->is_complex; if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":680 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":680 * if header.is_complex: * # avoid array copy to save memory * data = self.read_numeric(False) # <<<<<<<<<<<<<< * data_j = self.read_numeric(False) * data = data + (data_j * 1j) */ - __pyx_1.__pyx_n = 1; - __pyx_1.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3.__pyx_n = 1; + __pyx_t_3.copy = 0; + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":681 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":681 * # avoid array copy to save memory * data = self.read_numeric(False) * data_j = self.read_numeric(False) # <<<<<<<<<<<<<< * data = data + (data_j * 1j) * else: */ - __pyx_1.__pyx_n = 1; - __pyx_1.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3.__pyx_n = 1; + __pyx_t_3.copy = 0; + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data_j)); __pyx_v_data_j = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":682 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":682 * data = self.read_numeric(False) * data_j = self.read_numeric(False) * data = data + (data_j * 1j) # <<<<<<<<<<<<<< @@ -5052,13 +5156,13 @@ */ __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5066,7 +5170,7 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":684 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":684 * data = data + (data_j * 1j) * else: * data = self.read_numeric() # <<<<<<<<<<<<<< @@ -5081,7 +5185,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":697 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":697 * to each rowind * ''' * M,N = header.dims # <<<<<<<<<<<<<< @@ -5090,87 +5194,87 @@ */ if (PyTuple_CheckExact(__pyx_v_header->dims) && likely(PyTuple_GET_SIZE(__pyx_v_header->dims) == 2)) { PyObject* tuple = __pyx_v_header->dims; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_v_M = __pyx_t_4; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_M = __pyx_t_5; + __pyx_v_N = __pyx_t_6; + } else { + __pyx_t_7 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_6 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_M = __pyx_t_6; __pyx_v_N = __pyx_t_5; - } else { - __pyx_2 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_M = __pyx_t_5; - __pyx_v_N = __pyx_t_4; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":698 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":698 * ''' * M,N = header.dims * indptr = indptr[:N+1] # <<<<<<<<<<<<<< * nnz = indptr[-1] * rowind = rowind[:nnz] */ - __pyx_3 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_indptr)); - __pyx_v_indptr = ((PyArrayObject *)__pyx_3); - __pyx_3 = 0; + __pyx_v_indptr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":699 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":699 * M,N = header.dims * indptr = indptr[:N+1] * nnz = indptr[-1] # <<<<<<<<<<<<<< * rowind = rowind[:nnz] * data = data[:nnz] */ - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_2); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_nnz = __pyx_t_4; + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_nnz = __pyx_t_5; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":700 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":700 * indptr = indptr[:N+1] * nnz = indptr[-1] * rowind = rowind[:nnz] # <<<<<<<<<<<<<< * data = data[:nnz] * return scipy.sparse.csc_matrix( */ - __pyx_3 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rowind)); - __pyx_v_rowind = ((PyArrayObject *)__pyx_3); - __pyx_3 = 0; + __pyx_v_rowind = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":701 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":701 * nnz = indptr[-1] * rowind = rowind[:nnz] * data = data[:nnz] # <<<<<<<<<<<<<< * return scipy.sparse.csc_matrix( * (data,rowind,indptr), */ - __pyx_2 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); - __pyx_v_data = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_v_data = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":702 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":702 * rowind = rowind[:nnz] * data = data[:nnz] * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< @@ -5178,16 +5282,16 @@ * shape=(M,N)) */ __Pyx_XDECREF(__pyx_r); - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_scipy); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_csc_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":703 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":703 * data = data[:nnz] * return scipy.sparse.csc_matrix( * (data,rowind,indptr), # <<<<<<<<<<<<<< @@ -5195,7 +5299,7 @@ * */ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_data)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_data)); __Pyx_GIVEREF(((PyObject *)__pyx_v_data)); @@ -5205,54 +5309,61 @@ __Pyx_INCREF(((PyObject *)__pyx_v_indptr)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_indptr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indptr)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":704 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":702 + * rowind = rowind[:nnz] + * data = data[:nnz] + * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< + * (data,rowind,indptr), + * shape=(M,N)) + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":704 * return scipy.sparse.csc_matrix( * (data,rowind,indptr), * shape=(M,N)) # <<<<<<<<<<<<<< * * cpdef cnp.ndarray read_char(self, VarHeader5 header): */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_2, __pyx_kp_shape, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_8; + __pyx_t_9 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); __pyx_t_8 = 0; + __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_7, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_r = __pyx_t_10; + __pyx_t_10 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_2); - __Pyx_XDECREF(__pyx_3); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_sparse"); __pyx_r = 0; __pyx_L0:; @@ -5260,12 +5371,14 @@ __Pyx_DECREF((PyObject *)__pyx_v_indptr); __Pyx_DECREF((PyObject *)__pyx_v_data); __Pyx_DECREF((PyObject *)__pyx_v_data_j); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":706 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":706 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5285,15 +5398,18 @@ PyArray_Descr *__pyx_v_dt = 0; PyObject *__pyx_v_uc_str; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element __pyx_2; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element __pyx_t_4; + PyObject *__pyx_t_5; int __pyx_t_6; - __Pyx_SetupRefcountContext("read_char"); + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + int __pyx_t_9; + __Pyx_RefNannySetupContext("read_char"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); __pyx_v_codec = Py_None; __Pyx_INCREF(Py_None); __pyx_v_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -5302,28 +5418,28 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_char); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_header)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":732 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":732 * object data, res, codec * cnp.ndarray arr * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -5332,43 +5448,43 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":734 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":734 * cdef size_t length = self.size_from_header(header) * data = self.read_element( * &mdtype, &byte_count, &data_ptr, True) # <<<<<<<<<<<<<< * # Character data can be of apparently numerical types, * # specifically np.uint8, np.int8, np.uint16. np.unit16 can have */ - __pyx_2.__pyx_n = 1; - __pyx_2.copy = 1; - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.copy = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_data); - __pyx_v_data = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_data = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":739 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":739 * # a length 1 type encoding, like ascii, or length 2 type * # encoding * cdef cnp.dtype dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< * if mdtype == miUINT16: * codec = self.uint16_codec */ - __pyx_t_3 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); - __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_3))); - __pyx_v_dt = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_5 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); + __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_5))); + __pyx_v_dt = ((PyArray_Descr *)__pyx_t_5); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":740 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":740 * # encoding * cdef cnp.dtype dt = self.dtypes[mdtype] * if mdtype == miUINT16: # <<<<<<<<<<<<<< * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only */ - __pyx_t_4 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT16); - if (__pyx_t_4) { + __pyx_t_6 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT16); + if (__pyx_t_6) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":741 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":741 * cdef cnp.dtype dt = self.dtypes[mdtype] * if mdtype == miUINT16: * codec = self.uint16_codec # <<<<<<<<<<<<<< @@ -5379,196 +5495,198 @@ __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = __pyx_v_self->uint16_codec; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":742 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":742 * if mdtype == miUINT16: * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only # <<<<<<<<<<<<<< * arr = np.ndarray(shape=(length,), * dtype=dt, */ - __pyx_1 = PyObject_GetItem(__pyx_v_self->codecs, __pyx_kp_53); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + __pyx_t_1 = PyObject_GetItem(__pyx_v_self->codecs, ((PyObject *)__pyx_n_s__uint16_len)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":743 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":743 * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), # <<<<<<<<<<<<<< * dtype=dt, * buffer=data) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ndarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_1)); - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_1, __pyx_kp_shape, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":744 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":744 * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), * dtype=dt, # <<<<<<<<<<<<<< * buffer=data) * data = arr.astype(np.uint8).tostring() */ - if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":745 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":745 * arr = np.ndarray(shape=(length,), * dtype=dt, * buffer=data) # <<<<<<<<<<<<<< * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: */ - if (PyDict_SetItem(__pyx_1, __pyx_kp_buffer, __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__buffer), __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":746 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":746 * dtype=dt, * buffer=data) * data = arr.astype(np.uint8).tostring() # <<<<<<<<<<<<<< * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' */ - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_astype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_54); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_tostring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__astype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tostring); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_data); - __pyx_v_data = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_data = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L4; } __pyx_L4:; goto __pyx_L3; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":747 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":747 * buffer=data) * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: # <<<<<<<<<<<<<< * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data */ - if (!(__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8)) { - __pyx_t_4 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT8); + __pyx_t_6 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8); + if (!__pyx_t_6) { + __pyx_t_8 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT8); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_4 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8); + __pyx_t_9 = __pyx_t_6; } - if (__pyx_t_4) { + if (__pyx_t_9) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":748 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":748 * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' # <<<<<<<<<<<<<< * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] */ - __Pyx_INCREF(__pyx_kp_55); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); __Pyx_DECREF(__pyx_v_codec); - __pyx_v_codec = __pyx_kp_55; + __pyx_v_codec = ((PyObject *)__pyx_n_s__ascii); goto __pyx_L3; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":749 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":749 * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data # <<<<<<<<<<<<<< * codec = self.codecs[mdtype] * if not codec: */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = (PySequence_Contains(__pyx_v_self->codecs, __pyx_t_2)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = ((PySequence_Contains(__pyx_v_self->codecs, __pyx_t_1))); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_9) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":750 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":750 * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] # <<<<<<<<<<<<<< * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_codec); - __pyx_v_codec = __pyx_1; - __pyx_1 = 0; + __pyx_v_codec = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":751 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":751 * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] * if not codec: # <<<<<<<<<<<<<< * raise TypeError('Do not support encoding %d' % mdtype) * else: */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = (!__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = (!__pyx_t_9); if (__pyx_t_6) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":752 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":752 * codec = self.codecs[mdtype] * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) # <<<<<<<<<<<<<< * else: * raise ValueError('Type %d does not appear to be char type' */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_56, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } @@ -5577,81 +5695,81 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":755 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":755 * else: * raise ValueError('Type %d does not appear to be char type' * % mdtype) # <<<<<<<<<<<<<< * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(__pyx_kp_57, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":756 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":756 * raise ValueError('Type %d does not appear to be char type' * % mdtype) * uc_str = data.decode(codec) # <<<<<<<<<<<<<< * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_kp_decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_codec); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_codec); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_codec); __Pyx_GIVEREF(__pyx_v_codec); - __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_uc_str); - __pyx_v_uc_str = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_uc_str = __pyx_t_7; + __pyx_t_7 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":758 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":758 * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str) # <<<<<<<<<<<<<< * dt = self.U1_dtype * # could take this to numpy C-API level, but probably not worth */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_uc_str); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_uc_str); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_uc_str); __Pyx_GIVEREF(__pyx_v_uc_str); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":759 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":759 * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str) * dt = self.U1_dtype # <<<<<<<<<<<<<< @@ -5662,7 +5780,7 @@ __Pyx_DECREF(((PyObject *)__pyx_v_dt)); __pyx_v_dt = __pyx_v_self->U1_dtype; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":762 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":762 * # could take this to numpy C-API level, but probably not worth * # it * return np.ndarray(shape=header.dims, # <<<<<<<<<<<<<< @@ -5670,57 +5788,49 @@ * buffer=arr, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ndarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_1)); - if (PyDict_SetItem(__pyx_1, __pyx_kp_shape, __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":763 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":763 * # it * return np.ndarray(shape=header.dims, * dtype=dt, # <<<<<<<<<<<<<< * buffer=arr, * order='F') */ - if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":764 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":764 * return np.ndarray(shape=header.dims, * dtype=dt, * buffer=arr, # <<<<<<<<<<<<<< * order='F') * */ - if (PyDict_SetItem(__pyx_1, __pyx_kp_buffer, ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":765 - * dtype=dt, - * buffer=arr, - * order='F') # <<<<<<<<<<<<<< - * - * cpdef cnp.ndarray read_cells(self, VarHeader5 header): - */ - if (PyDict_SetItem(__pyx_1, __pyx_kp_order, __pyx_kp_58) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_char"); __pyx_r = 0; __pyx_L0:; @@ -5729,12 +5839,14 @@ __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XDECREF((PyObject *)__pyx_v_dt); __Pyx_DECREF(__pyx_v_uc_str); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":706 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":706 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5743,11 +5855,11 @@ */ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char(PyObject *__pyx_v_self, PyObject *__pyx_v_header); /*proto*/ -static char __pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char[] = " Read char matrices from stream as arrays\n\n Matrices of char are likely to be converted to matrices of\n string by later processing in ``process_element``\n "; +static char __pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char[] = " Read char matrices from stream as arrays\n\n Matrices of char are likely to be converted to matrices of\n string by later processing in ``array_from_header``\n "; static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char(PyObject *__pyx_v_self, PyObject *__pyx_v_header) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_char"); + __Pyx_RefNannySetupContext("read_char"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5764,11 +5876,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":767 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":767 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5786,20 +5898,22 @@ Py_ssize_t __pyx_bstride_0_result = 0; Py_ssize_t __pyx_bshape_0_result = 0; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyArrayObject *__pyx_t_4 = NULL; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - size_t __pyx_t_9; + PyObject *__pyx_t_9 = NULL; size_t __pyx_t_10; - PyObject **__pyx_t_11; - __Pyx_SetupRefcountContext("read_cells"); + size_t __pyx_t_11; + size_t __pyx_t_12; + PyObject **__pyx_t_13; + __Pyx_RefNannySetupContext("read_cells"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_tupdims = Py_None; __Pyx_INCREF(Py_None); __pyx_bstruct_result.buf = NULL; @@ -5807,52 +5921,52 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_cells); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_cells)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_cells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_cells)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_header)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":773 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":773 * cnp.ndarray[object, ndim=1] result * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) */ - __pyx_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_2); - __Pyx_GIVEREF(__pyx_2); - __pyx_2 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_tupdims); - __pyx_v_tupdims = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_tupdims = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":774 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":774 * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -5861,92 +5975,93 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":775 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":775 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * result[i] = self.read_mi_matrix() */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = ((PyArrayObject *)__pyx_t_2); + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_t_5 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_5 < 0)) { - PyErr_Fetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_6); Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); + Py_XDECREF(__pyx_t_7); Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_6, __pyx_t_7, __pyx_t_8); + PyErr_Restore(__pyx_t_7, __pyx_t_8, __pyx_t_9); } } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_result)); + __pyx_v_result = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":776 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":776 * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< * result[i] = self.read_mi_matrix() * return result.reshape(tupdims).T */ - for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_v_length; __pyx_t_9+=1) { - __pyx_v_i = __pyx_t_9; + __pyx_t_10 = __pyx_v_length; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_i = __pyx_t_11; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":777 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":777 * result = np.empty(length, dtype=object) * for i in range(length): * result[i] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return result.reshape(tupdims).T * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __pyx_v_i; - __pyx_t_5 = -1; - if (unlikely(__pyx_t_10 >= __pyx_bshape_0_result)) __pyx_t_5 = 0; - if (unlikely(__pyx_t_5 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_5); + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __pyx_v_i; + __pyx_t_6 = -1; + if (unlikely(__pyx_t_12 >= __pyx_bshape_0_result)) __pyx_t_6 = 0; + if (unlikely(__pyx_t_6 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_11 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_10, __pyx_bstride_0_result); - __Pyx_GOTREF(*__pyx_t_11); - __Pyx_DECREF(*__pyx_t_11); __Pyx_INCREF(__pyx_t_2); - *__pyx_t_11 = __pyx_t_2; - __Pyx_GIVEREF(*__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_13 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_12, __pyx_bstride_0_result); + __Pyx_GOTREF(*__pyx_t_13); + __Pyx_DECREF(*__pyx_t_13); __Pyx_INCREF(__pyx_t_4); + *__pyx_t_13 = __pyx_t_4; + __Pyx_GIVEREF(*__pyx_t_13); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":778 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":778 * for i in range(length): * result[i] = self.read_mi_matrix() * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -5954,21 +6069,21 @@ * def read_fieldnames(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_kp_reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_kp_T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -5976,11 +6091,10 @@ __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); @@ -5993,12 +6107,14 @@ __pyx_L2:; __Pyx_DECREF((PyObject *)__pyx_v_result); __Pyx_DECREF(__pyx_v_tupdims); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":767 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":767 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6011,7 +6127,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_cells(PyObject *__pyx_v_self, PyObject *__pyx_v_header) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_cells"); + __Pyx_RefNannySetupContext("read_cells"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_cells(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6028,11 +6144,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":780 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":780 * return result.reshape(tupdims).T * * def read_fieldnames(self): # <<<<<<<<<<<<<< @@ -6046,9 +6162,9 @@ int __pyx_v_n_names; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_fieldnames"); + __Pyx_RefNannySetupContext("read_fieldnames"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":786 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":786 * ''' * cdef int n_names * return self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< @@ -6070,11 +6186,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":788 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":788 * return self.cread_fieldnames(&n_names) * * cdef inline object cread_fieldnames(self, int *n_names_ptr): # <<<<<<<<<<<<<< @@ -6082,7 +6198,7 @@ * cnp.int32_t namelength */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_cread_fieldnames(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, int *__pyx_v_n_names_ptr) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_cread_fieldnames(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, int *__pyx_v_n_names_ptr) { __pyx_t_5numpy_int32_t __pyx_v_namelength; int __pyx_v_i; int __pyx_v_n_names; @@ -6096,12 +6212,15 @@ int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - __Pyx_SetupRefcountContext("cread_fieldnames"); + Py_ssize_t __pyx_t_5; + char *__pyx_t_6; + int __pyx_t_7; + __Pyx_RefNannySetupContext("cread_fieldnames"); + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); __pyx_v_field_names = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":794 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":794 * object name, field_names * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) # <<<<<<<<<<<<<< @@ -6111,7 +6230,7 @@ __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, (&__pyx_v_namelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":795 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":795 * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) * if res != 1: # <<<<<<<<<<<<<< @@ -6121,7 +6240,7 @@ __pyx_t_2 = (__pyx_v_res != 1); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":796 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":796 * cdef int res = self.read_into_int32s(&namelength) * if res != 1: * raise ValueError('Only one value for namelength') # <<<<<<<<<<<<<< @@ -6129,13 +6248,13 @@ * field_names = [] */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_kp_59); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_59); - __Pyx_GIVEREF(__pyx_kp_59); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6143,7 +6262,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":797 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":797 * if res != 1: * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() # <<<<<<<<<<<<<< @@ -6155,7 +6274,7 @@ __pyx_v_names = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":798 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":798 * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() * field_names = [] # <<<<<<<<<<<<<< @@ -6168,36 +6287,46 @@ __pyx_v_field_names = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":799 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":799 * cdef object names = self.read_int8_string() * field_names = [] * n_names = PyString_Size(names) // namelength # <<<<<<<<<<<<<< * cdef char *n_ptr = names * for i in range(n_names): */ - __pyx_v_n_names = (PyString_Size(__pyx_v_names) / __pyx_v_namelength); + __pyx_t_5 = PyString_Size(__pyx_v_names); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_v_namelength == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_namelength == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { + PyErr_Format(PyExc_OverflowError, "value too large to perform division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_n_names = __Pyx_div_Py_ssize_t(__pyx_t_5, __pyx_v_namelength); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":800 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":800 * field_names = [] * n_names = PyString_Size(names) // namelength * cdef char *n_ptr = names # <<<<<<<<<<<<<< * for i in range(n_names): * name = PyString_FromString(n_ptr) */ - __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_n_ptr = __pyx_t_5; + __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n_ptr = __pyx_t_6; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":801 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":801 * n_names = PyString_Size(names) // namelength * cdef char *n_ptr = names * for i in range(n_names): # <<<<<<<<<<<<<< * name = PyString_FromString(n_ptr) * field_names.append(name) */ - for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_v_n_names; __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_1 = __pyx_v_n_names; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":802 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":802 * cdef char *n_ptr = names * for i in range(n_names): * name = PyString_FromString(n_ptr) # <<<<<<<<<<<<<< @@ -6210,7 +6339,7 @@ __pyx_v_name = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":803 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":803 * for i in range(n_names): * name = PyString_FromString(n_ptr) * field_names.append(name) # <<<<<<<<<<<<<< @@ -6221,7 +6350,7 @@ __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":804 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":804 * name = PyString_FromString(n_ptr) * field_names.append(name) * n_ptr += namelength # <<<<<<<<<<<<<< @@ -6231,7 +6360,7 @@ __pyx_v_n_ptr += __pyx_v_namelength; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":805 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":805 * field_names.append(name) * n_ptr += namelength * n_names_ptr[0] = n_names # <<<<<<<<<<<<<< @@ -6240,7 +6369,7 @@ */ (__pyx_v_n_names_ptr[0]) = __pyx_v_n_names; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":806 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":806 * n_ptr += namelength * n_names_ptr[0] = n_names * return field_names # <<<<<<<<<<<<<< @@ -6263,12 +6392,13 @@ __Pyx_DECREF(__pyx_v_name); __Pyx_DECREF(__pyx_v_field_names); __Pyx_XDECREF(__pyx_v_names); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":808 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":808 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6294,22 +6424,24 @@ Py_ssize_t __pyx_bstride_0_result = 0; Py_ssize_t __pyx_bshape_0_result = 0; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; - PyArrayObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_7; + size_t __pyx_t_8; + PyArrayObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - PyObject **__pyx_t_13; - __Pyx_SetupRefcountContext("read_struct"); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + PyObject **__pyx_t_15; + __Pyx_RefNannySetupContext("read_struct"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF((PyObject *)__pyx_v_header); __pyx_v_rec_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_result = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_dt = Py_None; __Pyx_INCREF(Py_None); @@ -6323,64 +6455,64 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_struct); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_header)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":821 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":821 * object dt, tupdims * # Read field names into list * cdef object field_names = self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< * # Prepare struct array * tupdims = tuple(header.dims[::-1]) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_field_names = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_field_names = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":823 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":823 * cdef object field_names = self.cread_fieldnames(&n_names) * # Prepare struct array * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays */ - __pyx_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_2); - __Pyx_GIVEREF(__pyx_2); - __pyx_2 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_tupdims); - __pyx_v_tupdims = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_tupdims = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":824 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":824 * # Prepare struct array * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -6389,27 +6521,27 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":825 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":825 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays # <<<<<<<<<<<<<< * if not n_names: * # If there are no field names, there is no dtype */ - __pyx_t_3 = __pyx_v_self->struct_as_record; - if (__pyx_t_3) { + __pyx_t_4 = __pyx_v_self->struct_as_record; + if (__pyx_t_4) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":826 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":826 * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays * if not n_names: # <<<<<<<<<<<<<< * # If there are no field names, there is no dtype * # representation we can use, falling back to empty */ - __pyx_t_4 = (!__pyx_v_n_names); - if (__pyx_t_4) { + __pyx_t_5 = (!__pyx_v_n_names); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":830 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":830 * # representation we can use, falling back to empty * # object * return np.empty(tupdims, dtype=object).T # <<<<<<<<<<<<<< @@ -6417,28 +6549,28 @@ * rec_res = np.empty(length, dtype=dt) */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_tupdims); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_kp_T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -6446,7 +6578,7 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":831 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":831 * # object * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] # <<<<<<<<<<<<<< @@ -6456,89 +6588,90 @@ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { - __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; __pyx_t_6 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_6); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); } for (;;) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_6))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; } else { - __pyx_t_1 = PyIter_Next(__pyx_t_5); - if (!__pyx_t_1) { + __pyx_t_3 = PyIter_Next(__pyx_t_6); + if (!__pyx_t_3) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); } __Pyx_DECREF(__pyx_v_field_name); - __pyx_v_field_name = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_v_field_name = __pyx_t_3; + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_field_name); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_field_name); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field_name); __Pyx_GIVEREF(__pyx_v_field_name); __Pyx_INCREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_builtin_object); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_object); __Pyx_GIVEREF(__pyx_builtin_object); - __pyx_t_3 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_4 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_v_dt); __pyx_v_dt = ((PyObject *)__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":832 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":832 * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) # <<<<<<<<<<<<<< * for i in range(length): * for field_name in field_names: */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rec_res)); - __pyx_v_rec_res = ((PyArrayObject *)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_rec_res = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":833 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":833 * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) * for i in range(length): # <<<<<<<<<<<<<< * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() */ - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_v_length; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_8 = __pyx_v_length; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_8; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":834 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":834 * rec_res = np.empty(length, dtype=dt) * for i in range(length): * for field_name in field_names: # <<<<<<<<<<<<<< @@ -6546,49 +6679,49 @@ * return rec_res.reshape(tupdims).T */ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { - __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); } for (;;) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; } else { - __pyx_t_1 = PyIter_Next(__pyx_t_5); - if (!__pyx_t_1) { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_v_field_name); - __pyx_v_field_name = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_field_name = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":835 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":835 * for i in range(length): * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_1, __pyx_v_field_name, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetItem(__pyx_t_3, __pyx_v_field_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":836 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":836 * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() * return rec_res.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -6596,140 +6729,141 @@ * obj_template = mio5p.mat_struct() */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_kp_reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tupdims); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":838 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":838 * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() # <<<<<<<<<<<<<< * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_mat_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mat_struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_obj_template); __pyx_v_obj_template = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":839 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":839 * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names # <<<<<<<<<<<<<< * result = np.empty(length, dtype=object) * for i in range(length): */ - if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_kp__fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_n_s___fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":840 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":840 * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * item = pycopy(obj_template) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); - __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_3 < 0)) { - PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __pyx_t_4 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_4 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_result, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_object, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); + PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); } } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_7 = 0; + __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); - __pyx_v_result = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_result = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":841 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":841 * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< * item = pycopy(obj_template) * for name in field_names: */ - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_v_length; __pyx_t_3+=1) { - __pyx_v_i = __pyx_t_3; + __pyx_t_8 = __pyx_v_length; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_8; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":842 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":842 * result = np.empty(length, dtype=object) * for i in range(length): * item = pycopy(obj_template) # <<<<<<<<<<<<<< * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_pycopy); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__pycopy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_obj_template); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_obj_template); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj_template); __Pyx_GIVEREF(__pyx_v_obj_template); - __pyx_t_5 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_item); - __pyx_v_item = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_item = __pyx_t_1; + __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":843 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":843 * for i in range(length): * item = pycopy(obj_template) * for name in field_names: # <<<<<<<<<<<<<< @@ -6737,72 +6871,72 @@ * result[i] = item */ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { - __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_5); + __pyx_t_7 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); } for (;;) { - if (likely(PyList_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; } else { - __pyx_t_1 = PyIter_Next(__pyx_t_5); - if (!__pyx_t_1) { + __pyx_t_2 = PyIter_Next(__pyx_t_1); + if (!__pyx_t_2) { if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_v_name); - __pyx_v_name = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_name = __pyx_t_2; + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":844 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":844 * item = pycopy(obj_template) * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * result[i] = item * return result.reshape(tupdims).T */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_item, __pyx_kp___dict__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_2, __pyx_v_name, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s____dict__); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (PyObject_SetItem(__pyx_t_6, __pyx_v_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":845 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":845 * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() * result[i] = item # <<<<<<<<<<<<<< * return result.reshape(tupdims).T * */ - __pyx_t_11 = __pyx_v_i; - __pyx_t_12 = -1; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_result; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_result)) __pyx_t_12 = 0; - if (unlikely(__pyx_t_12 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_12); + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = -1; + if (__pyx_t_13 < 0) { + __pyx_t_13 += __pyx_bshape_0_result; + if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_result)) __pyx_t_14 = 0; + if (unlikely(__pyx_t_14 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_13 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_11, __pyx_bstride_0_result); - __Pyx_GOTREF(*__pyx_t_13); - __Pyx_DECREF(*__pyx_t_13); __Pyx_INCREF(__pyx_v_item); - *__pyx_t_13 = __pyx_v_item; - __Pyx_GIVEREF(*__pyx_t_13); + __pyx_t_15 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_13, __pyx_bstride_0_result); + __Pyx_GOTREF(*__pyx_t_15); + __Pyx_DECREF(*__pyx_t_15); __Pyx_INCREF(__pyx_v_item); + *__pyx_t_15 = __pyx_v_item; + __Pyx_GIVEREF(*__pyx_t_15); } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":846 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":846 * item.__dict__[name] = self.read_mi_matrix() * result[i] = item * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -6810,33 +6944,32 @@ * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_kp_reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_tupdims); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_result); @@ -6856,12 +6989,14 @@ __Pyx_DECREF(__pyx_v_obj_template); __Pyx_DECREF(__pyx_v_item); __Pyx_DECREF(__pyx_v_name); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF((PyObject *)__pyx_v_header); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":808 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":808 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6874,7 +7009,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct(PyObject *__pyx_v_self, PyObject *__pyx_v_header) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_struct"); + __Pyx_RefNannySetupContext("read_struct"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_struct(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6891,11 +7026,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":848 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":848 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -6907,130 +7042,130 @@ static PyArrayObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *__pyx_v_hdr, int __pyx_skip_dispatch) { PyArrayObject *__pyx_v_res = 0; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_opaque"); + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("read_opaque"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_read_opaque); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_hdr)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_hdr)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_hdr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_hdr)); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":874 - * * some_functions.mat + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":864 + * See the comments at the beginning of ``mio5.py`` * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) # <<<<<<<<<<<<<< * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_1)); - if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_res = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_res = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":875 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":865 * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_1, __pyx_kp_60, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s0), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":876 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":866 * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_1, __pyx_kp_61, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":877 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":867 * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['arr'] = self.read_mi_matrix() * return res */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_1, __pyx_kp_62, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":878 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":868 * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return res */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_1, __pyx_kp_63, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":879 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":869 * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() * return res # <<<<<<<<<<<<<< @@ -7043,20 +7178,20 @@ __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_opaque"); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_res); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":848 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":848 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -7065,11 +7200,11 @@ */ static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque(PyObject *__pyx_v_self, PyObject *__pyx_v_hdr); /*proto*/ -static char __pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque[] = " Read opaque (function workspace) type\n\n Looking at some mat files, the structure of this type seems to\n be:\n\n * array flags as usual (already read into `hdr`)\n * 3 int8 strings\n * a matrix\n\n At the end of the mat file (it seems) there is then an unnamed\n top-level variable (name = '') which appears to be of double\n class (mxCLASS_DOUBLE), but stored as uint8, the memory for\n which is in the format of a mini .mat file, without the first\n 124 bytes of the file header (the description and the\n subsystem_offset), but with the version U2 bytes, and the S2\n endian test bytes. There follow 4 zero bytes, presumably for 8\n byte padding, and then a series of miMATRIX entries, as in a\n standard mat file.\n\n The mat files I was playing with are in ``tests/data``:\n\n * sqr.mat\n * parabola.mat\n * some_functions.mat\n "; +static char __pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque[] = " Read opaque (function workspace) type\n\n Looking at some mat files, the structure of this type seems to\n be:\n\n * array flags as usual (already read into `hdr`)\n * 3 int8 strings\n * a matrix\n\n Then there's a matrix at the end of the mat file that seems have\n the anonymous founction workspaces - we load it as\n ``__function_workspace__``\n\n See the comments at the beginning of ``mio5.py``\n "; static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque(PyObject *__pyx_v_self, PyObject *__pyx_v_hdr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("read_opaque"); + __Pyx_RefNannySetupContext("read_opaque"); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hdr), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "hdr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_opaque(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_hdr), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7086,11 +7221,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":152 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -7112,18 +7247,21 @@ int __pyx_v_hasfields; int __pyx_r; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - char *__pyx_t_7; - __Pyx_SetupRefcountContext("__getbuffer__"); + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":158 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -7132,7 +7270,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":159 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -7141,7 +7279,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":161 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -7150,7 +7288,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":163 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -7160,7 +7298,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":164 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -7172,7 +7310,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":166 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -7183,96 +7321,100 @@ } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":168 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":169 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_3 = __pyx_t_1; } - if (__pyx_t_1) { + if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":170 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); - __Pyx_GIVEREF(__pyx_kp_1); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":172 - * raise ValueError("ndarray is not C contiguous") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":173 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_2 = __pyx_t_3; } - if (__pyx_t_1) { + if (__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":174 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2); - __Pyx_GIVEREF(__pyx_kp_2); - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":176 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -7280,7 +7422,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":177 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -7289,17 +7431,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":178 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_t_4 = __pyx_v_copy_shape; - if (__pyx_t_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":181 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -7308,7 +7450,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":182 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -7317,17 +7459,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":183 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":184 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -7336,7 +7479,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":185 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -7349,7 +7492,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -7358,7 +7501,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -7369,7 +7512,7 @@ } __pyx_L8:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":189 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -7378,7 +7521,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":190 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -7387,7 +7530,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":191 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -7396,7 +7539,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -7405,7 +7548,7 @@ */ __pyx_v_f = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -7415,7 +7558,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -7424,21 +7567,23 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - if ((!__pyx_v_hasfields)) { - __pyx_t_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; } else { - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -7454,7 +7599,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -7469,7 +7614,7 @@ } __pyx_L11:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -7479,7 +7624,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -7488,319 +7633,322 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") */ - if ((__pyx_v_descr->byteorder == '>')) { - __pyx_t_1 = __pyx_v_little_endian; + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; } else { - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_2 = __pyx_t_1; } - if (!__pyx_t_1) { + if (!__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - if ((__pyx_v_descr->byteorder == '<')) { - __pyx_t_5 = (!__pyx_v_little_endian); + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; } else { - __pyx_t_5 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_8 = __pyx_t_1; } - __pyx_t_6 = __pyx_t_5; + __pyx_t_1 = __pyx_t_8; } else { - __pyx_t_6 = __pyx_t_1; + __pyx_t_1 = __pyx_t_2; } - if (__pyx_t_6) { + if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_5); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); - __Pyx_GIVEREF(__pyx_kp_5); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L13; } __pyx_L13:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - __pyx_t_6 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_6; + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 - * raise ValueError("Non-native byte order not supported") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_t_6 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_7; + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":215 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_t_6 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_8; + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_t_6 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_9; + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_t_6 = (__pyx_v_t == NPY_INT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_10; + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_t_6 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_11; + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_12; + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_t_6 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_13; + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_14; + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_t_6 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_15; + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_t_6 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_16; + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_t_6 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_17; + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_18; + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_t_6 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_19; + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_t_6 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_20; + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":228 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_t_6 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_21; + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_6 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_22; + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; goto __pyx_L14; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L14:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":232 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":233 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: @@ -7812,7 +7960,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -7821,7 +7969,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -7830,7 +7978,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -7839,17 +7987,17 @@ */ __pyx_v_offset = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":240 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_7; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -7863,8 +8011,8 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); __pyx_r = -1; __Pyx_GOTREF(__pyx_v_info->obj); @@ -7877,11 +8025,12 @@ } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -7892,9 +8041,10 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { int __pyx_t_1; - __Pyx_SetupRefcountContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -7904,7 +8054,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -7916,7 +8066,7 @@ } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -7926,7 +8076,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -7938,18 +8088,214 @@ } __pyx_L6:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":690 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 * ctypedef npy_cdouble complex_t * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child; int __pyx_v_endian_detector; int __pyx_v_little_endian; @@ -7958,9 +8304,6 @@ PyObject *__pyx_v_new_offset; PyObject *__pyx_v_t; char *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -7969,15 +8312,17 @@ int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; - char *__pyx_t_9; - __Pyx_SetupRefcountContext("_util_dtypestring"); + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":697 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -7986,7 +8331,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":698 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -7995,7 +8340,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":701 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -8005,7 +8350,7 @@ if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; @@ -8014,21 +8359,21 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":702 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_1 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!(likely(PyTuple_CheckExact(__pyx_1)) || (__pyx_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_1)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_1); - __pyx_1 = 0; + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":703 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -8037,122 +8382,125 @@ */ if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_2); - __pyx_2 = 0; + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_3; - __pyx_3 = 0; + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":705 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":706 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_kp_25); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25); - __Pyx_GIVEREF(__pyx_kp_25); - __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":708 - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") */ - if ((__pyx_v_child->byteorder == '>')) { - __pyx_t_6 = __pyx_v_little_endian; + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; } else { - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = __pyx_t_6; } - if (!__pyx_t_6) { + if (!__pyx_t_7) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":709 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - if ((__pyx_v_child->byteorder == '<')) { - __pyx_t_7 = (!__pyx_v_little_endian); + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_9 = __pyx_t_6; } - __pyx_t_8 = __pyx_t_7; + __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_8 = __pyx_t_6; + __pyx_t_6 = __pyx_t_7; } - if (__pyx_t_8) { + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":710 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_kp_28); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28); - __Pyx_GIVEREF(__pyx_kp_28); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":720 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -8160,16 +8508,16 @@ * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_8) break; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":721 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -8178,7 +8526,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":722 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -8187,7 +8535,7 @@ */ __pyx_v_f += 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":723 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -8197,7 +8545,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":725 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -8206,417 +8554,417 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":727 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_8) { + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":728 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: - * raise RuntimeError("Format string allocated too short.") + * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":729 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_8) { + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":730 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * t = child.type_num * if end - f < 5: - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_kp_29); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29); - __Pyx_GIVEREF(__pyx_kp_29); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":733 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":734 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":735 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":736 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":737 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":738 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":739 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":740 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":741 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":742 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":743 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":744 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":745 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":746 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":747 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":748 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":749 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":751 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":752 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), @@ -8626,25 +8974,26 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * + * */ __pyx_r = __pyx_v_f; goto __pyx_L0; @@ -8652,9 +9001,6 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); - __Pyx_XDECREF(__pyx_3); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -8667,10 +9013,150 @@ __Pyx_DECREF(__pyx_v_childname); __Pyx_DECREF(__pyx_v_new_offset); __Pyx_DECREF(__pyx_v_t); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static PyObject *__pyx_tp_new_5scipy_2io_6matlab_10mio5_utils_VarHeader5(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *p; PyObject *o = (*t->tp_alloc)(t, 0); @@ -8868,6 +9354,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 __pyx_vtable_5scipy_2io_6matlab_10mio5_utils_VarReader5; @@ -9114,6 +9604,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -9127,7 +9621,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mio5_utils"), - __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_17), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -9138,139 +9632,180 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, - {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 1, 1, 1}, - {&__pyx_kp___cinit__, __pyx_k___cinit__, sizeof(__pyx_k___cinit__), 1, 1, 1}, - {&__pyx_kp_set_stream, __pyx_k_set_stream, sizeof(__pyx_k_set_stream), 1, 1, 1}, - {&__pyx_kp_read_tag, __pyx_k_read_tag, sizeof(__pyx_k_read_tag), 1, 1, 1}, - {&__pyx_kp_read_numeric, __pyx_k_read_numeric, sizeof(__pyx_k_read_numeric), 1, 1, 1}, - {&__pyx_kp_read_full_tag, __pyx_k_read_full_tag, sizeof(__pyx_k_read_full_tag), 1, 1, 1}, - {&__pyx_kp_read_header, __pyx_k_read_header, sizeof(__pyx_k_read_header), 1, 1, 1}, - {&__pyx_kp_array_from_header, __pyx_k_array_from_header, sizeof(__pyx_k_array_from_header), 1, 1, 1}, - {&__pyx_kp_read_real_complex, __pyx_k_read_real_complex, sizeof(__pyx_k_read_real_complex), 1, 1, 1}, - {&__pyx_kp_read_char, __pyx_k_read_char, sizeof(__pyx_k_read_char), 1, 1, 1}, - {&__pyx_kp_read_cells, __pyx_k_read_cells, sizeof(__pyx_k_read_cells), 1, 1, 1}, - {&__pyx_kp_read_fieldnames, __pyx_k_read_fieldnames, sizeof(__pyx_k_read_fieldnames), 1, 1, 1}, - {&__pyx_kp_read_struct, __pyx_k_read_struct, sizeof(__pyx_k_read_struct), 1, 1, 1}, - {&__pyx_kp_read_opaque, __pyx_k_read_opaque, sizeof(__pyx_k_read_opaque), 1, 1, 1}, - {&__pyx_kp_32, __pyx_k_32, sizeof(__pyx_k_32), 1, 1, 1}, - {&__pyx_kp_preader, __pyx_k_preader, sizeof(__pyx_k_preader), 1, 1, 1}, - {&__pyx_kp_fobj, __pyx_k_fobj, sizeof(__pyx_k_fobj), 1, 1, 1}, - {&__pyx_kp_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 1, 1, 1}, - {&__pyx_kp_header, __pyx_k_header, sizeof(__pyx_k_header), 1, 1, 1}, - {&__pyx_kp_process, __pyx_k_process, sizeof(__pyx_k_process), 1, 1, 1}, - {&__pyx_kp_hdr, __pyx_k_hdr, sizeof(__pyx_k_hdr), 1, 1, 1}, - {&__pyx_kp_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 1, 1, 1}, - {&__pyx_kp_pycopy, __pyx_k_pycopy, sizeof(__pyx_k_pycopy), 0, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_33, __pyx_k_33, sizeof(__pyx_k_33), 1, 1, 1}, - {&__pyx_kp_34, __pyx_k_34, sizeof(__pyx_k_34), 1, 1, 1}, - {&__pyx_kp_miob, __pyx_k_miob, sizeof(__pyx_k_miob), 0, 1, 1}, - {&__pyx_kp_35, __pyx_k_35, sizeof(__pyx_k_35), 1, 1, 1}, - {&__pyx_kp_process_element, __pyx_k_process_element, sizeof(__pyx_k_process_element), 1, 1, 1}, - {&__pyx_kp_36, __pyx_k_36, sizeof(__pyx_k_36), 1, 1, 1}, - {&__pyx_kp_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 1}, - {&__pyx_kp_38, __pyx_k_38, sizeof(__pyx_k_38), 1, 1, 1}, - {&__pyx_kp_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 1, 1}, - {&__pyx_kp_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 1, 1, 1}, - {&__pyx_kp_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0}, - {&__pyx_kp_sys_is_le, __pyx_k_sys_is_le, sizeof(__pyx_k_sys_is_le), 1, 1, 1}, - {&__pyx_kp_native_code, __pyx_k_native_code, sizeof(__pyx_k_native_code), 1, 1, 1}, - {&__pyx_kp_swapped_code, __pyx_k_swapped_code, sizeof(__pyx_k_swapped_code), 1, 1, 1}, - {&__pyx_kp_OPAQUE_DTYPE, __pyx_k_OPAQUE_DTYPE, sizeof(__pyx_k_OPAQUE_DTYPE), 1, 1, 1}, - {&__pyx_kp_byte_order, __pyx_k_byte_order, sizeof(__pyx_k_byte_order), 1, 1, 1}, - {&__pyx_kp_struct_as_record, __pyx_k_struct_as_record, sizeof(__pyx_k_struct_as_record), 1, 1, 1}, - {&__pyx_kp_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 1, 1, 1}, - {&__pyx_kp_44, __pyx_k_44, sizeof(__pyx_k_44), 1, 1, 1}, - {&__pyx_kp_mat_stream, __pyx_k_mat_stream, sizeof(__pyx_k_mat_stream), 1, 1, 1}, - {&__pyx_kp_mat_dtype, __pyx_k_mat_dtype, sizeof(__pyx_k_mat_dtype), 1, 1, 1}, - {&__pyx_kp_chars_as_strings, __pyx_k_chars_as_strings, sizeof(__pyx_k_chars_as_strings), 1, 1, 1}, - {&__pyx_kp_squeeze_me, __pyx_k_squeeze_me, sizeof(__pyx_k_squeeze_me), 1, 1, 1}, - {&__pyx_kp_dtypes, __pyx_k_dtypes, sizeof(__pyx_k_dtypes), 1, 1, 1}, - {&__pyx_kp_items, __pyx_k_items, sizeof(__pyx_k_items), 1, 1, 1}, - {&__pyx_kp_basestring, __pyx_k_basestring, sizeof(__pyx_k_basestring), 1, 1, 1}, - {&__pyx_kp_class_dtypes, __pyx_k_class_dtypes, sizeof(__pyx_k_class_dtypes), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 1, 0}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 1, 1, 1}, - {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, - {&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1}, - {&__pyx_kp_array, __pyx_k_array, sizeof(__pyx_k_array), 1, 1, 1}, - {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1}, - {&__pyx_kp_MatlabObject, __pyx_k_MatlabObject, sizeof(__pyx_k_MatlabObject), 1, 1, 1}, - {&__pyx_kp_MatlabFunction, __pyx_k_MatlabFunction, sizeof(__pyx_k_MatlabFunction), 1, 1, 1}, - {&__pyx_kp_MatlabOpaque, __pyx_k_MatlabOpaque, sizeof(__pyx_k_MatlabOpaque), 1, 1, 1}, - {&__pyx_kp_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 1, 1, 1}, - {&__pyx_kp_T, __pyx_k_T, sizeof(__pyx_k_T), 1, 1, 1}, - {&__pyx_kp_sparse, __pyx_k_sparse, sizeof(__pyx_k_sparse), 1, 1, 1}, - {&__pyx_kp_csc_matrix, __pyx_k_csc_matrix, sizeof(__pyx_k_csc_matrix), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 1, 0}, - {&__pyx_kp_ndarray, __pyx_k_ndarray, sizeof(__pyx_k_ndarray), 1, 1, 1}, - {&__pyx_kp_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 1, 1, 1}, - {&__pyx_kp_54, __pyx_k_54, sizeof(__pyx_k_54), 1, 1, 1}, - {&__pyx_kp_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 1, 1, 1}, - {&__pyx_kp_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 1, 0}, - {&__pyx_kp_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 1, 1, 1}, - {&__pyx_kp_order, __pyx_k_order, sizeof(__pyx_k_order), 1, 1, 1}, - {&__pyx_kp_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 1, 0}, - {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1}, - {&__pyx_kp_object, __pyx_k_object, sizeof(__pyx_k_object), 1, 1, 1}, - {&__pyx_kp_mat_struct, __pyx_k_mat_struct, sizeof(__pyx_k_mat_struct), 1, 1, 1}, - {&__pyx_kp__fieldnames, __pyx_k__fieldnames, sizeof(__pyx_k__fieldnames), 1, 1, 1}, - {&__pyx_kp___dict__, __pyx_k___dict__, sizeof(__pyx_k___dict__), 1, 1, 1}, - {&__pyx_kp_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 1, 0}, - {&__pyx_kp_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 1, 0}, - {&__pyx_kp_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 1, 0}, - {&__pyx_kp_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 1, 0}, - {&__pyx_kp_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 0}, - {&__pyx_kp_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 0}, - {&__pyx_kp_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 0}, - {&__pyx_kp_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 0}, - {&__pyx_kp_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 0}, - {&__pyx_kp_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 0}, - {&__pyx_kp_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 0}, - {&__pyx_kp_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 0}, - {&__pyx_kp_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 0}, - {&__pyx_kp_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 0}, - {&__pyx_kp_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 0}, - {&__pyx_kp_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 0}, - {&__pyx_kp_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 0}, - {&__pyx_kp_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 0}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, - {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, - {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, + {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, + {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, + {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, + {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, + {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, + {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0}, + {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0}, + {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0}, + {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, + {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0}, + {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0}, + {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0}, + {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0}, + {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0}, + {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0}, + {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, + {&__pyx_n_s__MatlabFunction, __pyx_k__MatlabFunction, sizeof(__pyx_k__MatlabFunction), 0, 0, 1, 1}, + {&__pyx_n_s__MatlabObject, __pyx_k__MatlabObject, sizeof(__pyx_k__MatlabObject), 0, 0, 1, 1}, + {&__pyx_n_s__MatlabOpaque, __pyx_k__MatlabOpaque, sizeof(__pyx_k__MatlabOpaque), 0, 0, 1, 1}, + {&__pyx_n_s__OPAQUE_DTYPE, __pyx_k__OPAQUE_DTYPE, sizeof(__pyx_k__OPAQUE_DTYPE), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, + {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__U1_dtype, __pyx_k__U1_dtype, sizeof(__pyx_k__U1_dtype), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__VarReader5, __pyx_k__VarReader5, sizeof(__pyx_k__VarReader5), 0, 0, 1, 1}, + {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___fieldnames, __pyx_k___fieldnames, sizeof(__pyx_k___fieldnames), 0, 0, 1, 1}, + {&__pyx_n_s__arr, __pyx_k__arr, sizeof(__pyx_k__arr), 0, 0, 1, 1}, + {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, + {&__pyx_n_s__array_from_header, __pyx_k__array_from_header, sizeof(__pyx_k__array_from_header), 0, 0, 1, 1}, + {&__pyx_n_s__ascii, __pyx_k__ascii, sizeof(__pyx_k__ascii), 0, 0, 1, 1}, + {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1}, + {&__pyx_n_s__bool, __pyx_k__bool, sizeof(__pyx_k__bool), 0, 0, 1, 1}, + {&__pyx_n_s__bool_dtype, __pyx_k__bool_dtype, sizeof(__pyx_k__bool_dtype), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, + {&__pyx_n_s__byte_order, __pyx_k__byte_order, sizeof(__pyx_k__byte_order), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__chars_as_strings, __pyx_k__chars_as_strings, sizeof(__pyx_k__chars_as_strings), 0, 0, 1, 1}, + {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, + {&__pyx_n_s__class_dtypes, __pyx_k__class_dtypes, sizeof(__pyx_k__class_dtypes), 0, 0, 1, 1}, + {&__pyx_n_s__codecs, __pyx_k__codecs, sizeof(__pyx_k__codecs), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__cread_fieldnames, __pyx_k__cread_fieldnames, sizeof(__pyx_k__cread_fieldnames), 0, 0, 1, 1}, + {&__pyx_n_s__cread_full_tag, __pyx_k__cread_full_tag, sizeof(__pyx_k__cread_full_tag), 0, 0, 1, 1}, + {&__pyx_n_s__cread_tag, __pyx_k__cread_tag, sizeof(__pyx_k__cread_tag), 0, 0, 1, 1}, + {&__pyx_n_s__csc_matrix, __pyx_k__csc_matrix, sizeof(__pyx_k__csc_matrix), 0, 0, 1, 1}, + {&__pyx_n_s__cstream, __pyx_k__cstream, sizeof(__pyx_k__cstream), 0, 0, 1, 1}, + {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, + {&__pyx_n_s__dims_ptr, __pyx_k__dims_ptr, sizeof(__pyx_k__dims_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__dtypes, __pyx_k__dtypes, sizeof(__pyx_k__dtypes), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, + {&__pyx_n_s__is_complex, __pyx_k__is_complex, sizeof(__pyx_k__is_complex), 0, 0, 1, 1}, + {&__pyx_n_s__is_global, __pyx_k__is_global, sizeof(__pyx_k__is_global), 0, 0, 1, 1}, + {&__pyx_n_s__is_logical, __pyx_k__is_logical, sizeof(__pyx_k__is_logical), 0, 0, 1, 1}, + {&__pyx_n_s__is_swapped, __pyx_k__is_swapped, sizeof(__pyx_k__is_swapped), 0, 0, 1, 1}, + {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__little, __pyx_k__little, sizeof(__pyx_k__little), 0, 0, 1, 1}, + {&__pyx_n_s__little_endian, __pyx_k__little_endian, sizeof(__pyx_k__little_endian), 0, 0, 1, 1}, + {&__pyx_n_s__mat_dtype, __pyx_k__mat_dtype, sizeof(__pyx_k__mat_dtype), 0, 0, 1, 1}, + {&__pyx_n_s__mat_stream, __pyx_k__mat_stream, sizeof(__pyx_k__mat_stream), 0, 0, 1, 1}, + {&__pyx_n_s__mat_struct, __pyx_k__mat_struct, sizeof(__pyx_k__mat_struct), 0, 0, 1, 1}, + {&__pyx_n_s__mclass, __pyx_k__mclass, sizeof(__pyx_k__mclass), 0, 0, 1, 1}, + {&__pyx_n_s__mio5p, __pyx_k__mio5p, sizeof(__pyx_k__mio5p), 0, 0, 1, 1}, + {&__pyx_n_s__miob, __pyx_k__miob, sizeof(__pyx_k__miob), 0, 0, 1, 1}, + {&__pyx_n_s__n_dims, __pyx_k__n_dims, sizeof(__pyx_k__n_dims), 0, 0, 1, 1}, + {&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__native_code, __pyx_k__native_code, sizeof(__pyx_k__native_code), 0, 0, 1, 1}, + {&__pyx_n_s__ndarray, __pyx_k__ndarray, sizeof(__pyx_k__ndarray), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__nzmax, __pyx_k__nzmax, sizeof(__pyx_k__nzmax), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__preader, __pyx_k__preader, sizeof(__pyx_k__preader), 0, 0, 1, 1}, + {&__pyx_n_s__process, __pyx_k__process, sizeof(__pyx_k__process), 0, 0, 1, 1}, + {&__pyx_n_s__pycopy, __pyx_k__pycopy, sizeof(__pyx_k__pycopy), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__read_cells, __pyx_k__read_cells, sizeof(__pyx_k__read_cells), 0, 0, 1, 1}, + {&__pyx_n_s__read_char, __pyx_k__read_char, sizeof(__pyx_k__read_char), 0, 0, 1, 1}, + {&__pyx_n_s__read_element, __pyx_k__read_element, sizeof(__pyx_k__read_element), 0, 0, 1, 1}, + {&__pyx_n_s__read_element_into, __pyx_k__read_element_into, sizeof(__pyx_k__read_element_into), 0, 0, 1, 1}, + {&__pyx_n_s__read_fieldnames, __pyx_k__read_fieldnames, sizeof(__pyx_k__read_fieldnames), 0, 0, 1, 1}, + {&__pyx_n_s__read_full_tag, __pyx_k__read_full_tag, sizeof(__pyx_k__read_full_tag), 0, 0, 1, 1}, + {&__pyx_n_s__read_header, __pyx_k__read_header, sizeof(__pyx_k__read_header), 0, 0, 1, 1}, + {&__pyx_n_s__read_int8_string, __pyx_k__read_int8_string, sizeof(__pyx_k__read_int8_string), 0, 0, 1, 1}, + {&__pyx_n_s__read_into, __pyx_k__read_into, sizeof(__pyx_k__read_into), 0, 0, 1, 1}, + {&__pyx_n_s__read_into_int32s, __pyx_k__read_into_int32s, sizeof(__pyx_k__read_into_int32s), 0, 0, 1, 1}, + {&__pyx_n_s__read_mi_matrix, __pyx_k__read_mi_matrix, sizeof(__pyx_k__read_mi_matrix), 0, 0, 1, 1}, + {&__pyx_n_s__read_numeric, __pyx_k__read_numeric, sizeof(__pyx_k__read_numeric), 0, 0, 1, 1}, + {&__pyx_n_s__read_opaque, __pyx_k__read_opaque, sizeof(__pyx_k__read_opaque), 0, 0, 1, 1}, + {&__pyx_n_s__read_real_complex, __pyx_k__read_real_complex, sizeof(__pyx_k__read_real_complex), 0, 0, 1, 1}, + {&__pyx_n_s__read_sparse, __pyx_k__read_sparse, sizeof(__pyx_k__read_sparse), 0, 0, 1, 1}, + {&__pyx_n_s__read_string, __pyx_k__read_string, sizeof(__pyx_k__read_string), 0, 0, 1, 1}, + {&__pyx_n_s__read_struct, __pyx_k__read_struct, sizeof(__pyx_k__read_struct), 0, 0, 1, 1}, + {&__pyx_n_s__read_tag, __pyx_k__read_tag, sizeof(__pyx_k__read_tag), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__s0, __pyx_k__s0, sizeof(__pyx_k__s0), 0, 0, 1, 1}, + {&__pyx_n_s__s1, __pyx_k__s1, sizeof(__pyx_k__s1), 0, 0, 1, 1}, + {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, + {&__pyx_n_s__scipy, __pyx_k__scipy, sizeof(__pyx_k__scipy), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__set_stream, __pyx_k__set_stream, sizeof(__pyx_k__set_stream), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__size_from_header, __pyx_k__size_from_header, sizeof(__pyx_k__size_from_header), 0, 0, 1, 1}, + {&__pyx_n_s__sparse, __pyx_k__sparse, sizeof(__pyx_k__sparse), 0, 0, 1, 1}, + {&__pyx_n_s__squeeze_element, __pyx_k__squeeze_element, sizeof(__pyx_k__squeeze_element), 0, 0, 1, 1}, + {&__pyx_n_s__squeeze_me, __pyx_k__squeeze_me, sizeof(__pyx_k__squeeze_me), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__struct_as_record, __pyx_k__struct_as_record, sizeof(__pyx_k__struct_as_record), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__swapped_code, __pyx_k__swapped_code, sizeof(__pyx_k__swapped_code), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__sys_is_le, __pyx_k__sys_is_le, sizeof(__pyx_k__sys_is_le), 0, 0, 1, 1}, + {&__pyx_n_s__tostring, __pyx_k__tostring, sizeof(__pyx_k__tostring), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__uint16_codec, __pyx_k__uint16_codec, sizeof(__pyx_k__uint16_codec), 0, 0, 1, 1}, + {&__pyx_n_s__uint16_len, __pyx_k__uint16_len, sizeof(__pyx_k__uint16_len), 0, 0, 1, 1}, + {&__pyx_n_s__uint8, __pyx_k__uint8, sizeof(__pyx_k__uint8), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_kp_basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_kp_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_kp_object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_basestring = __Pyx_GetName(__pyx_b, __pyx_n_s__basestring); if (!__pyx_builtin_basestring) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -9284,23 +9819,23 @@ PyMODINIT_FUNC PyInit_mio5_utils(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { PyErr_Clear(); - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); - if (!__Pyx_Refnanny) - Py_FatalError("failed to import refnanny module"); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_mio5_utils(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_mio5_utils(void)", __LINE__, __FILE__); #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9316,7 +9851,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio5_utils"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio5_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_17), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -9327,14 +9862,13 @@ __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_scipy__io__matlab__mio5_utils) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ __pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE = ((PyArray_Descr *)Py_None); Py_INCREF(Py_None); /*--- Function export code ---*/ @@ -9387,64 +9921,65 @@ if (__Pyx_SetAttrString(__pyx_m, "VarReader5", (PyObject *)&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarReader5 = &__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream = __Pyx_ImportType("scipy.io.matlab.streams", "GenericStream", sizeof(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream)); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream = __Pyx_ImportType("scipy.io.matlab.streams", "GenericStream", sizeof(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream), 1); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_GetVtable(__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream->tp_dict, &__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ - __pyx_1 = __Pyx_ImportModule("scipy.io.matlab.streams"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_1, "make_stream", (void (**)(void))&__pyx_f_5scipy_2io_6matlab_7streams_make_stream, "struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *(PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_ImportModule("scipy.io.matlab.streams"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "make_stream", (void (**)(void))&__pyx_f_5scipy_2io_6matlab_7streams_make_stream, "struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *(PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":15 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":15 * ''' * * import sys # <<<<<<<<<<<<<< * * from copy import copy as pycopy */ - __pyx_1 = __Pyx_Import(__pyx_kp_sys, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":17 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":17 * import sys * * from copy import copy as pycopy # <<<<<<<<<<<<<< * * from python cimport Py_INCREF, Py_DECREF */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_copy); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_copy); - __Pyx_GIVEREF(__pyx_kp_copy); - __pyx_1 = __Pyx_Import(__pyx_kp_copy, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_pycopy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__copy)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__copy)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__copy)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pycopy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":29 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":29 * PyString_FromStringAndSize * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as cnp * */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":48 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":48 * # Numpy must be initialized before any code using the numpy C-API * # directly * cnp.import_array() # <<<<<<<<<<<<<< @@ -9453,183 +9988,321 @@ */ import_array(); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":58 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":58 * * cimport streams * import scipy.io.matlab.miobase as miob # <<<<<<<<<<<<<< - * from scipy.io.matlab.mio_utils import process_element + * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_34); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_34); - __Pyx_GIVEREF(__pyx_kp_34); - __pyx_2 = __Pyx_Import(__pyx_kp_33, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_kp_miob, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s_19)); + PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_19)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_18), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__miob, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":59 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":59 * cimport streams * import scipy.io.matlab.miobase as miob - * from scipy.io.matlab.mio_utils import process_element # <<<<<<<<<<<<<< + * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings # <<<<<<<<<<<<<< * import scipy.io.matlab.mio5_params as mio5p * import scipy.sparse */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_process_element); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_process_element); - __Pyx_GIVEREF(__pyx_kp_process_element); - __pyx_1 = __Pyx_Import(__pyx_kp_35, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_process_element); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_process_element, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__squeeze_element)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__squeeze_element)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__squeeze_element)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__chars_to_strings)); + PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__chars_to_strings)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chars_to_strings)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_20), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__squeeze_element, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chars_to_strings, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":60 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":60 * import scipy.io.matlab.miobase as miob - * from scipy.io.matlab.mio_utils import process_element + * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p # <<<<<<<<<<<<<< * import scipy.sparse * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_34); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_34); - __Pyx_GIVEREF(__pyx_kp_34); - __pyx_1 = __Pyx_Import(__pyx_kp_36, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_kp_37, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s_19)); + PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_19)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mio5p, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":61 - * from scipy.io.matlab.mio_utils import process_element + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":61 + * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p * import scipy.sparse # <<<<<<<<<<<<<< * * */ - __pyx_2 = __Pyx_Import(__pyx_kp_38, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_scipy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_22), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scipy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":101 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":101 * mxOBJECT_CLASS_FROM_MATRIX_H = 18 * * sys_is_le = sys.byteorder == 'little' # <<<<<<<<<<<<<< * native_code = sys_is_le and '<' or '>' * swapped_code = sys_is_le and '>' or '<' */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_byteorder); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_kp_39, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_kp_sys_is_le, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__byteorder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__little), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys_is_le, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":102 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":102 * * sys_is_le = sys.byteorder == 'little' * native_code = sys_is_le and '<' or '>' # <<<<<<<<<<<<<< * swapped_code = sys_is_le and '>' or '<' * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_sys_is_le); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_3) { - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_INCREF(__pyx_kp_40); - __pyx_t_2 = __pyx_kp_40; - } else { - __pyx_t_2 = __pyx_2; - __pyx_2 = 0; - } - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_3) { + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(__pyx_kp_41); - __pyx_t_1 = __pyx_kp_41; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); + __pyx_t_3 = __pyx_kp_s_23; } else { - __pyx_t_1 = __pyx_t_2; + __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; } - if (PyObject_SetAttr(__pyx_m, __pyx_kp_native_code, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); + __pyx_t_2 = __pyx_kp_s_24; + } else { + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__native_code, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":103 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":103 * sys_is_le = sys.byteorder == 'little' * native_code = sys_is_le and '<' or '>' * swapped_code = sys_is_le and '>' or '<' # <<<<<<<<<<<<<< * * cdef cnp.dtype OPAQUE_DTYPE = mio5p.OPAQUE_DTYPE */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_sys_is_le); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_3) { - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_INCREF(__pyx_kp_42); - __pyx_t_1 = __pyx_kp_42; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); + __pyx_t_3 = __pyx_kp_s_24; } else { - __pyx_t_1 = __pyx_1; - __pyx_1 = 0; + __pyx_t_3 = __pyx_t_2; + __pyx_t_2 = 0; } - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_3) { - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_INCREF(__pyx_kp_43); - __pyx_t_2 = __pyx_kp_43; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_23)); + __pyx_t_2 = __pyx_kp_s_23; } else { - __pyx_t_2 = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; } - if (PyObject_SetAttr(__pyx_m, __pyx_kp_swapped_code, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__swapped_code, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":105 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":105 * swapped_code = sys_is_le and '>' or '<' * * cdef cnp.dtype OPAQUE_DTYPE = mio5p.OPAQUE_DTYPE # <<<<<<<<<<<<<< * * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_37); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_2 = PyObject_GetAttr(__pyx_2, __pyx_kp_OPAQUE_DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__OPAQUE_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)); __Pyx_DECREF(((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE = ((PyArray_Descr *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/python_mem.pxd":1 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio5_utils.pyx":1 + * ''' Cython mio5 utility routines (-*- python -*- like) # <<<<<<<<<<<<<< + * + * ''' + */ + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__set_stream); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_25), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_26), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_numeric); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_27), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_full_tag); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_28), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_29), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__array_from_header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_30), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_real_complex); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_31), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_char); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_32), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_cells); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_33), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_fieldnames); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_34), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_struct); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_35), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_36), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/python_type.pxd":2 + * * cdef extern from "Python.h": # <<<<<<<<<<<<<< + * # The C structure of the objects used to describe built-in types. * - * ##################################################################### */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); if (__pyx_m) { __Pyx_AddTraceback("init scipy.io.matlab.mio5_utils"); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -9637,7 +10310,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.mio5_utils"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -9779,20 +10452,57 @@ return -1; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } + } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) + if (likely(PyObject_TypeCheck(obj, type))) return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static INLINE int __Pyx_IsLittleEndian(void) { +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } @@ -10189,7 +10899,7 @@ } } -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; @@ -10230,7 +10940,7 @@ return -1; } -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); @@ -10247,27 +10957,10 @@ } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); -#if PY_MAJOR_VERSION >= 3 - /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ - if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - PyErr_NormalizeException(&type, &value, &tb); - PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); - tstate->exc_type = 0; - tstate->exc_value = 0; - tstate->exc_traceback = 0; - PyException_SetContext(value, tmp_value); - Py_DECREF(tmp_type); - Py_XDECREF(tmp_tb); - } -#endif - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -10279,7 +10972,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -10291,24 +10984,17 @@ } -static INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) { + Py_ssize_t q = a / b; + Py_ssize_t r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); -} - static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); @@ -10404,42 +11090,25 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32 val) { - /**/ if (sizeof(npy_uint32) < sizeof(long)) - return PyInt_FromLong((long)val); - else if (sizeof(npy_uint32) == sizeof(long)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - PyInt_FromLong((long)val) : - PyLong_FromUnsignedLong((unsigned long)val); - else /* (sizeof(npy_uint32) > sizeof(long)) */ - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - PyLong_FromLongLong((PY_LONG_LONG)val) : - PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); -} - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); - } +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32 val) { + const npy_uint32 neg_one = (npy_uint32)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(npy_uint32) < sizeof(long)) { + return PyInt_FromLong((long)val); + } else if (sizeof(npy_uint32) == sizeof(long)) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else { /* (sizeof(npy_uint32) > sizeof(long)) */ + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); } - return item; } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} - +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -10495,6 +11164,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -10504,26 +11174,227 @@ return; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { - /**/ if (sizeof(npy_int32) < sizeof(long)) - return PyInt_FromLong((long)val); - else if (sizeof(npy_int32) == sizeof(long)) - return (((npy_int32)-1) < ((npy_int32)0)) ? - PyInt_FromLong((long)val) : - PyLong_FromUnsignedLong((unsigned long)val); - else /* (sizeof(npy_int32) > sizeof(long)) */ - return (((npy_int32)-1) < ((npy_int32)0)) ? - PyLong_FromLongLong((PY_LONG_LONG)val) : - PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32 val) { + const npy_int32 neg_one = (npy_int32)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(npy_int32) < sizeof(long)) { + return PyInt_FromLong((long)val); + } else if (sizeof(npy_int32) == sizeof(long)) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else { /* (sizeof(npy_int32) > sizeof(long)) */ + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -10534,13 +11405,15 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -10551,13 +11424,15 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -10568,13 +11443,15 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((char)-1) > ((char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -10585,13 +11462,15 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((short)-1) > ((short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -10602,13 +11481,15 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((int)-1) > ((int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -10619,13 +11500,15 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -10636,13 +11519,15 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -10653,13 +11538,15 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -10670,11 +11557,13 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -10683,14 +11572,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((unsigned long)-1) < ((unsigned long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10701,11 +11592,13 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -10714,14 +11607,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10732,11 +11627,13 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((long)-1) > ((long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -10745,14 +11642,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((long)-1) < ((long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10763,11 +11662,13 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -10776,14 +11677,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10794,11 +11697,13 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -10807,14 +11712,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((signed long)-1) < ((signed long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10825,11 +11732,13 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -10838,14 +11747,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -10856,36 +11767,45 @@ } } -static INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) { - /**/ if (sizeof(npy_uint32) == sizeof(char)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedChar(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedChar(x); - else if (sizeof(npy_uint32) == sizeof(short)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedShort(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedShort(x); - else if (sizeof(npy_uint32) == sizeof(int)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedInt(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x); - else if (sizeof(npy_uint32) == sizeof(long)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedLong(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedLong(x); - else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedLongLong(x); +static CYTHON_INLINE npy_uint32 __Pyx_PyInt_from_py_npy_uint32(PyObject* x) { + const npy_uint32 neg_one = (npy_uint32)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(npy_uint32) == sizeof(char)) { + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_uint32) == sizeof(short)) { + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_uint32) == sizeof(int)) { + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_uint32) == sizeof(long)) { + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_uint32) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedLongLong(x); #if 0 - else if (sizeof(npy_uint32) > sizeof(short) && - sizeof(npy_uint32) < sizeof(int)) /* __int32 ILP64 ? */ - return (((npy_uint32)-1) < ((npy_uint32)0)) ? - (npy_uint32)__Pyx_PyInt_AsSignedInt(x) : - (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x); + } else if (sizeof(npy_uint32) > sizeof(short) && + sizeof(npy_uint32) < sizeof(int)) { /* __int32 ILP64 ? */ + if (is_unsigned) + return (npy_uint32)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_uint32)__Pyx_PyInt_AsSignedInt(x); #endif - PyErr_SetString(PyExc_TypeError, "npy_uint32"); - return (npy_uint32)-1; + } + PyErr_SetString(PyExc_TypeError, "npy_uint32"); + return (npy_uint32)-1; } static void __Pyx_WriteUnraisable(const char *name) { @@ -10907,32 +11827,31 @@ } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -10957,9 +11876,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -10994,43 +11919,37 @@ #endif static int __Pyx_GetVtable(PyObject *dict, void *vtabptr) { - int result; - PyObject *pycobj; - - pycobj = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); - if (!pycobj) + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) goto bad; - *(void **)vtabptr = PyCObject_AsVoidPtr(pycobj); +#if PY_VERSION_HEX < 0x03010000 + *(void **)vtabptr = PyCObject_AsVoidPtr(ob); +#else + *(void **)vtabptr = PyCapsule_GetPointer(ob, 0); +#endif if (!*(void **)vtabptr) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { -#if PY_VERSION_HEX < 0x02050000 - char *api = (char *)"__pyx_capi__"; -#else - const char *api = "__pyx_capi__"; -#endif PyObject *d = 0; PyObject *cobj = 0; - const char *desc; - const char *s1, *s2; union { void (*fp)(void); void *p; } tmp; +#if PY_VERSION_HEX < 0x03010000 + const char *desc, *s1, *s2; +#endif - d = PyObject_GetAttrString(module, api); + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); if (!d) goto bad; cobj = PyDict_GetItemString(d, funcname); @@ -11040,6 +11959,7 @@ PyModule_GetName(module), funcname); goto bad; } +#if PY_VERSION_HEX < 0x03010000 desc = (const char *)PyCObject_GetDesc(cobj); if (!desc) goto bad; @@ -11052,7 +11972,18 @@ goto bad; } tmp.p = PyCObject_AsVoidPtr(cobj); +#else + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#endif *f = tmp.fp; + if (!(*f)) + goto bad; Py_DECREF(d); return 0; bad: @@ -11134,7 +12065,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -11142,10 +12073,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -11159,13 +12094,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -11211,7 +12146,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -11220,7 +12155,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -11234,7 +12169,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-05-26 19:29:32 UTC (rev 6413) @@ -56,7 +56,7 @@ cimport streams import scipy.io.matlab.miobase as miob -from scipy.io.matlab.mio_utils import process_element +from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings import scipy.io.matlab.mio5_params as mio5p import scipy.sparse @@ -139,7 +139,7 @@ # cached here for convenience in later array creation cdef cnp.dtype U1_dtype cdef cnp.dtype bool_dtype - # process_element options + # element processing options cdef: int mat_dtype int squeeze_me @@ -158,7 +158,7 @@ self.uint16_codec = preader.uint16_codec # set c-optimized stream object from python file-like object self.set_stream(preader.mat_stream) - # options for process_element + # options for element processing self.mat_dtype = preader.mat_dtype self.chars_as_strings = preader.chars_as_strings self.squeeze_me = preader.squeeze_me @@ -632,6 +632,8 @@ return arr elif mc == mxCHAR_CLASS: arr = self.read_char(header) + if process and self.chars_as_strings: + arr = chars_to_strings(arr) elif mc == mxCELL_CLASS: arr = self.read_cells(header) elif mc == mxSTRUCT_CLASS: @@ -643,17 +645,15 @@ elif mc == mxFUNCTION_CLASS: # just a matrix of struct type arr = self.read_mi_matrix() arr = mio5p.MatlabFunction(arr) - # to make them more re-writeable - don't process + # to make them more re-writeable - don't squeeze return arr elif mc == mxOPAQUE_CLASS: arr = self.read_opaque(header) arr = mio5p.MatlabOpaque(arr) - # to make them more re-writeable - don't process + # to make them more re-writeable - don't squeeze return arr - if process: - return process_element(arr, - self.chars_as_strings, - self.squeeze_me) + if process and self.squeeze_me: + return squeeze_element(arr) return arr cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): @@ -707,7 +707,7 @@ ''' Read char matrices from stream as arrays Matrices of char are likely to be converted to matrices of - string by later processing in ``process_element`` + string by later processing in ``array_from_header`` ''' '''Notes to friendly fellow-optimizer @@ -720,7 +720,7 @@ how to deal with UCS-2 and UCS-4 builds of python, and how numpy deals with unicode strings passed as memory, - My own introduction here: + My own unicode introduction here: https://cirl.berkeley.edu/mb312/pydagogue/python_unicode.html ''' cdef: Modified: trunk/scipy/io/matlab/mio_utils.c =================================================================== --- trunk/scipy/io/matlab/mio_utils.c 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/mio_utils.c 2010-05-26 19:29:32 UTC (rev 6413) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Sat Jan 9 17:30:46 2010 */ +/* Generated by Cython 0.12.1 on Wed May 26 12:20:27 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -15,7 +16,9 @@ #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -25,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -35,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -59,22 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type - #define PyString_CheckExact PyBytes_CheckExact + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -89,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -109,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -118,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -135,24 +156,21 @@ #include "stdlib.h" #include "stdio.h" #include "numpy/arrayobject.h" -#define __PYX_USE_C99_COMPLEX defined(_Complex_I) +#include "numpy/ufuncobject.h" - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -static int __pyx_skip_dispatch = 0; - - /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 @@ -169,8 +187,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -234,9 +252,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -265,41 +283,146 @@ static const char *__pyx_filename; static const char **__pyx_f; -static char __pyx_mdoc[] = " Utilities for generic processing of return arrays from read\n"; +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif -#ifdef CYTHON_REFNANNY -typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*NewContext)(const char*, int, const char*); - void (*FinishContext)(void**); -} __Pyx_RefnannyAPIStruct; -static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; -#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") -#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) -#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) -#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif #else -#define __Pyx_INCREF(r) Py_INCREF(r) -#define __Pyx_DECREF(r) Py_DECREF(r) -#define __Pyx_GOTREF(r) -#define __Pyx_GIVEREF(r) -#define __Pyx_XDECREF(r) Py_XDECREF(r) -#define __Pyx_SetupRefcountContext(name) -#define __Pyx_FinishRefcountContext() + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) -static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -312,7 +435,7 @@ __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); @@ -332,7 +455,7 @@ __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); @@ -353,7 +476,7 @@ __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); @@ -372,22 +495,17 @@ return r; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ -static INLINE void __Pyx_RaiseNoneNotIterableError(void); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -static INLINE void __Pyx_RaiseTooManyValuesError(void); - static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, @@ -397,333 +515,137 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); -#if __PYX_USE_C99_COMPLEX - #define __Pyx_REAL_PART(z) __real__(z) - #define __Pyx_IMAG_PART(z) __imag__(z) +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif #else - #define __Pyx_REAL_PART(z) ((z).real) - #define __Pyx_IMAG_PART(z) ((z).imag) + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) #endif -#define __pyx_PyObject_from_complex(z) PyComplex_FromDoubles((double)__Pyx_REAL_PART(z), (double)__Pyx_IMAG_PART(z)) - -#if __PYX_USE_C99_COMPLEX - - typedef float _Complex __pyx_t_float_complex; - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - return x + y*(__pyx_t_float_complex)_Complex_I; - } - - #define __pyx_t_float_complex_is_zero(a) ((a) == 0) - #define __pyx_t_float_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_float_complex_add(a, b) ((a)+(b)) - #define __pyx_t_float_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_float_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_float_complex_div(a, b) ((a)/(b)) - #define __pyx_t_float_complex_neg(a) (-(a)) - +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else - - typedef struct { float real, imag; } __pyx_t_float_complex; - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { - __pyx_t_float_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_float_complex_is_zero(__pyx_t_float_complex a) { - return (a.real == 0) & (a.imag == 0); - } - - static INLINE int __pyx_t_float_complex_eq(__pyx_t_float_complex a, __pyx_t_float_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_add(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_sub(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_mul(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_div(__pyx_t_float_complex a, __pyx_t_float_complex b) { - __pyx_t_float_complex z; - float denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_float_complex __pyx_t_float_complex_neg(__pyx_t_float_complex a) { - __pyx_t_float_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif -#if __PYX_USE_C99_COMPLEX +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - typedef double _Complex __pyx_t_double_complex; - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - return x + y*(__pyx_t_double_complex)_Complex_I; - } - - #define __pyx_t_double_complex_is_zero(a) ((a) == 0) - #define __pyx_t_double_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_double_complex_add(a, b) ((a)+(b)) - #define __pyx_t_double_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_double_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_double_complex_div(a, b) ((a)/(b)) - #define __pyx_t_double_complex_neg(a) (-(a)) - +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif #else - - typedef struct { double real, imag; } __pyx_t_double_complex; - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { - __pyx_t_double_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_double_complex_is_zero(__pyx_t_double_complex a) { - return (a.real == 0) & (a.imag == 0); - } - - static INLINE int __pyx_t_double_complex_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_add(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_sub(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_mul(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_div(__pyx_t_double_complex a, __pyx_t_double_complex b) { - __pyx_t_double_complex z; - double denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_double_complex __pyx_t_double_complex_neg(__pyx_t_double_complex a) { - __pyx_t_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ #endif -#if __PYX_USE_C99_COMPLEX +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - typedef long double _Complex __pyx_t_long__double_complex; - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { - return x + y*(__pyx_t_long__double_complex)_Complex_I; - } - - #define __pyx_t_long__double_complex_is_zero(a) ((a) == 0) - #define __pyx_t_long__double_complex_eq(a, b) ((a) == (b)) - #define __pyx_t_long__double_complex_add(a, b) ((a)+(b)) - #define __pyx_t_long__double_complex_sub(a, b) ((a)-(b)) - #define __pyx_t_long__double_complex_mul(a, b) ((a)*(b)) - #define __pyx_t_long__double_complex_div(a, b) ((a)/(b)) - #define __pyx_t_long__double_complex_neg(a) (-(a)) - +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif #else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif - typedef struct { long double real, imag; } __pyx_t_long__double_complex; - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_from_parts(long double x, long double y) { - __pyx_t_long__double_complex c; c.real = x; c.imag = y; return c; - } - - static INLINE int __pyx_t_long__double_complex_is_zero(__pyx_t_long__double_complex a) { - return (a.real == 0) & (a.imag == 0); - } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - static INLINE int __pyx_t_long__double_complex_eq(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - return (a.real == b.real) & (a.imag == b.imag); - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_add(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_sub(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_mul(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_div(__pyx_t_long__double_complex a, __pyx_t_long__double_complex b) { - __pyx_t_long__double_complex z; - long double denom = b.real*b.real + b.imag*b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - - static INLINE __pyx_t_long__double_complex __pyx_t_long__double_complex_neg(__pyx_t_long__double_complex a) { - __pyx_t_long__double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - -#endif - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - static void __Pyx_WriteUnraisable(const char *name); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from python_buffer */ -/* Type declarations */ +/* Module declarations from python_ref */ -typedef npy_int8 __pyx_t_5numpy_int8_t; - -typedef npy_int16 __pyx_t_5numpy_int16_t; - -typedef npy_int32 __pyx_t_5numpy_int32_t; - -typedef npy_int64 __pyx_t_5numpy_int64_t; - -typedef npy_uint8 __pyx_t_5numpy_uint8_t; - -typedef npy_uint16 __pyx_t_5numpy_uint16_t; - -typedef npy_uint32 __pyx_t_5numpy_uint32_t; - -typedef npy_uint64 __pyx_t_5numpy_uint64_t; - -typedef npy_float32 __pyx_t_5numpy_float32_t; - -typedef npy_float64 __pyx_t_5numpy_float64_t; - -typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; - -typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; - -typedef npy_long __pyx_t_5numpy_int_t; - -typedef npy_longlong __pyx_t_5numpy_long_t; - -typedef npy_ulong __pyx_t_5numpy_uint_t; - -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -typedef npy_double __pyx_t_5numpy_float_t; - -typedef npy_double __pyx_t_5numpy_double_t; - -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; - -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; - -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; - -typedef npy_cdouble __pyx_t_5numpy_complex_t; - -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 - * - * - * cpdef object process_element(cnp.ndarray arr, # <<<<<<<<<<<<<< - * int chars_as_strings = 1, - * int squeeze_me = 0): - */ - -struct __pyx_opt_args_5scipy_2io_6matlab_9mio_utils_process_element { - int __pyx_n; - int chars_as_strings; - int squeeze_me; -}; -/* Module declarations from python_buffer */ - /* Module declarations from stdlib */ /* Module declarations from stdio */ @@ -736,122 +658,132 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from scipy.io.matlab.mio_utils */ static size_t __pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5scipy_2io_6matlab_9mio_utils_process_element(PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_9mio_utils_process_element *__pyx_optional_args); /*proto*/ +static PyObject *__pyx_f_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ static PyArrayObject *__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *, int __pyx_skip_dispatch); /*proto*/ #define __Pyx_MODULE_NAME "scipy.io.matlab.mio_utils" int __pyx_module_is_main_scipy__io__matlab__mio_utils = 0; /* Implementation of scipy.io.matlab.mio_utils */ -static char __pyx_k___main__[] = "__main__"; -static PyObject *__pyx_kp___main__; -static char __pyx_k_cproduct[] = "cproduct"; -static PyObject *__pyx_kp_cproduct; -static char __pyx_k_process_element[] = "process_element"; -static PyObject *__pyx_kp_process_element; -static char __pyx_k_chars_to_strings[] = "chars_to_strings"; -static PyObject *__pyx_kp_chars_to_strings; -static char __pyx_k_tup[] = "tup"; -static PyObject *__pyx_kp_tup; -static char __pyx_k_arr[] = "arr"; -static PyObject *__pyx_kp_arr; -static char __pyx_k_chars_as_strings[] = "chars_as_strings"; -static PyObject *__pyx_kp_chars_as_strings; -static char __pyx_k_squeeze_me[] = "squeeze_me"; -static PyObject *__pyx_kp_squeeze_me; -static char __pyx_k_in_arr[] = "in_arr"; -static PyObject *__pyx_kp_in_arr; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_range[] = "range"; -static PyObject *__pyx_kp_range; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_kind[] = "kind"; -static PyObject *__pyx_kp_kind; -static char __pyx_k_31[] = "U"; -static PyObject *__pyx_kp_31; -static char __pyx_k_size[] = "size"; -static PyObject *__pyx_kp_size; -static char __pyx_k_array[] = "array"; -static PyObject *__pyx_kp_array; -static char __pyx_k_squeeze[] = "squeeze"; -static PyObject *__pyx_kp_squeeze; -static char __pyx_k_isbuiltin[] = "isbuiltin"; -static PyObject *__pyx_kp_isbuiltin; -static char __pyx_k_item[] = "item"; -static PyObject *__pyx_kp_item; -static char __pyx_k_str[] = "str"; -static PyObject *__pyx_kp_str; -static char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; -static PyObject *__pyx_kp_ascontiguousarray; -static char __pyx_k_view[] = "view"; -static PyObject *__pyx_kp_view; -static char __pyx_k_reshape[] = "reshape"; -static PyObject *__pyx_kp_reshape; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; static PyObject *__pyx_builtin_range; -static PyObject *__pyx_int_15; -static char __pyx_k___getbuffer__[] = "__getbuffer__"; -static PyObject *__pyx_kp___getbuffer__; -static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; -static PyObject *__pyx_kp___releasebuffer__; -static char __pyx_k_info[] = "info"; -static PyObject *__pyx_kp_info; -static char __pyx_k_flags[] = "flags"; -static PyObject *__pyx_kp_flags; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_RuntimeError; -static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_2; -static PyObject *__pyx_kp_5; -static PyObject *__pyx_kp_23; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = ">"; -static char __pyx_k_4[] = "<"; -static char __pyx_k_5[] = "Non-native byte order not supported"; -static char __pyx_k_6[] = "b"; -static char __pyx_k_7[] = "B"; -static char __pyx_k_8[] = "h"; -static char __pyx_k_9[] = "H"; -static char __pyx_k_10[] = "i"; -static char __pyx_k_11[] = "I"; -static char __pyx_k_12[] = "l"; -static char __pyx_k_13[] = "L"; -static char __pyx_k_14[] = "q"; -static char __pyx_k_15[] = "Q"; -static char __pyx_k_16[] = "f"; -static char __pyx_k_17[] = "d"; -static char __pyx_k_18[] = "g"; -static char __pyx_k_19[] = "Zf"; -static char __pyx_k_20[] = "Zd"; -static char __pyx_k_21[] = "Zg"; -static char __pyx_k_22[] = "O"; -static char __pyx_k_23[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_24[] = "^"; -static PyObject *__pyx_kp_25; -static PyObject *__pyx_kp_28; -static PyObject *__pyx_kp_29; -static PyObject *__pyx_kp_30; -static char __pyx_k_25[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_26[] = ">"; -static char __pyx_k_27[] = "<"; -static char __pyx_k_28[] = "Non-native byte order not supported"; -static char __pyx_k_29[] = "Format string allocated too short."; -static char __pyx_k_30[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_3[] = "Non-native byte order not supported"; +static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_6[] = "Format string allocated too short."; +static char __pyx_k_7[] = " Utilities for generic processing of return arrays from read\n"; +static char __pyx_k_8[] = "squeeze_element (line 17)"; +static char __pyx_k_9[] = "chars_to_strings (line 30)"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__str[] = "str"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__item[] = "item"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__view[] = "view"; +static char __pyx_k__array[] = "array"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__reshape[] = "reshape"; +static char __pyx_k__squeeze[] = "squeeze"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__isscalar[] = "isscalar"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__squeeze_element[] = "squeeze_element"; +static char __pyx_k__chars_to_strings[] = "chars_to_strings"; +static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; +static PyObject *__pyx_kp_u_1; +static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__array; +static PyObject *__pyx_n_s__ascontiguousarray; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__chars_to_strings; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__isscalar; +static PyObject *__pyx_n_s__item; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__squeeze; +static PyObject *__pyx_n_s__squeeze_element; +static PyObject *__pyx_n_s__str; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__view; +static PyObject *__pyx_int_15; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -864,13 +796,14 @@ size_t __pyx_v_res; int __pyx_v_i; size_t __pyx_r; - PyObject *__pyx_1 = 0; Py_ssize_t __pyx_t_1; int __pyx_t_2; - size_t __pyx_t_3; - __Pyx_SetupRefcountContext("cproduct"); + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; + __Pyx_RefNannySetupContext("cproduct"); + __Pyx_INCREF(__pyx_v_tup); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":10 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -879,7 +812,7 @@ */ __pyx_v_res = 1; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":12 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -890,21 +823,21 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":13 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< * return res * */ - __pyx_1 = __Pyx_GetItemInt(__pyx_v_tup, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = __Pyx_PyInt_AsSize_t(__pyx_1); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_v_res *= __pyx_t_3; + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_tup, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_res *= __pyx_t_4; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":14 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -917,15 +850,16 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("scipy.io.matlab.mio_utils.cproduct"); __pyx_r = 0; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF(__pyx_v_tup); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -937,7 +871,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *__pyx_self, PyObject *__pyx_v_tup) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("cproduct"); + __Pyx_RefNannySetupContext("cproduct"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(__pyx_v_tup, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -954,214 +888,148 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 * * - * cpdef object process_element(cnp.ndarray arr, # <<<<<<<<<<<<<< - * int chars_as_strings = 1, - * int squeeze_me = 0): + * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< + * ''' Return squeezed element + * */ -static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_process_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5scipy_2io_6matlab_9mio_utils_process_element(PyArrayObject *__pyx_v_arr, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_9mio_utils_process_element *__pyx_optional_args) { - int __pyx_v_chars_as_strings = 1; - int __pyx_v_squeeze_me = 0; +static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ +static PyObject *__pyx_f_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyArrayObject *__pyx_v_arr, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - __Pyx_SetupRefcountContext("process_element"); - if (__pyx_optional_args) { - if (__pyx_optional_args->__pyx_n > 0) { - __pyx_v_chars_as_strings = __pyx_optional_args->chars_as_strings; - if (__pyx_optional_args->__pyx_n > 1) { - __pyx_v_squeeze_me = __pyx_optional_args->squeeze_me; - } - } - } + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __Pyx_RefNannySetupContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":24 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' - * if chars_as_strings and arr.dtype.kind == 'U': # <<<<<<<<<<<<<< - * arr = chars_to_strings(arr) - * if squeeze_me: + * if not arr.size: # <<<<<<<<<<<<<< + * return np.array([]) + * arr = np.squeeze(arr) */ - __pyx_t_1 = __pyx_v_chars_as_strings; - if (__pyx_t_1) { - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_kp_31, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __pyx_t_4; - } else { - __pyx_t_5 = __pyx_t_1; - } - if (__pyx_t_5) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":25 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' - * if chars_as_strings and arr.dtype.kind == 'U': - * arr = chars_to_strings(arr) # <<<<<<<<<<<<<< - * if squeeze_me: - * if not arr.size: + * if not arr.size: + * return np.array([]) # <<<<<<<<<<<<<< + * arr = np.squeeze(arr) + * if np.isscalar(arr): # 0d coverted to scalar */ - __pyx_t_2 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(((PyObject *)__pyx_v_arr), 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":26 - * if chars_as_strings and arr.dtype.kind == 'U': - * arr = chars_to_strings(arr) - * if squeeze_me: # <<<<<<<<<<<<<< - * if not arr.size: - * arr = np.array([]) + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":24 + * if not arr.size: + * return np.array([]) + * arr = np.squeeze(arr) # <<<<<<<<<<<<<< + * if np.isscalar(arr): # 0d coverted to scalar + * return arr.item() */ - __pyx_t_1 = __pyx_v_squeeze_me; - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__squeeze); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_arr)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); + __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_arr)); + __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":27 - * arr = chars_to_strings(arr) - * if squeeze_me: - * if not arr.size: # <<<<<<<<<<<<<< - * arr = np.array([]) - * else: - */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (!__pyx_t_5); - if (__pyx_t_4) { - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":28 - * if squeeze_me: - * if not arr.size: - * arr = np.array([]) # <<<<<<<<<<<<<< - * else: - * arr = np.squeeze(arr) - */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L5; - } - /*else*/ { - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":30 - * arr = np.array([]) - * else: - * arr = np.squeeze(arr) # <<<<<<<<<<<<<< - * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar - * return arr.item() - */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_squeeze); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __Pyx_INCREF(((PyObject *)__pyx_v_arr)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_arr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); - __pyx_t_2 = 0; - - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":31 - * else: - * arr = np.squeeze(arr) - * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< - * return arr.item() + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":25 + * return np.array([]) + * arr = np.squeeze(arr) + * if np.isscalar(arr): # 0d coverted to scalar # <<<<<<<<<<<<<< + * return arr.item() * return arr */ - __pyx_t_4 = (!(__pyx_v_arr->dimensions != 0)); - if (__pyx_t_4) { - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_isbuiltin); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __pyx_t_5; - } else { - __pyx_t_7 = __pyx_t_4; - } - if (__pyx_t_7) { + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_arr)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_arr)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_3) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":32 - * arr = np.squeeze(arr) - * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar - * return arr.item() # <<<<<<<<<<<<<< + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":26 + * arr = np.squeeze(arr) + * if np.isscalar(arr): # 0d coverted to scalar + * return arr.item() # <<<<<<<<<<<<<< * return arr * */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_item); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - goto __pyx_L6; - } - __pyx_L6:; - } - __pyx_L5:; + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__item); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; goto __pyx_L4; } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":33 - * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar - * return arr.item() + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":27 + * if np.isscalar(arr): # 0d coverted to scalar + * return arr.item() * return arr # <<<<<<<<<<<<<< * * @@ -1174,103 +1042,36 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("scipy.io.matlab.mio_utils.process_element"); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scipy.io.matlab.mio_utils.squeeze_element"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 * * - * cpdef object process_element(cnp.ndarray arr, # <<<<<<<<<<<<<< - * int chars_as_strings = 1, - * int squeeze_me = 0): + * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< + * ''' Return squeezed element + * */ -static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_process_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5scipy_2io_6matlab_9mio_utils_process_element[] = " Return processed object\n\n The returned object may not be an ndarray - for example if we do\n ``arr.item`` to return a ``mat_struct`` object from a struct array "; -static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_process_element(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_arr = 0; - int __pyx_v_chars_as_strings; - int __pyx_v_squeeze_me; +static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyObject *__pyx_self, PyObject *__pyx_v_arr); /*proto*/ +static char __pyx_doc_5scipy_2io_6matlab_9mio_utils_squeeze_element[] = " Return squeezed element\n\n The returned object may not be an ndarray - for example if we do\n ``arr.item`` to return a ``mat_struct`` object from a struct array "; +static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyObject *__pyx_self, PyObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_9mio_utils_process_element __pyx_1; PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_arr,&__pyx_kp_chars_as_strings,&__pyx_kp_squeeze_me,0}; - __Pyx_SetupRefcountContext("process_element"); + __Pyx_RefNannySetupContext("squeeze_element"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_arr); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_chars_as_strings); - if (unlikely(value)) { values[1] = value; kw_args--; } - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_squeeze_me); - if (unlikely(value)) { values[2] = value; kw_args--; } - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "process_element") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_arr = ((PyArrayObject *)values[0]); - if (values[1]) { - __pyx_v_chars_as_strings = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_chars_as_strings == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_chars_as_strings = 1; - } - if (values[2]) { - __pyx_v_squeeze_me = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_squeeze_me == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else { - __pyx_v_squeeze_me = 0; - } - } else { - __pyx_v_chars_as_strings = 1; - __pyx_v_squeeze_me = 0; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: __pyx_v_squeeze_me = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_squeeze_me == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_chars_as_strings = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_chars_as_strings == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_arr = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("process_element", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("scipy.io.matlab.mio_utils.process_element"); - return NULL; - __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 2; - __pyx_1.chars_as_strings = __pyx_v_chars_as_strings; - __pyx_1.squeeze_me = __pyx_v_squeeze_me; - __pyx_t_1 = __pyx_f_5scipy_2io_6matlab_9mio_utils_process_element(__pyx_v_arr, 0, &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_5scipy_2io_6matlab_9mio_utils_squeeze_element(((PyArrayObject *)__pyx_v_arr), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1280,15 +1081,15 @@ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("scipy.io.matlab.mio_utils.process_element"); + __Pyx_AddTraceback("scipy.io.matlab.mio_utils.squeeze_element"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":36 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1304,26 +1105,26 @@ npy_intp __pyx_v_last_dim; PyObject *__pyx_v_new_dt_str; PyArrayObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_SetupRefcountContext("chars_to_strings"); + __Pyx_RefNannySetupContext("chars_to_strings"); + __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":50 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape */ - if (!(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_in_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":51 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1332,7 +1133,7 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":52 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< @@ -1341,7 +1142,7 @@ */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":53 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< @@ -1350,7 +1151,7 @@ */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":55 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] * cdef object new_dt_str * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< @@ -1360,16 +1161,16 @@ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":56 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":50 * cdef object new_dt_str * if last_dim == 0: # deal with empty array case * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) */ - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_kp_str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__str); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_new_dt_str); @@ -1379,120 +1180,119 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":58 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":52 * new_dt_str = arr.dtype.str * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_str); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__str); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_1 = PySequence_GetSlice(__pyx_t_2, 0, -1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_3 = PySequence_GetSlice(__pyx_t_2, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_last_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_intp(__pyx_v_last_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_new_dt_str); - __pyx_v_new_dt_str = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_new_dt_str = __pyx_t_4; + __pyx_t_4 = 0; } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":60 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":54 * new_dt_str = arr.dtype.str[:-1] + str(last_dim) * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_arr)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_arr)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_arr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":61 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":55 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< * return arr.reshape(in_arr.shape[:-1]) */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_view); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__view); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_new_dt_str); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_new_dt_str); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_new_dt_str); __Pyx_GIVEREF(__pyx_v_new_dt_str); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":62 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":56 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_kp_reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__reshape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PySequence_GetSlice(__pyx_t_4, 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_in_arr, __pyx_kp_shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_1 = PySequence_GetSlice(__pyx_t_2, 0, -1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_1); - __Pyx_GIVEREF(__pyx_1); - __pyx_1 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -1501,12 +1301,13 @@ __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_arr); __Pyx_DECREF(__pyx_v_new_dt_str); + __Pyx_DECREF(__pyx_v_in_arr); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":36 +/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1519,10 +1320,10 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *__pyx_self, PyObject *__pyx_v_in_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("chars_to_strings"); + __Pyx_RefNannySetupContext("chars_to_strings"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(__pyx_v_in_arr, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(__pyx_v_in_arr, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1536,11 +1337,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":152 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1562,18 +1363,21 @@ int __pyx_v_hasfields; int __pyx_r; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - char *__pyx_t_7; - __Pyx_SetupRefcountContext("__getbuffer__"); + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":158 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1582,7 +1386,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":159 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1591,7 +1395,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":161 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1600,7 +1404,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":163 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1610,7 +1414,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":164 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1622,7 +1426,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":166 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1633,96 +1437,100 @@ } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":168 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":169 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_3 = __pyx_t_1; } - if (__pyx_t_1) { + if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":170 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); - __Pyx_GIVEREF(__pyx_kp_1); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":172 - * raise ValueError("ndarray is not C contiguous") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":173 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_2 = __pyx_t_3; } - if (__pyx_t_1) { + if (__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":174 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_2); - __Pyx_GIVEREF(__pyx_kp_2); - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":176 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -1730,7 +1538,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":177 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1739,17 +1547,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":178 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_t_4 = __pyx_v_copy_shape; - if (__pyx_t_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":181 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1758,7 +1566,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":182 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1767,17 +1575,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":183 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_v_ndim; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":184 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1786,7 +1595,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":185 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1799,7 +1608,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1808,7 +1617,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1819,7 +1628,7 @@ } __pyx_L8:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":189 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1828,7 +1637,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":190 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1837,7 +1646,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":191 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1846,7 +1655,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1855,7 +1664,7 @@ */ __pyx_v_f = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1865,7 +1674,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1874,21 +1683,23 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - if ((!__pyx_v_hasfields)) { - __pyx_t_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; } else { - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1904,7 +1715,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1919,7 +1730,7 @@ } __pyx_L11:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1929,7 +1740,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1938,319 +1749,322 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") */ - if ((__pyx_v_descr->byteorder == '>')) { - __pyx_t_1 = __pyx_v_little_endian; + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; } else { - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_2 = __pyx_t_1; } - if (!__pyx_t_1) { + if (!__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - if ((__pyx_v_descr->byteorder == '<')) { - __pyx_t_5 = (!__pyx_v_little_endian); + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; } else { - __pyx_t_5 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_8 = __pyx_t_1; } - __pyx_t_6 = __pyx_t_5; + __pyx_t_1 = __pyx_t_8; } else { - __pyx_t_6 = __pyx_t_1; + __pyx_t_1 = __pyx_t_2; } - if (__pyx_t_6) { + if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_5); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); - __Pyx_GIVEREF(__pyx_kp_5); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L13; } __pyx_L13:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - __pyx_t_6 = (__pyx_v_t == NPY_BYTE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_6; + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 - * raise ValueError("Non-native byte order not supported") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_t_6 = (__pyx_v_t == NPY_UBYTE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_7; + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":215 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_t_6 = (__pyx_v_t == NPY_SHORT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_8; + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_t_6 = (__pyx_v_t == NPY_USHORT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_9; + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_t_6 = (__pyx_v_t == NPY_INT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_10; + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_t_6 = (__pyx_v_t == NPY_UINT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_11; + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_12; + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_t_6 = (__pyx_v_t == NPY_ULONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_13; + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONGLONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_14; + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_t_6 = (__pyx_v_t == NPY_ULONGLONG); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_15; + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_t_6 = (__pyx_v_t == NPY_FLOAT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_16; + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_t_6 = (__pyx_v_t == NPY_DOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_17; + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_t_6 = (__pyx_v_t == NPY_LONGDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_18; + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_t_6 = (__pyx_v_t == NPY_CFLOAT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_19; + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_t_6 = (__pyx_v_t == NPY_CDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_20; + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":228 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_t_6 = (__pyx_v_t == NPY_CLONGDOUBLE); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_21; + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; goto __pyx_L14; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_6 = (__pyx_v_t == NPY_OBJECT); - if (__pyx_t_6) { - __pyx_v_f = __pyx_k_22; + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; goto __pyx_L14; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Remainder(__pyx_kp_23, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L14:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":232 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":233 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: @@ -2262,7 +2076,7 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2271,7 +2085,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2280,7 +2094,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2289,17 +2103,17 @@ */ __pyx_v_offset = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":240 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ - __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_7; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2313,8 +2127,8 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); __pyx_r = -1; __Pyx_GOTREF(__pyx_v_info->obj); @@ -2327,11 +2141,12 @@ } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2342,9 +2157,10 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { int __pyx_t_1; - __Pyx_SetupRefcountContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2354,7 +2170,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2366,7 +2182,7 @@ } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2376,7 +2192,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2388,18 +2204,214 @@ } __pyx_L6:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":690 +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 * ctypedef npy_cdouble complex_t * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child; int __pyx_v_endian_detector; int __pyx_v_little_endian; @@ -2408,9 +2420,6 @@ PyObject *__pyx_v_new_offset; PyObject *__pyx_v_t; char *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -2419,15 +2428,17 @@ int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; - char *__pyx_t_9; - __Pyx_SetupRefcountContext("_util_dtypestring"); + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":697 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2436,7 +2447,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":698 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2445,7 +2456,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":701 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2455,7 +2466,7 @@ if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; @@ -2464,21 +2475,21 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":702 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_1 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!(likely(PyTuple_CheckExact(__pyx_1)) || (__pyx_1) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_1)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_1); - __pyx_1 = 0; + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":703 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2487,122 +2498,125 @@ */ if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_2); - __pyx_2 = 0; + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_3; - __pyx_3 = 0; + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":705 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_3 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":706 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __Pyx_INCREF(__pyx_kp_25); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_25); - __Pyx_GIVEREF(__pyx_kp_25); - __pyx_t_4 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":708 - * raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") */ - if ((__pyx_v_child->byteorder == '>')) { - __pyx_t_6 = __pyx_v_little_endian; + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; } else { - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = __pyx_t_6; } - if (!__pyx_t_6) { + if (!__pyx_t_7) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":709 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< - * raise ValueError("Non-native byte order not supported") + * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - if ((__pyx_v_child->byteorder == '<')) { - __pyx_t_7 = (!__pyx_v_little_endian); + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; } else { - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_9 = __pyx_t_6; } - __pyx_t_8 = __pyx_t_7; + __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_8 = __pyx_t_6; + __pyx_t_6 = __pyx_t_7; } - if (__pyx_t_8) { + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":710 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): - * raise ValueError("Non-native byte order not supported") # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_kp_28); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_28); - __Pyx_GIVEREF(__pyx_kp_28); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":720 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2610,16 +2624,16 @@ * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!__pyx_t_8) break; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":721 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2628,7 +2642,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":722 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2637,7 +2651,7 @@ */ __pyx_v_f += 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":723 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2647,7 +2661,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":725 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2656,417 +2670,417 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":727 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_8 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_8) { + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":728 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: - * raise RuntimeError("Format string allocated too short.") + * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":729 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_8 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_8) { + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":730 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * t = child.type_num * if end - f < 5: - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_kp_29); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_29); - __Pyx_GIVEREF(__pyx_kp_29); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":733 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":734 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_4 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":735 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":736 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_4 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":737 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":738 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_4 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":739 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":740 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_4 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":741 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":742 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_4 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":743 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":744 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_4 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":745 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":746 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_4 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":747 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":748 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_4 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_8) { + if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f += 1; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":749 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_8) { + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":751 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_4 = PyNumber_Remainder(__pyx_kp_30, __pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":752 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), @@ -3076,25 +3090,26 @@ } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_9; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * + * */ __pyx_r = __pyx_v_f; goto __pyx_L0; @@ -3102,9 +3117,6 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); - __Pyx_XDECREF(__pyx_3); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); @@ -3117,13 +3129,153 @@ __Pyx_DECREF(__pyx_v_childname); __Pyx_DECREF(__pyx_v_new_offset); __Pyx_DECREF(__pyx_v_t); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static struct PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("cproduct"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("process_element"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_process_element, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_9mio_utils_process_element)}, + {__Pyx_NAMESTR("squeeze_element"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element, METH_O, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_9mio_utils_squeeze_element)}, {__Pyx_NAMESTR("chars_to_strings"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings, METH_O, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_9mio_utils_chars_to_strings)}, {0, 0, 0, 0} }; @@ -3134,7 +3286,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mio_utils"), - __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3145,59 +3297,62 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, - {&__pyx_kp_cproduct, __pyx_k_cproduct, sizeof(__pyx_k_cproduct), 1, 1, 1}, - {&__pyx_kp_process_element, __pyx_k_process_element, sizeof(__pyx_k_process_element), 1, 1, 1}, - {&__pyx_kp_chars_to_strings, __pyx_k_chars_to_strings, sizeof(__pyx_k_chars_to_strings), 1, 1, 1}, - {&__pyx_kp_tup, __pyx_k_tup, sizeof(__pyx_k_tup), 0, 1, 1}, - {&__pyx_kp_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 1, 1, 1}, - {&__pyx_kp_chars_as_strings, __pyx_k_chars_as_strings, sizeof(__pyx_k_chars_as_strings), 1, 1, 1}, - {&__pyx_kp_squeeze_me, __pyx_k_squeeze_me, sizeof(__pyx_k_squeeze_me), 1, 1, 1}, - {&__pyx_kp_in_arr, __pyx_k_in_arr, sizeof(__pyx_k_in_arr), 0, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 1, 1, 1}, - {&__pyx_kp_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0}, - {&__pyx_kp_size, __pyx_k_size, sizeof(__pyx_k_size), 1, 1, 1}, - {&__pyx_kp_array, __pyx_k_array, sizeof(__pyx_k_array), 1, 1, 1}, - {&__pyx_kp_squeeze, __pyx_k_squeeze, sizeof(__pyx_k_squeeze), 1, 1, 1}, - {&__pyx_kp_isbuiltin, __pyx_k_isbuiltin, sizeof(__pyx_k_isbuiltin), 1, 1, 1}, - {&__pyx_kp_item, __pyx_k_item, sizeof(__pyx_k_item), 1, 1, 1}, - {&__pyx_kp_str, __pyx_k_str, sizeof(__pyx_k_str), 1, 1, 1}, - {&__pyx_kp_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 1, 1, 1}, - {&__pyx_kp_view, __pyx_k_view, sizeof(__pyx_k_view), 1, 1, 1}, - {&__pyx_kp_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 0}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, - {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, - {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, + {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, + {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__isscalar, __pyx_k__isscalar, sizeof(__pyx_k__isscalar), 0, 0, 1, 1}, + {&__pyx_n_s__item, __pyx_k__item, sizeof(__pyx_k__item), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__squeeze, __pyx_k__squeeze, sizeof(__pyx_k__squeeze), 0, 0, 1, 1}, + {&__pyx_n_s__squeeze_element, __pyx_k__squeeze_element, sizeof(__pyx_k__squeeze_element), 0, 0, 1, 1}, + {&__pyx_n_s__str, __pyx_k__str, sizeof(__pyx_k__str), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__view, __pyx_k__view, sizeof(__pyx_k__view), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -3211,19 +3366,21 @@ PyMODINIT_FUNC PyInit_mio_utils(void) #endif { - PyObject *__pyx_1 = 0; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { PyErr_Clear(); - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); - if (!__Pyx_Refnanny) - Py_FatalError("failed to import refnanny module"); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3239,7 +3396,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -3250,38 +3407,62 @@ __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_scipy__io__matlab__mio_utils) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":5 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as cnp * */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 + /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":1 + * # -*- python -*- like file # <<<<<<<<<<<<<< + * ''' Utilities for generic processing of return arrays from read + * ''' + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_8), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) @@ -3289,7 +3470,9 @@ */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { __Pyx_AddTraceback("init scipy.io.matlab.mio_utils"); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -3297,7 +3480,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.mio_utils"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -3317,158 +3500,59 @@ } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) + if (likely(PyObject_TypeCheck(obj, type))) return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + "need more than %zd value%s to unpack", index, #endif + (index == 1) ? "" : "s"); } -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *number, *more_or_less; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } } - if (exact) { - more_or_less = "exactly"; - } - number = (num_expected == 1) ? "" : "s"; - PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); + return item; } -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { - values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - } - } +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%s() got an unexpected keyword argument '%s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; + else if (!PyErr_Occurred()) + return 0; + else + return -1; } -static INLINE void __Pyx_RaiseNoneNotIterableError(void) { +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); -} - static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); @@ -3540,19 +3624,202 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - /**/ if (sizeof(npy_intp) < sizeof(long)) - return PyInt_FromLong((long)val); - else if (sizeof(npy_intp) == sizeof(long)) - return (((npy_intp)-1) < ((npy_intp)0)) ? - PyInt_FromLong((long)val) : - PyLong_FromUnsignedLong((unsigned long)val); - else /* (sizeof(npy_intp) > sizeof(long)) */ - return (((npy_intp)-1) < ((npy_intp)0)) ? - PyLong_FromLongLong((PY_LONG_LONG)val) : - PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { + const npy_intp neg_one = (npy_intp)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(npy_intp) < sizeof(long)) { + return PyInt_FromLong((long)val); + } else if (sizeof(npy_intp) == sizeof(long)) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else { /* (sizeof(npy_intp) > sizeof(long)) */ + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } } +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3608,6 +3875,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3617,80 +3885,59 @@ return; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); +#else /* Python 3+ */ -#if PY_MAJOR_VERSION >= 3 - /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ - if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - PyErr_NormalizeException(&type, &value, &tb); - PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); - tstate->exc_type = 0; - tstate->exc_value = 0; - tstate->exc_traceback = 0; - PyException_SetContext(value, tmp_value); - Py_DECREF(tmp_type); - Py_XDECREF(tmp_tb); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } -#endif + if (value == Py_None) + value = 0; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; + PyErr_SetObject(type, value); - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); } } - return item; -} -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; +bad: + return; } +#endif -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -3701,13 +3948,15 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -3718,13 +3967,15 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -3735,13 +3986,15 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((char)-1) > ((char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -3752,13 +4005,15 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((short)-1) > ((short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -3769,13 +4024,15 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((int)-1) > ((int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -3786,13 +4043,15 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -3803,13 +4062,15 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -3820,13 +4081,15 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -3837,11 +4100,13 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -3850,14 +4115,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((unsigned long)-1) < ((unsigned long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3868,11 +4135,13 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -3881,14 +4150,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3899,11 +4170,13 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((long)-1) > ((long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -3912,14 +4185,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((long)-1) < ((long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3930,11 +4205,13 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -3943,14 +4220,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3961,11 +4240,13 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -3974,14 +4255,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((signed long)-1) < ((signed long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3992,11 +4275,13 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -4005,14 +4290,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4044,11 +4331,12 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -4073,9 +4361,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -4182,7 +4476,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -4190,10 +4484,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -4207,13 +4505,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -4259,7 +4557,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -4268,7 +4566,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -4282,7 +4580,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: trunk/scipy/io/matlab/mio_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio_utils.pyx 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/mio_utils.pyx 2010-05-26 19:29:32 UTC (rev 6413) @@ -14,22 +14,16 @@ return res -cpdef object process_element(cnp.ndarray arr, - int chars_as_strings = 1, - int squeeze_me = 0): - ''' Return processed object +cpdef object squeeze_element(cnp.ndarray arr): + ''' Return squeezed element The returned object may not be an ndarray - for example if we do ``arr.item`` to return a ``mat_struct`` object from a struct array ''' - if chars_as_strings and arr.dtype.kind == 'U': - arr = chars_to_strings(arr) - if squeeze_me: - if not arr.size: - arr = np.array([]) - else: - arr = np.squeeze(arr) - if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar - return arr.item() + if not arr.size: + return np.array([]) + arr = np.squeeze(arr) + if np.isscalar(arr): # 0d coverted to scalar + return arr.item() return arr Modified: trunk/scipy/io/matlab/tests/test_mio_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio_utils.py 2010-05-25 05:55:08 UTC (rev 6412) +++ trunk/scipy/io/matlab/tests/test_mio_utils.py 2010-05-26 19:29:32 UTC (rev 6413) @@ -9,7 +9,7 @@ from numpy.testing import assert_array_equal, assert_array_almost_equal -from scipy.io.matlab.mio_utils import cproduct, process_element, \ +from scipy.io.matlab.mio_utils import cproduct, squeeze_element, \ chars_to_strings @@ -20,26 +20,19 @@ yield assert_equal, cproduct([1,3]), 3 -def test_process_element(): +def test_squeeze_element(): a = np.zeros((1,3)) - pa = process_element(a, 0, 0) - yield assert_array_equal, a, pa - # squeeze; only second arg changes the output - yield assert_array_equal, a, process_element(a, 1, 0) yield (assert_array_equal, np.squeeze(a), - process_element(a, 0, 1)) - # chars as strings - strings = ['learn ', 'python', 'fast ', 'here '] - str_arr = np.array(strings, dtype='U6') # shape (4,) - chars = [list(s) for s in strings] - char_arr = np.array(chars, dtype='U1') # shape (4,6) - pac = process_element(char_arr, 0, 0) - yield assert_array_equal, char_arr, pac - pac = process_element(char_arr, 1, 0) - yield assert_array_equal, str_arr, pac + squeeze_element(a)) + # 0d output from squeeze gives scalar + sq_int = squeeze_element(np.zeros((1,1), dtype=np.float)) + yield assert_true, isinstance(sq_int, float) + # Unless it's a structured array + sq_sa = squeeze_element(np.zeros((1,1),dtype=[('f1', 'f')])) + yield assert_true, isinstance(sq_sa, np.ndarray) + - def test_chars_strings(): # chars as strings strings = ['learn ', 'python', 'fast ', 'here '] From scipy-svn at scipy.org Wed May 26 16:12:09 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 26 May 2010 15:12:09 -0500 (CDT) Subject: [Scipy-svn] r6414 - trunk/scipy/io/matlab/tests Message-ID: <20100526201209.C88B939CAE9@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-26 15:12:09 -0500 (Wed, 26 May 2010) New Revision: 6414 Modified: trunk/scipy/io/matlab/tests/test_mio.py Log: BF - silence unwanted test warnings; closes #1179 Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-26 19:29:32 UTC (rev 6413) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-26 20:12:09 UTC (rev 6414) @@ -8,6 +8,7 @@ from glob import glob from StringIO import StringIO from tempfile import mkdtemp +from functools import partial import warnings import shutil import gzip @@ -27,11 +28,22 @@ import scipy.io.matlab.byteordercodes as boc from scipy.io.matlab.miobase import matdims, MatFileReader, \ MatWriteError -from scipy.io.matlab.mio import loadmat, savemat, find_mat_file, \ - mat_reader_factory +from scipy.io.matlab.mio import find_mat_file, mat_reader_factory, \ + loadmat, savemat from scipy.io.matlab.mio5 import MatlabObject, MatFile5Writer, \ MatFile5Reader, MatlabFunction +# Use future defaults to silence unwanted test warnings +loadmat_future = partial(loadmat, struct_as_record=True) +savemat_future = partial(savemat, oned_as='row') +class MatFile5Reader_future(MatFile5Reader): + def __init__(self, *args, **kwargs): + sar = kwargs.get('struct_as_record') + if sar is None: + kwargs['struct_as_record'] = True + super(MatFile5Reader_future, self).__init__(*args, **kwargs) + + test_data_path = pjoin(dirname(__file__), 'data') def mlarr(*args, **kwargs): @@ -264,7 +276,7 @@ def _load_check_case(name, files, case): for file_name in files: - matdict = loadmat(file_name, struct_as_record=True) + matdict = loadmat_future(file_name, struct_as_record=True) label = "test %s; file %s" % (name, file_name) for k, expected in case.items(): k_label = "%s, variable %s" % (label, k) @@ -275,7 +287,7 @@ # Round trip tests def _rt_check_case(name, expected, format): mat_stream = StringIO() - savemat(mat_stream, expected, format=format) + savemat_future(mat_stream, expected, format=format) mat_stream.seek(0) _load_check_case(name, [mat_stream], expected) @@ -315,11 +327,11 @@ try: fname = pjoin(tmpdir,name) mat_stream = gzip.open( fname,mode='wb') - savemat(mat_stream, expected, format=format) + savemat_future(mat_stream, expected, format=format) mat_stream.close() mat_stream = gzip.open( fname,mode='rb') - actual = loadmat(mat_stream, struct_as_record=True) + actual = loadmat_future(mat_stream, struct_as_record=True) mat_stream.close() finally: shutil.rmtree(tmpdir) @@ -335,7 +347,7 @@ assert_true(len(filenames)>0) for filename in filenames: assert_raises(NotImplementedError, - loadmat, + loadmat_future, filename, struct_as_record=True) @@ -360,7 +372,7 @@ def test_regression_653(): """Regression test for #653.""" - assert_raises(TypeError, savemat, StringIO(), {'d':{1:2}}, format='5') + assert_raises(TypeError, savemat_future, StringIO(), {'d':{1:2}}, format='5') def test_structname_len(): @@ -369,17 +381,17 @@ fldname = 'a' * lim st1 = np.zeros((1,1), dtype=[(fldname, object)]) mat_stream = StringIO() - savemat(StringIO(), {'longstruct': st1}, format='5') + savemat_future(StringIO(), {'longstruct': st1}, format='5') fldname = 'a' * (lim+1) st1 = np.zeros((1,1), dtype=[(fldname, object)]) - assert_raises(ValueError, savemat, StringIO(), + assert_raises(ValueError, savemat_future, StringIO(), {'longstruct': st1}, format='5') def test_4_and_long_field_names_incompatible(): # Long field names option not supported in 4 my_struct = np.zeros((1,1),dtype=[('my_fieldname',object)]) - assert_raises(ValueError, savemat, StringIO(), + assert_raises(ValueError, savemat_future, StringIO(), {'my_struct':my_struct}, format='4', long_field_names=True) @@ -389,10 +401,10 @@ fldname = 'a' * lim st1 = np.zeros((1,1), dtype=[(fldname, object)]) mat_stream = StringIO() - savemat(StringIO(), {'longstruct': st1}, format='5',long_field_names=True) + savemat_future(StringIO(), {'longstruct': st1}, format='5',long_field_names=True) fldname = 'a' * (lim+1) st1 = np.zeros((1,1), dtype=[(fldname, object)]) - assert_raises(ValueError, savemat, StringIO(), + assert_raises(ValueError, savemat_future, StringIO(), {'longstruct': st1}, format='5',long_field_names=True) @@ -406,11 +418,11 @@ cell[0,0]=st1 cell[0,1]=st1 mat_stream = StringIO() - savemat(StringIO(), {'longstruct': cell}, format='5',long_field_names=True) + savemat_future(StringIO(), {'longstruct': cell}, format='5',long_field_names=True) # # Check to make sure it fails with long field names off # - assert_raises(ValueError, savemat, StringIO(), + assert_raises(ValueError, savemat_future, StringIO(), {'longstruct': cell}, format='5', long_field_names=False) @@ -422,17 +434,17 @@ cells[0,0]='Hello' cells[0,1]='World' mat_stream = StringIO() - savemat(StringIO(), {'x': cells}, format='5') + savemat_future(StringIO(), {'x': cells}, format='5') cells = np.ndarray((1,1),dtype=object) cells[0,0]='Hello, world' mat_stream = StringIO() - savemat(StringIO(), {'x': cells}, format='5') + savemat_future(StringIO(), {'x': cells}, format='5') def test_writer_properties(): # Tests getting, setting of properties of matrix writer - mfw = MatFile5Writer(StringIO()) + mfw = MatFile5Writer(StringIO(), oned_as='row') yield assert_equal, mfw.global_vars, [] mfw.global_vars = ['avar'] yield assert_equal, mfw.global_vars, ['avar'] @@ -447,7 +459,7 @@ def test_use_small_element(): # Test whether we're using small data element or not sio = StringIO() - wtr = MatFile5Writer(sio) + wtr = MatFile5Writer(sio, oned_as='column') # First check size for no sde for name arr = np.zeros(10) wtr.put_variables({'aaaaa': arr}) @@ -466,22 +478,24 @@ # Test that dict can be saved (as recarray), loaded as matstruct d = {'a':1, 'b':2} stream = StringIO() - savemat(stream, {'dict':d}) + savemat_future(stream, {'dict':d}) stream.seek(0) - vals = loadmat(stream) + vals = loadmat_future(stream) def test_1d_shape(): # Current 5 behavior is 1D -> column vector arr = np.arange(5) stream = StringIO() + # silence warnings for tests + warnings.simplefilter('ignore') savemat(stream, {'oned':arr}, format='5') - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_equal, vals['oned'].shape, (5,1) # Current 4 behavior is 1D -> row vector stream = StringIO() savemat(stream, {'oned':arr}, format='4') - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_equal, vals['oned'].shape, (1, 5) for format in ('4', '5'): # can be explicitly 'column' for oned_as @@ -489,47 +503,48 @@ savemat(stream, {'oned':arr}, format=format, oned_as='column') - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_equal, vals['oned'].shape, (5,1) # but different from 'row' stream = StringIO() savemat(stream, {'oned':arr}, format=format, oned_as='row') - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_equal, vals['oned'].shape, (1,5) - + warnings.resetwarnings() + def test_compression(): arr = np.zeros(100).reshape((5,20)) arr[2,10] = 1 stream = StringIO() - savemat(stream, {'arr':arr}) + savemat_future(stream, {'arr':arr}) raw_len = len(stream.getvalue()) - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_array_equal, vals['arr'], arr stream = StringIO() - savemat(stream, {'arr':arr}, do_compression=True) + savemat_future(stream, {'arr':arr}, do_compression=True) compressed_len = len(stream.getvalue()) - vals = loadmat(stream) + vals = loadmat_future(stream) yield assert_array_equal, vals['arr'], arr yield assert_true, raw_len>compressed_len # Concatenate, test later arr2 = arr.copy() arr2[0,0] = 1 stream = StringIO() - savemat(stream, {'arr':arr, 'arr2':arr2}, do_compression=False) - vals = loadmat(stream) + savemat_future(stream, {'arr':arr, 'arr2':arr2}, do_compression=False) + vals = loadmat_future(stream) yield assert_array_equal, vals['arr2'], arr2 stream = StringIO() - savemat(stream, {'arr':arr, 'arr2':arr2}, do_compression=True) - vals = loadmat(stream) + savemat_future(stream, {'arr':arr, 'arr2':arr2}, do_compression=True) + vals = loadmat_future(stream) yield assert_array_equal, vals['arr2'], arr2 def test_single_object(): stream = StringIO() - savemat(stream, {'A':np.array(1, dtype=object)}) + savemat_future(stream, {'A':np.array(1, dtype=object)}) def test_skip_variable(): @@ -545,9 +560,9 @@ # filename = pjoin(test_data_path,'test_skip_variable.mat') # - # Prove that it loads with loadmat + # Prove that it loads with loadmat_future # - d = loadmat(filename, struct_as_record=True) + d = loadmat_future(filename, struct_as_record=True) yield assert_true, d.has_key('first') yield assert_true, d.has_key('second') # @@ -566,7 +581,7 @@ filename = pjoin(test_data_path,'test_empty_struct.mat') # before ticket fix, this would crash with ValueError, empty data # type - d = loadmat(filename, struct_as_record=True) + d = loadmat_future(filename, struct_as_record=True) a = d['a'] yield assert_equal, a.shape, (1,1) yield assert_equal, a.dtype, np.dtype(np.object) @@ -574,8 +589,8 @@ stream = StringIO() arr = np.array((), dtype='U') # before ticket fix, this used to give data type not understood - savemat(stream, {'arr':arr}) - d = loadmat(stream) + savemat_future(stream, {'arr':arr}) + d = loadmat_future(stream) a2 = d['arr'] yield assert_array_equal, a2, arr @@ -590,12 +605,12 @@ arr[1]['f1'] = 99 arr[1]['f2'] = 'not perl' stream = StringIO() - savemat(stream, {'arr': arr}) - d = loadmat(stream, struct_as_record=False) + savemat_future(stream, {'arr': arr}) + d = loadmat_future(stream, struct_as_record=False) a20 = d['arr'][0,0] yield assert_equal, a20.f1, 0.5 yield assert_equal, a20.f2, 'python' - d = loadmat(stream, struct_as_record=True) + d = loadmat_future(stream, struct_as_record=True) a20 = d['arr'][0,0] yield assert_equal, a20['f1'], 0.5 yield assert_equal, a20['f2'], 'python' @@ -613,12 +628,12 @@ c.field1 = 1 c.field2 = 'a string' stream = StringIO() - savemat(stream, {'c': c}) - d = loadmat(stream, struct_as_record=False) + savemat_future(stream, {'c': c}) + d = loadmat_future(stream, struct_as_record=False) c2 = d['c'][0,0] yield assert_equal, c2.field1, 1 yield assert_equal, c2.field2, 'a string' - d = loadmat(stream, struct_as_record=True) + d = loadmat_future(stream, struct_as_record=True) c2 = d['c'][0,0] yield assert_equal, c2['field1'], 1 yield assert_equal, c2['field2'], 'a string' @@ -629,29 +644,29 @@ # initialization arr = np.arange(6).reshape(1,6) stream = StringIO() - savemat(stream, {'a': arr}) - rdr = MatFile5Reader(stream) + savemat_future(stream, {'a': arr}) + rdr = MatFile5Reader_future(stream) back_dict = rdr.get_variables() rarr = back_dict['a'] yield assert_array_equal, rarr, arr - rdr = MatFile5Reader(stream, squeeze_me=True) + rdr = MatFile5Reader_future(stream, squeeze_me=True) yield assert_array_equal, rdr.get_variables()['a'], arr.reshape((6,)) rdr.squeeze_me = False yield assert_array_equal, rarr, arr - rdr = MatFile5Reader(stream, byte_order=boc.native_code) + rdr = MatFile5Reader_future(stream, byte_order=boc.native_code) yield assert_array_equal, rdr.get_variables()['a'], arr # inverted byte code leads to error on read because of swapped # header etc - rdr = MatFile5Reader(stream, byte_order=boc.swapped_code) + rdr = MatFile5Reader_future(stream, byte_order=boc.swapped_code) yield assert_raises, Exception, rdr.get_variables rdr.byte_order = boc.native_code yield assert_array_equal, rdr.get_variables()['a'], arr arr = np.array(['a string']) stream.truncate(0) - savemat(stream, {'a': arr}) - rdr = MatFile5Reader(stream) + savemat_future(stream, {'a': arr}) + rdr = MatFile5Reader_future(stream) yield assert_array_equal, rdr.get_variables()['a'], arr - rdr = MatFile5Reader(stream, chars_as_strings=False) + rdr = MatFile5Reader_future(stream, chars_as_strings=False) carr = np.atleast_2d(np.array(list(arr.item()), dtype='U1')) yield assert_array_equal, rdr.get_variables()['a'], carr rdr.chars_as_strings=True @@ -661,7 +676,7 @@ def test_empty_string(): # make sure reading empty string does not raise error estring_fname = pjoin(test_data_path, 'single_empty_string.mat') - rdr = MatFile5Reader(file(estring_fname)) + rdr = MatFile5Reader_future(file(estring_fname)) d = rdr.get_variables() yield assert_array_equal, d['a'], np.array([], dtype='U1') # empty string round trip. Matlab cannot distiguish @@ -670,13 +685,13 @@ # arrays of char. There is no way of having an array of char that # is not empty, but contains an empty string. stream = StringIO() - savemat(stream, {'a': np.array([''])}) - rdr = MatFile5Reader(stream) + savemat_future(stream, {'a': np.array([''])}) + rdr = MatFile5Reader_future(stream) d = rdr.get_variables() yield assert_array_equal, d['a'], np.array([], dtype='U1') stream.truncate(0) - savemat(stream, {'a': np.array([], dtype='U1')}) - rdr = MatFile5Reader(stream) + savemat_future(stream, {'a': np.array([], dtype='U1')}) + rdr = MatFile5Reader_future(stream) d = rdr.get_variables() yield assert_array_equal, d['a'], np.array([], dtype='U1') @@ -686,30 +701,33 @@ stream = StringIO() arr = np.arange(24).reshape((2,3,4)) warnings.simplefilter('error') - yield (assert_raises, DeprecationWarning, savemat, + yield (assert_raises, DeprecationWarning, savemat_future, stream, {'a': arr}, True, '4') warnings.resetwarnings() - savemat(stream, {'a': arr}, format='4') - d = loadmat(stream) + # For now, we save a 3D array as 2D + warnings.simplefilter('ignore') + savemat_future(stream, {'a': arr}, format='4') + warnings.resetwarnings() + d = loadmat_future(stream) yield assert_array_equal, d['a'], arr.reshape((6,4)) def test_func_read(): func_eg = pjoin(test_data_path, 'testfunc_7.4_GLNX86.mat') - rdr = MatFile5Reader(file(func_eg)) + rdr = MatFile5Reader_future(file(func_eg)) d = rdr.get_variables() yield assert_true, isinstance(d['testfunc'], MatlabFunction) stream = StringIO() - wtr = MatFile5Writer(stream) + wtr = MatFile5Writer(stream, oned_as='row') yield assert_raises, MatWriteError, wtr.put_variables, d def test_mat_dtype(): double_eg = pjoin(test_data_path, 'testmatrix_6.1_SOL2.mat') - rdr = MatFile5Reader(file(double_eg), mat_dtype=False) + rdr = MatFile5Reader_future(file(double_eg), mat_dtype=False) d = rdr.get_variables() yield assert_equal, d['testmatrix'].dtype.kind, 'u' - rdr = MatFile5Reader(file(double_eg), mat_dtype=True) + rdr = MatFile5Reader_future(file(double_eg), mat_dtype=True) d = rdr.get_variables() yield assert_equal, d['testmatrix'].dtype.kind, 'f' @@ -719,19 +737,19 @@ # ndarray return type, but getting sparse matrix st = {'sparsefield': SP.coo_matrix(np.eye(4))} stream = StringIO() - savemat(stream, {'a':st}) - d = loadmat(stream, struct_as_record=True) + savemat_future(stream, {'a':st}) + d = loadmat_future(stream, struct_as_record=True) yield assert_array_equal, d['a'][0,0]['sparsefield'].todense(), np.eye(4) def test_mat_struct_squeeze(): stream = StringIO() in_d = {'st':{'one':1, 'two':2}} - savemat(stream, in_d) + savemat_future(stream, in_d) # no error without squeeze - out_d = loadmat(stream, struct_as_record=False) + out_d = loadmat_future(stream, struct_as_record=False) # previous error was with squeeze, with mat_struct - out_d = loadmat(stream, + out_d = loadmat_future(stream, struct_as_record=False, squeeze_me=True, ) @@ -742,8 +760,8 @@ stream = StringIO() in_arr = np.array(['Hello', 'Foob']) out_arr = np.array(['Hello', 'Foob ']) - savemat(stream, dict(a=in_arr)) - res = loadmat(stream) + savemat_future(stream, dict(a=in_arr)) + res = loadmat_future(stream) # resulted in [u'HloolFoa', u'elWrdobr'] yield assert_array_equal, res['a'], out_arr stream.truncate(0) @@ -753,13 +771,13 @@ dtype=in_arr.dtype, order='F', buffer=in_str) - savemat(stream, dict(a=in_from_str)) + savemat_future(stream, dict(a=in_from_str)) yield assert_array_equal, res['a'], out_arr # unicode save did lead to buffer too small error stream.truncate(0) in_arr_u = in_arr.astype('U') out_arr_u = out_arr.astype('U') - savemat(stream, {'a': in_arr_u}) - res = loadmat(stream) + savemat_future(stream, {'a': in_arr_u}) + res = loadmat_future(stream) yield assert_array_equal, res['a'], out_arr_u From scipy-svn at scipy.org Thu May 27 07:31:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 May 2010 06:31:51 -0500 (CDT) Subject: [Scipy-svn] r6415 - trunk/scipy/io/tests Message-ID: <20100527113151.8525E39CAEC@scipy.org> Author: rgommers Date: 2010-05-27 06:31:51 -0500 (Thu, 27 May 2010) New Revision: 6415 Modified: trunk/scipy/io/tests/test_wavfile.py Log: TST: Remove print statement to silence wavfile test output. Modified: trunk/scipy/io/tests/test_wavfile.py =================================================================== --- trunk/scipy/io/tests/test_wavfile.py 2010-05-26 20:12:09 UTC (rev 6414) +++ trunk/scipy/io/tests/test_wavfile.py 2010-05-27 11:31:51 UTC (rev 6415) @@ -38,7 +38,6 @@ assert rate == rate2 assert data2.dtype.byteorder in ('<', '=', '|'), data2.dtype - print data[:5], data2[:5] assert_array_equal(data, data2) finally: os.unlink(tmpfile) From scipy-svn at scipy.org Thu May 27 10:15:44 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 May 2010 09:15:44 -0500 (CDT) Subject: [Scipy-svn] r6416 - in trunk: doc/release scipy/misc Message-ID: <20100527141544.3564839CAE6@scipy.org> Author: warren.weckesser Date: 2010-05-27 09:15:43 -0500 (Thu, 27 May 2010) New Revision: 6416 Removed: trunk/scipy/misc/limits.py Modified: trunk/doc/release/0.8.0-notes.rst trunk/scipy/misc/helpmod.py trunk/scipy/misc/pexec.py trunk/scipy/misc/ppimport.py Log: scipy.misc: Removed the deprecated limits module, and added deprecation warnings to helpmod, ppimport and pexec. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-27 11:31:51 UTC (rev 6415) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-27 14:15:43 UTC (rev 6416) @@ -55,6 +55,12 @@ underlying computation routine. This behavior is deprecated, and will be removed in scipy 0.9.0. +Obsolete code deprecated (scipy.misc) +------------------------------------- + +The modules `helpmod`, `ppimport` and `pexec` from `scipy.misc` are deprecated. +They will be removed from SciPy in version 0.9. + New features ============ @@ -142,6 +148,8 @@ scipy.stsci: the package was removed +The module `scipy.misc.limits` was removed. + scipy.signal.chirp: * The `qshape` keyword argument was removed. Instead, use the `vertex_zero` Modified: trunk/scipy/misc/helpmod.py =================================================================== --- trunk/scipy/misc/helpmod.py 2010-05-27 11:31:51 UTC (rev 6415) +++ trunk/scipy/misc/helpmod.py 2010-05-27 14:15:43 UTC (rev 6416) @@ -3,6 +3,10 @@ import sys import pydoc +import warnings +warnings.warn('The helpmod module is deprecated. It will be removed from SciPy in version 0.9.', + DeprecationWarning) + __all__ = ['info','source'] # NOTE: pydoc defines a help function which works simliarly to this Deleted: trunk/scipy/misc/limits.py =================================================================== --- trunk/scipy/misc/limits.py 2010-05-27 11:31:51 UTC (rev 6415) +++ trunk/scipy/misc/limits.py 2010-05-27 14:15:43 UTC (rev 6416) @@ -1,37 +0,0 @@ -""" Machine limits for Float32 and Float64. -""" - -import warnings -warnings.warn('limits module is deprecated, please use numpy.finfo instead', - DeprecationWarning) - - -__all__ = ['float_epsilon','float_tiny','float_min', - 'float_max','float_precision','float_resolution', - 'single_epsilon','single_tiny','single_min','single_max', - 'single_precision','single_resolution', - 'double_epsilon','double_tiny','double_min','double_max', - 'double_precision','double_resolution'] - - -from numpy import finfo, single, float_ - -single_epsilon = finfo(single).eps -single_tiny = finfo(single).tiny -single_max = finfo(single).max -single_min = -single_max -single_precision = finfo(single).precision -single_resolution = finfo(single).resolution - -double_epsilon = float_epsilon = finfo(float_).eps -double_tiny = float_tiny = finfo(float_).tiny -double_max = float_max = finfo(float_).max -double_min = float_min = -float_max -double_precision = float_precision = finfo(float_).precision -double_resolution = float_resolution = finfo(float_).resolution - -if __name__ == '__main__': - print 'single epsilon:',single_epsilon - print 'single tiny:',single_tiny - print 'float epsilon:',float_epsilon - print 'float tiny:',float_tiny Modified: trunk/scipy/misc/pexec.py =================================================================== --- trunk/scipy/misc/pexec.py 2010-05-27 11:31:51 UTC (rev 6415) +++ trunk/scipy/misc/pexec.py 2010-05-27 14:15:43 UTC (rev 6416) @@ -12,6 +12,11 @@ import Queue import traceback +import warnings +warnings.warn('The pexec module is deprecated. It will be removed from SciPy in version 0.9.', + DeprecationWarning) + + class ParallelExec(threading.Thread): """ Create a thread of parallel execution. """ Modified: trunk/scipy/misc/ppimport.py =================================================================== --- trunk/scipy/misc/ppimport.py 2010-05-27 11:31:51 UTC (rev 6415) +++ trunk/scipy/misc/ppimport.py 2010-05-27 14:15:43 UTC (rev 6416) @@ -15,6 +15,10 @@ import types import traceback +import warnings +warnings.warn('The ppimport module is deprecated. It will be removed from SciPy in version 0.9.', + DeprecationWarning) + DEBUG=0 _ppimport_is_enabled = 1 From scipy-svn at scipy.org Thu May 27 17:31:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 May 2010 16:31:26 -0500 (CDT) Subject: [Scipy-svn] r6417 - trunk/scipy/stats Message-ID: <20100527213126.16E3939CAEE@scipy.org> Author: josef Date: 2010-05-27 16:31:25 -0500 (Thu, 27 May 2010) New Revision: 6417 Modified: trunk/scipy/stats/stats.py Log: stats.spearmanr enhance with tiehandling, and 2d with axis ticket:822 ticket:1100 Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-05-27 14:15:43 UTC (rev 6416) +++ trunk/scipy/stats/stats.py 2010-05-27 21:31:25 UTC (rev 6417) @@ -2117,7 +2117,7 @@ return r,prob -def spearmanr(x, y): +def spearmanr(a, b=None, axis=0): """ Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. @@ -2141,19 +2141,33 @@ Parameters ---------- - x : 1D array - Must have length > 2 - y : 1D array - Must have the same length as x. + a, b : 1D or 2D array_like, b is optional + One or two 1-D or 2-D arrays containing multiple variables and + observations. Each column of m represents a variable, and each row + entry a single observation of those variables. Also see axis below. + Both arrays need to have the same length in the `axis` dimension. + + axis : int or None, optional + If axis=0 (default), then each column represents a variable, with + observations in the rows. If axis=0, the relationship is transposed: + each row represents a variable, while the columns contain observations. + If axis=None, then both arrays will be raveled Returns ------- - r : float - The Spearman correlation coefficient + rho: float or array (2D square) + Spearman correlation matrix or correlation coefficient (if only 2 variables + are given as parameters. Correlation matrix is square with length + equal to total number of variables (columns or rows) in a and b + combined p-value : float The two-sided p-value for a hypothesis test whose null hypothesis is - that the two sets of data are uncorrelated. + that two sets of data are uncorrelated, has same dimension as rho + Notes + ----- + changes in scipy 0.8: rewrite to add tie-handling, and axis + References ---------- [CRCProbStat2000]_ Section 14.7 @@ -2162,30 +2176,64 @@ Probablity and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. + Examples + -------- + + >>> spearmanr([1,2,3,4,5],[5,6,7,8,7]) + (0.82078268166812329, 0.088587005313543798) + >>> np.random.seed(1234321) + >>> x2n=np.random.randn(100,2) + >>> y2n=np.random.randn(100,2) + >>> spearmanr(x2n) + (0.059969996999699973, 0.55338590803773591) + >>> spearmanr(x2n[:,0], x2n[:,1]) + (0.059969996999699973, 0.55338590803773591) + >>> rho, pval = spearmanr(x2n,y2n) + >>> rho + array([[ 1. , 0.05997 , 0.18569457, 0.06258626], + [ 0.05997 , 1. , 0.110003 , 0.02534653], + [ 0.18569457, 0.110003 , 1. , 0.03488749], + [ 0.06258626, 0.02534653, 0.03488749, 1. ]]) + >>> pval + array([[ 0. , 0.55338591, 0.06435364, 0.53617935], + [ 0.55338591, 0. , 0.27592895, 0.80234077], + [ 0.06435364, 0.27592895, 0. , 0.73039992], + [ 0.53617935, 0.80234077, 0.73039992, 0. ]]) + >>> rho, pval = spearmanr(x2n.T, y2n.T, axis=1) + >>> rho + array([[ 1. , 0.05997 , 0.18569457, 0.06258626], + [ 0.05997 , 1. , 0.110003 , 0.02534653], + [ 0.18569457, 0.110003 , 1. , 0.03488749], + [ 0.06258626, 0.02534653, 0.03488749, 1. ]]) + >>> spearmanr(x2n, y2n, axis=None) + (0.10816770419260482, 0.1273562188027364) + >>> spearmanr(x2n.ravel(), y2n.ravel()) + (0.10816770419260482, 0.1273562188027364) + + >>> xint = np.random.randint(10,size=(100,2)) + >>> spearmanr(xint) + (0.052760927029710199, 0.60213045837062351) + """ - x = np.asanyarray(x) - y = np.asanyarray(y) - n = len(x) - m = len(y) - if n != m: - raise ValueError("lengths of x and y must match: %s != %s" % (n, m)) - if n <= 2: - raise ValueError("length must be > 2") - rankx = rankdata(x) - ranky = rankdata(y) - dsq = np.add.reduce((rankx-ranky)**2) - rs = 1 - 6*dsq / float(n*(n**2-1)) - df = n-2 + a, axisout = _chk_asarray(a, axis) + ar = np.apply_along_axis(rankdata,axisout,a) + + br = None + if not b is None: + b, axisout = _chk_asarray(b, axis) + br = np.apply_along_axis(rankdata,axisout,b) + n = a.shape[axisout] + rs = np.corrcoef(ar,br,rowvar=axisout) - try: - t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) - probrs = betai(0.5*df, 0.5, df/(df+t*t)) - except ZeroDivisionError: - probrs = 0.0 + t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs))) + prob = distributions.t.sf(np.abs(t),n-2)*2 + + if rs.shape == (2,2): + return rs[1,0], prob[1,0] + else: + return rs, prob - return rs, probrs - def pointbiserialr(x, y): # comment: I am changing the semantics somewhat. The original function is # fairly general and accepts an x sequence that has any type of thing in it as From scipy-svn at scipy.org Thu May 27 23:40:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 27 May 2010 22:40:26 -0500 (CDT) Subject: [Scipy-svn] r6418 - in trunk/scipy/io/matlab: . tests Message-ID: <20100528034026.E472F39CAE6@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-27 22:40:26 -0500 (Thu, 27 May 2010) New Revision: 6418 Modified: trunk/scipy/io/matlab/mio_utils.c trunk/scipy/io/matlab/mio_utils.pyx trunk/scipy/io/matlab/tests/test_mio_funcs.py trunk/scipy/io/matlab/tests/test_streams.py Log: BF - reverted algorithm change for squeeze, fixed windows file permission error Modified: trunk/scipy/io/matlab/mio_utils.c =================================================================== --- trunk/scipy/io/matlab/mio_utils.c 2010-05-27 21:31:25 UTC (rev 6417) +++ trunk/scipy/io/matlab/mio_utils.c 2010-05-28 03:40:26 UTC (rev 6418) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Wed May 26 12:20:27 2010 */ +/* Generated by Cython 0.12.1 on Thu May 27 17:30:06 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -728,11 +728,11 @@ static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__isscalar[] = "isscalar"; static char __pyx_k__itemsize[] = "itemsize"; static char __pyx_k__readonly[] = "readonly"; static char __pyx_k__type_num[] = "type_num"; static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__isbuiltin[] = "isbuiltin"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k__RuntimeError[] = "RuntimeError"; @@ -761,7 +761,7 @@ static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__fields; static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__isscalar; +static PyObject *__pyx_n_s__isbuiltin; static PyObject *__pyx_n_s__item; static PyObject *__pyx_n_s__itemsize; static PyObject *__pyx_n_s__names; @@ -783,7 +783,7 @@ static PyObject *__pyx_n_s__view; static PyObject *__pyx_int_15; -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -803,7 +803,7 @@ __Pyx_RefNannySetupContext("cproduct"); __Pyx_INCREF(__pyx_v_tup); - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":10 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -812,7 +812,7 @@ */ __pyx_v_res = 1; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":12 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -823,7 +823,7 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":13 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< @@ -837,7 +837,7 @@ __pyx_v_res *= __pyx_t_4; } - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":14 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -859,7 +859,7 @@ return __pyx_r; } -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -892,7 +892,7 @@ return __pyx_r; } -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -908,10 +908,11 @@ int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; __Pyx_RefNannySetupContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":22 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: # <<<<<<<<<<<<<< @@ -925,12 +926,12 @@ __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":23 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: * return np.array([]) # <<<<<<<<<<<<<< * arr = np.squeeze(arr) - * if np.isscalar(arr): # 0d coverted to scalar + * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -956,11 +957,11 @@ } __pyx_L3:; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":24 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":24 * if not arr.size: * return np.array([]) * arr = np.squeeze(arr) # <<<<<<<<<<<<<< - * if np.isscalar(arr): # 0d coverted to scalar + * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -982,44 +983,41 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":25 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":25 * return np.array([]) * arr = np.squeeze(arr) - * if np.isscalar(arr): # 0d coverted to scalar # <<<<<<<<<<<<<< + * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< * return arr.item() * return arr */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__isscalar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_v_arr)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_arr)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_arr)); - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = (!(__pyx_v_arr->dimensions != 0)); if (__pyx_t_3) { + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__isbuiltin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_t_2; + } else { + __pyx_t_6 = __pyx_t_3; + } + if (__pyx_t_6) { - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":26 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":26 * arr = np.squeeze(arr) - * if np.isscalar(arr): # 0d coverted to scalar + * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() # <<<<<<<<<<<<<< * return arr * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__item); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__item); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; @@ -1027,8 +1025,8 @@ } __pyx_L4:; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":27 - * if np.isscalar(arr): # 0d coverted to scalar + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":27 + * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() * return arr # <<<<<<<<<<<<<< * @@ -1054,7 +1052,7 @@ return __pyx_r; } -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -1089,7 +1087,7 @@ return __pyx_r; } -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1113,7 +1111,7 @@ __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":44 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< @@ -1124,7 +1122,7 @@ __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":45 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1133,7 +1131,7 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":46 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< @@ -1142,7 +1140,7 @@ */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":47 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< @@ -1151,7 +1149,7 @@ */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":49 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] * cdef object new_dt_str * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< @@ -1161,7 +1159,7 @@ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":50 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":50 * cdef object new_dt_str * if last_dim == 0: # deal with empty array case * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< @@ -1180,7 +1178,7 @@ } /*else*/ { - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":52 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":52 * new_dt_str = arr.dtype.str * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< @@ -1215,7 +1213,7 @@ } __pyx_L3:; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":54 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":54 * new_dt_str = arr.dtype.str[:-1] + str(last_dim) * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< @@ -1241,7 +1239,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":55 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":55 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< @@ -1263,7 +1261,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":56 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":56 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< @@ -1307,7 +1305,7 @@ return __pyx_r; } -/* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1341,7 +1339,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1377,7 +1375,7 @@ __Pyx_GIVEREF(__pyx_v_info->obj); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1386,7 +1384,7 @@ */ __pyx_v_endian_detector = 1; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1395,7 +1393,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":196 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1404,7 +1402,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1414,7 +1412,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1426,7 +1424,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1437,7 +1435,7 @@ } __pyx_L5:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1447,7 +1445,7 @@ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1461,7 +1459,7 @@ } if (__pyx_t_3) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -1483,7 +1481,7 @@ } __pyx_L6:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":207 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1493,7 +1491,7 @@ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1507,7 +1505,7 @@ } if (__pyx_t_2) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< @@ -1529,7 +1527,7 @@ } __pyx_L7:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":211 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1538,7 +1536,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1547,7 +1545,7 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1557,7 +1555,7 @@ __pyx_t_6 = __pyx_v_copy_shape; if (__pyx_t_6) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1566,7 +1564,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1575,7 +1573,7 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1586,7 +1584,7 @@ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1595,7 +1593,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1608,7 +1606,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1617,7 +1615,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1628,7 +1626,7 @@ } __pyx_L8:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1637,7 +1635,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1646,7 +1644,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1655,7 +1653,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1664,7 +1662,7 @@ */ __pyx_v_f = NULL; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1674,7 +1672,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1683,7 +1681,7 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1699,7 +1697,7 @@ } if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1715,7 +1713,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1730,7 +1728,7 @@ } __pyx_L11:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1740,7 +1738,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1749,7 +1747,7 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -1764,7 +1762,7 @@ } if (!__pyx_t_2) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -1784,7 +1782,7 @@ } if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -1806,7 +1804,7 @@ } __pyx_L13:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -1819,7 +1817,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":249 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1832,7 +1830,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1845,7 +1843,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1858,7 +1856,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1871,7 +1869,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1884,7 +1882,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1897,7 +1895,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1910,7 +1908,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1923,7 +1921,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1936,7 +1934,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1949,7 +1947,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1962,7 +1960,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1975,7 +1973,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1988,7 +1986,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2001,7 +1999,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2014,7 +2012,7 @@ goto __pyx_L14; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2028,7 +2026,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -2054,7 +2052,7 @@ } __pyx_L14:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":267 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2063,7 +2061,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":268 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2076,7 +2074,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":270 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2085,7 +2083,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":271 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2094,7 +2092,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":272 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2103,7 +2101,7 @@ */ __pyx_v_offset = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< @@ -2113,7 +2111,7 @@ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2146,7 +2144,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2160,7 +2158,7 @@ __Pyx_RefNannySetupContext("__releasebuffer__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2170,7 +2168,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2182,7 +2180,7 @@ } __pyx_L5:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2192,7 +2190,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2208,7 +2206,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":755 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2221,7 +2219,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":756 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2247,7 +2245,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":758 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2260,7 +2258,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":759 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2286,7 +2284,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":761 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2299,7 +2297,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":762 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2325,7 +2323,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":764 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2338,7 +2336,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2364,7 +2362,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":767 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2377,7 +2375,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2403,7 +2401,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":770 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2438,7 +2436,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2447,7 +2445,7 @@ */ __pyx_v_endian_detector = 1; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2456,7 +2454,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2475,7 +2473,7 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -2489,7 +2487,7 @@ __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2512,7 +2510,7 @@ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -2537,7 +2535,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< @@ -2559,7 +2557,7 @@ } __pyx_L5:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":788 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -2574,7 +2572,7 @@ } if (!__pyx_t_7) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -2594,7 +2592,7 @@ } if (__pyx_t_6) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -2616,7 +2614,7 @@ } __pyx_L6:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2633,7 +2631,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2642,7 +2640,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2651,7 +2649,7 @@ */ __pyx_v_f += 1; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2661,7 +2659,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2670,7 +2668,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -2680,7 +2678,7 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< @@ -2693,7 +2691,7 @@ __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -2703,7 +2701,7 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":810 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< @@ -2725,7 +2723,7 @@ } __pyx_L10:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< @@ -2744,7 +2742,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< @@ -2763,7 +2761,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< @@ -2782,7 +2780,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< @@ -2801,7 +2799,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< @@ -2820,7 +2818,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< @@ -2839,7 +2837,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< @@ -2858,7 +2856,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< @@ -2877,7 +2875,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< @@ -2896,7 +2894,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< @@ -2915,7 +2913,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< @@ -2934,7 +2932,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< @@ -2953,7 +2951,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< @@ -2972,7 +2970,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< @@ -2993,7 +2991,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< @@ -3014,7 +3012,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< @@ -3035,7 +3033,7 @@ goto __pyx_L11; } - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< @@ -3055,7 +3053,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -3078,7 +3076,7 @@ } __pyx_L11:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":832 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3090,7 +3088,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -3104,7 +3102,7 @@ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3134,7 +3132,7 @@ return __pyx_r; } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":952 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3149,7 +3147,7 @@ __Pyx_INCREF((PyObject *)__pyx_v_arr); __Pyx_INCREF(__pyx_v_base); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":954 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3159,7 +3157,7 @@ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":955 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3171,7 +3169,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":957 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3180,7 +3178,7 @@ */ Py_INCREF(__pyx_v_base); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":958 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3191,7 +3189,7 @@ } __pyx_L3:; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":959 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3200,7 +3198,7 @@ */ Py_XDECREF(__pyx_v_arr->base); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":960 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3214,7 +3212,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 +/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":962 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3228,7 +3226,7 @@ __Pyx_RefNannySetupContext("get_array_base"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":963 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3238,7 +3236,7 @@ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":964 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3253,7 +3251,7 @@ } /*else*/ { - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":966 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3319,7 +3317,7 @@ {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__isscalar, __pyx_k__isscalar, sizeof(__pyx_k__isscalar), 0, 0, 1, 1}, + {&__pyx_n_s__isbuiltin, __pyx_k__isbuiltin, sizeof(__pyx_k__isbuiltin), 0, 0, 1, 1}, {&__pyx_n_s__item, __pyx_k__item, sizeof(__pyx_k__item), 0, 0, 1, 1}, {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, @@ -3426,7 +3424,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":5 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< @@ -3438,7 +3436,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/mb312/scipybuild/scipy/scipy/io/matlab/mio_utils.pyx":1 + /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":1 * # -*- python -*- like file # <<<<<<<<<<<<<< * ''' Utilities for generic processing of return arrays from read * ''' @@ -3462,7 +3460,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/home/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 + /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) Modified: trunk/scipy/io/matlab/mio_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio_utils.pyx 2010-05-27 21:31:25 UTC (rev 6417) +++ trunk/scipy/io/matlab/mio_utils.pyx 2010-05-28 03:40:26 UTC (rev 6418) @@ -22,7 +22,7 @@ if not arr.size: return np.array([]) arr = np.squeeze(arr) - if np.isscalar(arr): # 0d coverted to scalar + if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar return arr.item() return arr Modified: trunk/scipy/io/matlab/tests/test_mio_funcs.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-05-27 21:31:25 UTC (rev 6417) +++ trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-05-28 03:40:26 UTC (rev 6418) @@ -52,6 +52,8 @@ rdr.mat_stream.read(4) # presumably byte padding return read_minimat_vars(rdr) -# example -fname = pjoin(test_data_path, 'parabola.mat') -ws_vars = read_workspace_vars(fname) + +if __name__ == '__main__': + # example + fname = pjoin(test_data_path, 'parabola.mat') + ws_vars = read_workspace_vars(fname) Modified: trunk/scipy/io/matlab/tests/test_streams.py =================================================================== --- trunk/scipy/io/matlab/tests/test_streams.py 2010-05-27 21:31:25 UTC (rev 6417) +++ trunk/scipy/io/matlab/tests/test_streams.py 2010-05-28 03:40:26 UTC (rev 6418) @@ -33,7 +33,8 @@ def teardown(): - global fname + global fname, fs + del fs os.unlink(fname) From scipy-svn at scipy.org Sat May 29 00:10:13 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 28 May 2010 23:10:13 -0500 (CDT) Subject: [Scipy-svn] r6419 - trunk/scipy/io/matlab/tests Message-ID: <20100529041013.3660D39CAE6@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-28 23:10:13 -0500 (Fri, 28 May 2010) New Revision: 6419 Modified: trunk/scipy/io/matlab/tests/test_mio.py trunk/scipy/io/matlab/tests/test_mio_funcs.py Log: FIX - added b flags to matlab file open to placate windows Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-28 03:40:26 UTC (rev 6418) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 04:10:13 UTC (rev 6419) @@ -676,7 +676,7 @@ def test_empty_string(): # make sure reading empty string does not raise error estring_fname = pjoin(test_data_path, 'single_empty_string.mat') - rdr = MatFile5Reader_future(file(estring_fname)) + rdr = MatFile5Reader_future(file(estring_fname, 'rb')) d = rdr.get_variables() yield assert_array_equal, d['a'], np.array([], dtype='U1') # empty string round trip. Matlab cannot distiguish @@ -714,7 +714,7 @@ def test_func_read(): func_eg = pjoin(test_data_path, 'testfunc_7.4_GLNX86.mat') - rdr = MatFile5Reader_future(file(func_eg)) + rdr = MatFile5Reader_future(file(func_eg, 'rb')) d = rdr.get_variables() yield assert_true, isinstance(d['testfunc'], MatlabFunction) stream = StringIO() @@ -724,10 +724,10 @@ def test_mat_dtype(): double_eg = pjoin(test_data_path, 'testmatrix_6.1_SOL2.mat') - rdr = MatFile5Reader_future(file(double_eg), mat_dtype=False) + rdr = MatFile5Reader_future(file(double_eg, 'rb'), mat_dtype=False) d = rdr.get_variables() yield assert_equal, d['testmatrix'].dtype.kind, 'u' - rdr = MatFile5Reader_future(file(double_eg), mat_dtype=True) + rdr = MatFile5Reader_future(file(double_eg, 'rb'), mat_dtype=True) d = rdr.get_variables() yield assert_equal, d['testmatrix'].dtype.kind, 'f' Modified: trunk/scipy/io/matlab/tests/test_mio_funcs.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-05-28 03:40:26 UTC (rev 6418) +++ trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-05-29 04:10:13 UTC (rev 6419) @@ -39,7 +39,7 @@ return mdict def read_workspace_vars(fname): - rdr = MatFile5Reader(file(fname), + rdr = MatFile5Reader(file(fname, 'rb'), struct_as_record=True) vars = rdr.get_variables() fws = vars['__function_workspace__'] @@ -53,7 +53,7 @@ return read_minimat_vars(rdr) -if __name__ == '__main__': +def test_jottings(): # example fname = pjoin(test_data_path, 'parabola.mat') ws_vars = read_workspace_vars(fname) From scipy-svn at scipy.org Sat May 29 16:42:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 15:42:31 -0500 (CDT) Subject: [Scipy-svn] r6420 - trunk/scipy/stats Message-ID: <20100529204231.B2C7A39CAF2@scipy.org> Author: josef Date: 2010-05-29 15:42:31 -0500 (Sat, 29 May 2010) New Revision: 6420 Modified: trunk/scipy/stats/morestats.py Log: stats.morestats: deprecate broken pdfapprox, pdf_moments ticket: 171, ticket:173 Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-05-29 04:10:13 UTC (rev 6419) +++ trunk/scipy/stats/morestats.py 2010-05-29 20:42:31 UTC (rev 6420) @@ -1236,6 +1236,10 @@ plist[n] = plist[n-1].deriv() - poly1d([1,0])*plist[n-1] return plist + at np.lib.deprecate(message=""" +scipy.stats.pdf_moments is broken. It will be removed from scipy in 0.9 +unless it is fixed. +""") def pdf_moments(cnt): """Return the Gaussian expanded pdf function given the list of central moments (first one is mean). @@ -1291,6 +1295,10 @@ return totp(xn)*exp(-xn*xn/2.0) return thefunc + at np.lib.deprecate(message=""" +scipy.stats.pdfapprox is broken. It will be removed from scipy in 0.9 +unless it is fixed. +""") def pdfapprox(samples): """Return a function that approximates the pdf of a set of samples using a Gaussian expansion computed from the mean, variance, skewness From scipy-svn at scipy.org Sat May 29 17:10:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 16:10:24 -0500 (CDT) Subject: [Scipy-svn] r6421 - trunk/scipy/stats Message-ID: <20100529211024.1846039CAF2@scipy.org> Author: josef Date: 2010-05-29 16:10:23 -0500 (Sat, 29 May 2010) New Revision: 6421 Modified: trunk/scipy/stats/distributions.py Log: stats.distributions fix wrapcauchy._cdf IndexError ticket:1185 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 20:42:31 UTC (rev 6420) +++ trunk/scipy/stats/distributions.py 2010-05-29 21:10:23 UTC (rev 6421) @@ -3798,15 +3798,17 @@ c1 = x Author: josef Date: 2010-05-29 16:18:39 -0500 (Sat, 29 May 2010) New Revision: 6422 Modified: trunk/scipy/stats/distributions.py Log: stats add _logpdf _logcdf to distributions Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 21:10:23 UTC (rev 6421) +++ trunk/scipy/stats/distributions.py 2010-05-29 21:18:39 UTC (rev 6422) @@ -848,6 +848,12 @@ def _isf(self, q, *args): return self._ppf(1.0-q,*args) #use correct _ppf for subclasses + def _logpdf(self, x, *arg): + return np.log(self._pdf(x, *arg)) + + def _logcdf(self, x, *arg): + return np.log(self._cdf(x, *arg)) + # The actual cacluation functions (no basic checking need be done) # If these are defined, the others won't be looked at. # Otherwise, the other set can be defined. @@ -1393,6 +1399,8 @@ return 0.0, 1.0, 0.0, 0.0 def _entropy(self): return 0.5*(log(2*pi)+1) + def _logpdf(self, x): + return -0.5 * np.log(2.0*np.pi) - x**2/2.0 norm = norm_gen(name='norm',longname='A normal',extradoc=""" Normal distribution @@ -1857,6 +1865,8 @@ return 1.0, 1.0, 2.0, 6.0 def _entropy(self): return 1.0 + def _logpdf(self, x): + return -x expon = expon_gen(a=0.0,name='expon',longname="An exponential", extradoc=""" @@ -2069,6 +2079,8 @@ return special.gamma(1.0+n*1.0/c) def _entropy(self, c): return -_EULER / c - log(c) + _EULER + 1 + def _logpdf(self, x, c): + return log(c) + (c-1)*log(x) - np.power(x,c) frechet_r = frechet_r_gen(a=0.0,name='frechet_r',longname="A Frechet right", shapes='c',extradoc=""" @@ -2145,6 +2157,8 @@ g2 = pi**4/15.0 + 6*zeta(4,c) g2 /= mu2**2.0 return mu, mu2, g1, g2 + def _logpdf(self, x, c): + return log(c) - x - (c+1.0)*log1p(exp(-x)) genlogistic = genlogistic_gen(name='genlogistic', longname="A generalized logistic", shapes='c',extradoc=""" @@ -2180,6 +2194,9 @@ else: self.b = -1.0 / c return rv_continuous._entropy(self, c) + def _logpdf(self, x, c): + return (-1.0-1.0/c) * np.log1p(c*x) + genpareto = genpareto_gen(a=0.0,name='genpareto', longname="A generalized Pareto", shapes='c',extradoc=""" @@ -2198,6 +2215,8 @@ return (a+b*(-expm1(-c*x)))*exp((-a-b)*x+b*(-expm1(-c*x))/c) def _cdf(self, x, a, b, c): return -expm1((-a-b)*x + b*(-expm1(-c*x))/c) + def _logpdf(self, x, a, b, c): + return np.log(a+b*(-expm1(-c*x))) + (-a-b)*x+b*(-expm1(-c*x))/c genexpon = genexpon_gen(a=0.0,name='genexpon', longname='A generalized exponential', shapes='a, b, c',extradoc=""" @@ -2321,6 +2340,8 @@ return a, a, 2.0/sqrt(a), 6.0/a def _entropy(self, a): return special.psi(a)*(1-a) + 1 + special.gammaln(a) + def _logpdf(self, x, a): + return (a-1)*log(x) - x - special.gammaln(a) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', shapes='a',extradoc=""" @@ -2440,6 +2461,10 @@ 12*sqrt(6)/pi**3 * _ZETA3, 12.0/5 def _entropy(self): return 1.0608407169541684911 + def _logpdf(self, x): + return -x - exp(-x) + def _logcdf(self, x): + return -exp(-x) gumbel_r = gumbel_r_gen(name='gumbel_r',longname="A (right-skewed) Gumbel", extradoc=""" @@ -2461,6 +2486,8 @@ -12*sqrt(6)/pi**3 * _ZETA3, 12.0/5 def _entropy(self): return 1.0608407169541684911 + def _logpdf(self, x): + return x - exp(x) gumbel_l = gumbel_l_gen(name='gumbel_l',longname="A left-skewed Gumbel", extradoc=""" @@ -2483,6 +2510,8 @@ return inf, inf, nan, nan def _entropy(self): return log(2*pi) + def _logpdf(self, x): + return np.log(2.0/pi) - np.log1p(x*x) halfcauchy = halfcauchy_gen(a=0.0,name='halfcauchy', longname="A Half-Cauchy",extradoc=""" @@ -2540,6 +2569,8 @@ 8*(pi-3)/(pi-2)**2 def _entropy(self): return 0.5*log(pi/2.0)+0.5 + def _logpdf(self, x): + return 0.5 * np.log(2.0/pi) - x*x/2.0 halfnorm = halfnorm_gen(a=0.0, name='halfnorm', longname="A half-normal", extradoc=""" @@ -2614,6 +2645,8 @@ return exp(special.gammaln(a-n) - special.gammaln(a)) def _entropy(self, a): return a - (a+1.0)*special.psi(a) + special.gammaln(a) + def _logpdf(self, x, a): + return (-(a+1)*np.log(x)-special.gammaln(a) - 1.0/x) invgamma = invgamma_gen(a=0.0, name='invgamma',longname="An inverted gamma", shapes='a',extradoc=""" From scipy-svn at scipy.org Sat May 29 17:47:46 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 16:47:46 -0500 (CDT) Subject: [Scipy-svn] r6423 - in trunk/scipy/io/matlab: . tests Message-ID: <20100529214746.106AE39CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-29 16:47:45 -0500 (Sat, 29 May 2010) New Revision: 6423 Modified: trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/matlab/tests/test_mio.py Log: RF - removed basename kwarg Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-05-29 21:18:39 UTC (rev 6422) +++ trunk/scipy/io/matlab/mio.py 2010-05-29 21:47:45 UTC (rev 6423) @@ -62,7 +62,6 @@ ---------- %(file_arg)s %(append_arg)s - %(basename_arg)s %(load_args)s %(struct_arg)s @@ -86,12 +85,6 @@ except AttributeError: raise IOError, 'Reader needs file name or open file-like object' byte_stream = file_name - # Deal with deprecations - if kwargs.has_key('basename'): - warnings.warn( - 'basename argument will be removed in future scipy versions', - DeprecationWarning, stacklevel=2) - del kwargs['basename'] mjv, mnv = get_matfile_version(byte_stream) if mjv == 0: return MatFile4Reader(byte_stream, **kwargs) @@ -112,7 +105,6 @@ m_dict : dict, optional dictionary in which to insert matfile variables %(append_arg)s - %(basename_arg)s %(load_args)s %(struct_arg)s Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-29 21:18:39 UTC (rev 6422) +++ trunk/scipy/io/matlab/miobase.py 2010-05-29 21:47:45 UTC (rev 6423) @@ -25,11 +25,6 @@ '''appendmat : {True, False} optional True to append the .mat extension to the end of the given filename, if not already present''', - 'basename_arg': - '''base_name : string, optional, unused - base name for unnamed variables. The code no longer uses - this. We deprecate for this version of scipy, and will remove - it in future versions''', 'load_args': '''byte_order : {None, string}, optional None by default, implying byte order guessed from mat Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:18:39 UTC (rev 6422) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:47:45 UTC (rev 6423) @@ -363,10 +363,6 @@ yield assert_raises, FutureWarning, loadmat, fname # This too yield assert_raises, FutureWarning, find_mat_file, fname - # we need kwargs for this one - yield (lambda a, k: assert_raises(*a, **k), - (DeprecationWarning, loadmat, fname), - {'struct_as_record':True, 'basename':'raw'}) warnings.resetwarnings() From scipy-svn at scipy.org Sat May 29 17:47:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 16:47:52 -0500 (CDT) Subject: [Scipy-svn] r6424 - trunk/scipy/io/matlab Message-ID: <20100529214752.7EDCE39CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-29 16:47:52 -0500 (Sat, 29 May 2010) New Revision: 6424 Modified: trunk/scipy/io/matlab/miobase.py Log: RF - remove deprecated ByteOrder class Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-29 21:47:45 UTC (rev 6423) +++ trunk/scipy/io/matlab/miobase.py 2010-05-29 21:47:52 UTC (rev 6424) @@ -296,20 +296,6 @@ return shape -class ByteOrder(object): - ''' Namespace for byte ordering ''' - little_endian = boc.sys_is_le - native_code = boc.native_code - swapped_code = boc.swapped_code - to_numpy_code = boc.to_numpy_code - -ByteOrder = np.deprecate(ByteOrder, message=""" -We no longer use the ByteOrder class, and deprecate it; we will remove -it in future versions of scipy. Please use the -scipy.io.matlab.byteordercodes module instead. -""") - - class MatVarReader(object): ''' Abstract class defining required interface for var readers''' def __init__(self, file_reader): @@ -374,7 +360,7 @@ def guess_byte_order(self): ''' As we do not know what file type we have, assume native ''' - return ByteOrder.native_code + return boc.native_code def end_of_stream(self): b = self.mat_stream.read(1) From scipy-svn at scipy.org Sat May 29 17:48:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 16:48:01 -0500 (CDT) Subject: [Scipy-svn] r6425 - in trunk/scipy/io/matlab: . tests Message-ID: <20100529214801.4360F39CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-29 16:48:01 -0500 (Sat, 29 May 2010) New Revision: 6425 Modified: trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/matlab/tests/test_mio.py Log: RF - deprecation warning about searching system path Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-05-29 21:47:52 UTC (rev 6424) +++ trunk/scipy/io/matlab/mio.py 2010-05-29 21:48:01 UTC (rev 6425) @@ -30,8 +30,8 @@ possibly modified name after path search ''' warnings.warn('Searching for mat files on python system path will be ' + - 'removed in future versions of scipy', - FutureWarning, stacklevel=2) + 'removed in next version of scipy', + DeprecationWarning, stacklevel=2) if appendmat and file_name.endswith(".mat"): file_name = file_name[:-4] if os.sep in file_name: @@ -54,6 +54,33 @@ pass return full_name + +def _open_file(file_like, appendmat): + ''' Open `file_like` and return as file-like object ''' + if isinstance(file_like, basestring): + try: + return open(file_like, 'rb') + except IOError: + pass + if appendmat and not file_like.endswith('.mat'): + try: + return open(file_like + '.mat', 'rb') + except IOError: + pass + # search the python path - we'll remove this soon + full_name = find_mat_file(file_like, appendmat) + if full_name is None: + raise IOError("%s not found on the path." + % file_like) + return open(full_name, 'rb') + # not a string - maybe file-like object + try: + file_like.read(0) + except AttributeError: + raise IOError('Reader needs file name or open file-like object') + return file_like + + @docfiller def mat_reader_factory(file_name, appendmat=True, **kwargs): """Create reader for matlab .mat format files @@ -71,20 +98,7 @@ Initialized instance of MatFileReader class matching the mat file type detected in `filename`. """ - if isinstance(file_name, basestring): - try: - byte_stream = open(file_name, 'rb') - except IOError: - full_name = find_mat_file(file_name, appendmat) - if full_name is None: - raise IOError, "%s not found on the path." % file_name - byte_stream = open(full_name, 'rb') - else: - try: - file_name.read(0) - except AttributeError: - raise IOError, 'Reader needs file name or open file-like object' - byte_stream = file_name + byte_stream = _open_file(file_name, appendmat) mjv, mnv = get_matfile_version(byte_stream) if mjv == 0: return MatFile4Reader(byte_stream, **kwargs) Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-29 21:47:52 UTC (rev 6424) +++ trunk/scipy/io/matlab/miobase.py 2010-05-29 21:48:01 UTC (rev 6425) @@ -17,10 +17,7 @@ {'file_arg': '''file_name : string Name of the mat file (do not need .mat extension if - appendmat==True) If name not a full path name, search for the - file on the sys.path list and use the first one found (the - current directory is searched first). Can also pass open - file-like object''', + appendmat==True) Can also pass open file-like object''', 'append_arg': '''appendmat : {True, False} optional True to append the .mat extension to the end of the given Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:47:52 UTC (rev 6424) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:48:01 UTC (rev 6425) @@ -362,7 +362,7 @@ # This should yield assert_raises, FutureWarning, loadmat, fname # This too - yield assert_raises, FutureWarning, find_mat_file, fname + yield assert_raises, DeprecationWarning, find_mat_file, fname warnings.resetwarnings() From scipy-svn at scipy.org Sat May 29 17:48:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 16:48:08 -0500 (CDT) Subject: [Scipy-svn] r6426 - in trunk/scipy/io/matlab: . tests Message-ID: <20100529214808.3251239CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-29 16:48:08 -0500 (Sat, 29 May 2010) New Revision: 6426 Modified: trunk/scipy/io/matlab/mio4.py trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/matlab/tests/test_mio.py Log: RF - move to struct_as_record default of True Modified: trunk/scipy/io/matlab/mio4.py =================================================================== --- trunk/scipy/io/matlab/mio4.py 2010-05-29 21:48:01 UTC (rev 6425) +++ trunk/scipy/io/matlab/mio4.py 2010-05-29 21:48:08 UTC (rev 6426) @@ -332,7 +332,7 @@ dims = matdims(arr, oned_as) if len(dims) > 2: warnings.warn('Matlab 4 files only support <=2 ' - 'dimensions; future versions of scipy will ' + 'dimensions; the next version of scipy will ' 'raise an error when trying to write >2D arrays ' 'to matlab 4 format files', DeprecationWarning, Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-05-29 21:48:01 UTC (rev 6425) +++ trunk/scipy/io/matlab/mio5.py 2010-05-29 21:48:08 UTC (rev 6426) @@ -252,7 +252,7 @@ squeeze_me=False, chars_as_strings=True, matlab_compatible=False, - struct_as_record=None, # default False, for now + struct_as_record=True, uint16_codec=None ): '''Initializer for matlab 5 file format reader @@ -264,12 +264,6 @@ Set codec to use for uint16 char arrays (e.g. 'utf-8'). Use system default codec if None ''' - # Deal with deprecations - if struct_as_record is None: - warnings.warn("Using struct_as_record default value (False)" + - " This will change to True in future versions", - FutureWarning, stacklevel=2) - struct_as_record = False super(MatFile5Reader, self).__init__( mat_stream, byte_order, Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-05-29 21:48:01 UTC (rev 6425) +++ trunk/scipy/io/matlab/miobase.py 2010-05-29 21:48:08 UTC (rev 6426) @@ -39,16 +39,12 @@ squeeze_me=False, chars_as_strings=False, mat_dtype=True, struct_as_record=True)''', 'struct_arg': - '''struct_as_record : {False, True} optional + '''struct_as_record : {True, False} optional Whether to load matlab structs as numpy record arrays, or as old-style numpy arrays with dtype=object. Setting this flag to - False replicates the behaviour of scipy version 0.6 (returning - numpy object arrays). The preferred setting is True, because it - allows easier round-trip load and save of matlab files. In a - future version of scipy, we will change the default setting to - True, and following versions may remove this flag entirely. For - now, we set the default to False, for backwards compatibility, but - issue a warning.''', + False replicates the behaviour of scipy version 0.7.x (returning + numpy object arrays). The default setting is True, because it + allows easier round-trip load and save of matlab files.''', 'matstream_arg': '''mat_stream : file-like object with file API, open for reading''', @@ -324,7 +320,7 @@ squeeze_me=False, chars_as_strings=True, matlab_compatible=False, - struct_as_record=None + struct_as_record=True ): ''' Initializer for mat file reader Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:48:01 UTC (rev 6425) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-05-29 21:48:08 UTC (rev 6426) @@ -34,7 +34,6 @@ MatFile5Reader, MatlabFunction # Use future defaults to silence unwanted test warnings -loadmat_future = partial(loadmat, struct_as_record=True) savemat_future = partial(savemat, oned_as='row') class MatFile5Reader_future(MatFile5Reader): def __init__(self, *args, **kwargs): @@ -276,7 +275,7 @@ def _load_check_case(name, files, case): for file_name in files: - matdict = loadmat_future(file_name, struct_as_record=True) + matdict = loadmat(file_name, struct_as_record=True) label = "test %s; file %s" % (name, file_name) for k, expected in case.items(): k_label = "%s, variable %s" % (label, k) @@ -331,7 +330,7 @@ mat_stream.close() mat_stream = gzip.open( fname,mode='rb') - actual = loadmat_future(mat_stream, struct_as_record=True) + actual = loadmat(mat_stream, struct_as_record=True) mat_stream.close() finally: shutil.rmtree(tmpdir) @@ -347,7 +346,7 @@ assert_true(len(filenames)>0) for filename in filenames: assert_raises(NotImplementedError, - loadmat_future, + loadmat, filename, struct_as_record=True) @@ -359,9 +358,7 @@ mres = loadmat(fname, struct_as_record=True) # This neither mres = loadmat(fname, struct_as_record=False) - # This should - yield assert_raises, FutureWarning, loadmat, fname - # This too + # This should - because of deprecated system path search yield assert_raises, DeprecationWarning, find_mat_file, fname warnings.resetwarnings() @@ -476,7 +473,7 @@ stream = StringIO() savemat_future(stream, {'dict':d}) stream.seek(0) - vals = loadmat_future(stream) + vals = loadmat(stream) def test_1d_shape(): @@ -486,12 +483,12 @@ # silence warnings for tests warnings.simplefilter('ignore') savemat(stream, {'oned':arr}, format='5') - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_equal, vals['oned'].shape, (5,1) # Current 4 behavior is 1D -> row vector stream = StringIO() savemat(stream, {'oned':arr}, format='4') - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_equal, vals['oned'].shape, (1, 5) for format in ('4', '5'): # can be explicitly 'column' for oned_as @@ -499,14 +496,14 @@ savemat(stream, {'oned':arr}, format=format, oned_as='column') - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_equal, vals['oned'].shape, (5,1) # but different from 'row' stream = StringIO() savemat(stream, {'oned':arr}, format=format, oned_as='row') - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_equal, vals['oned'].shape, (1,5) warnings.resetwarnings() @@ -517,12 +514,12 @@ stream = StringIO() savemat_future(stream, {'arr':arr}) raw_len = len(stream.getvalue()) - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_array_equal, vals['arr'], arr stream = StringIO() savemat_future(stream, {'arr':arr}, do_compression=True) compressed_len = len(stream.getvalue()) - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_array_equal, vals['arr'], arr yield assert_true, raw_len>compressed_len # Concatenate, test later @@ -530,11 +527,11 @@ arr2[0,0] = 1 stream = StringIO() savemat_future(stream, {'arr':arr, 'arr2':arr2}, do_compression=False) - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_array_equal, vals['arr2'], arr2 stream = StringIO() savemat_future(stream, {'arr':arr, 'arr2':arr2}, do_compression=True) - vals = loadmat_future(stream) + vals = loadmat(stream) yield assert_array_equal, vals['arr2'], arr2 @@ -556,9 +553,9 @@ # filename = pjoin(test_data_path,'test_skip_variable.mat') # - # Prove that it loads with loadmat_future + # Prove that it loads with loadmat # - d = loadmat_future(filename, struct_as_record=True) + d = loadmat(filename, struct_as_record=True) yield assert_true, d.has_key('first') yield assert_true, d.has_key('second') # @@ -577,7 +574,7 @@ filename = pjoin(test_data_path,'test_empty_struct.mat') # before ticket fix, this would crash with ValueError, empty data # type - d = loadmat_future(filename, struct_as_record=True) + d = loadmat(filename, struct_as_record=True) a = d['a'] yield assert_equal, a.shape, (1,1) yield assert_equal, a.dtype, np.dtype(np.object) @@ -586,7 +583,7 @@ arr = np.array((), dtype='U') # before ticket fix, this used to give data type not understood savemat_future(stream, {'arr':arr}) - d = loadmat_future(stream) + d = loadmat(stream) a2 = d['arr'] yield assert_array_equal, a2, arr @@ -602,11 +599,11 @@ arr[1]['f2'] = 'not perl' stream = StringIO() savemat_future(stream, {'arr': arr}) - d = loadmat_future(stream, struct_as_record=False) + d = loadmat(stream, struct_as_record=False) a20 = d['arr'][0,0] yield assert_equal, a20.f1, 0.5 yield assert_equal, a20.f2, 'python' - d = loadmat_future(stream, struct_as_record=True) + d = loadmat(stream, struct_as_record=True) a20 = d['arr'][0,0] yield assert_equal, a20['f1'], 0.5 yield assert_equal, a20['f2'], 'python' @@ -625,11 +622,11 @@ c.field2 = 'a string' stream = StringIO() savemat_future(stream, {'c': c}) - d = loadmat_future(stream, struct_as_record=False) + d = loadmat(stream, struct_as_record=False) c2 = d['c'][0,0] yield assert_equal, c2.field1, 1 yield assert_equal, c2.field2, 'a string' - d = loadmat_future(stream, struct_as_record=True) + d = loadmat(stream, struct_as_record=True) c2 = d['c'][0,0] yield assert_equal, c2['field1'], 1 yield assert_equal, c2['field2'], 'a string' @@ -704,7 +701,7 @@ warnings.simplefilter('ignore') savemat_future(stream, {'a': arr}, format='4') warnings.resetwarnings() - d = loadmat_future(stream) + d = loadmat(stream) yield assert_array_equal, d['a'], arr.reshape((6,4)) @@ -734,7 +731,7 @@ st = {'sparsefield': SP.coo_matrix(np.eye(4))} stream = StringIO() savemat_future(stream, {'a':st}) - d = loadmat_future(stream, struct_as_record=True) + d = loadmat(stream, struct_as_record=True) yield assert_array_equal, d['a'][0,0]['sparsefield'].todense(), np.eye(4) @@ -743,9 +740,9 @@ in_d = {'st':{'one':1, 'two':2}} savemat_future(stream, in_d) # no error without squeeze - out_d = loadmat_future(stream, struct_as_record=False) + out_d = loadmat(stream, struct_as_record=False) # previous error was with squeeze, with mat_struct - out_d = loadmat_future(stream, + out_d = loadmat(stream, struct_as_record=False, squeeze_me=True, ) @@ -757,7 +754,7 @@ in_arr = np.array(['Hello', 'Foob']) out_arr = np.array(['Hello', 'Foob ']) savemat_future(stream, dict(a=in_arr)) - res = loadmat_future(stream) + res = loadmat(stream) # resulted in [u'HloolFoa', u'elWrdobr'] yield assert_array_equal, res['a'], out_arr stream.truncate(0) @@ -774,6 +771,6 @@ in_arr_u = in_arr.astype('U') out_arr_u = out_arr.astype('U') savemat_future(stream, {'a': in_arr_u}) - res = loadmat_future(stream) + res = loadmat(stream) yield assert_array_equal, res['a'], out_arr_u From scipy-svn at scipy.org Sat May 29 18:58:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 17:58:41 -0500 (CDT) Subject: [Scipy-svn] r6427 - trunk/scipy/stats Message-ID: <20100529225841.EBBDA39CAED@scipy.org> Author: oliphant Date: 2010-05-29 17:58:41 -0500 (Sat, 29 May 2010) New Revision: 6427 Modified: trunk/scipy/stats/distributions.py Log: Add logpdf, logpmf, logcdf, logsf, and _fitstart methods to distributions. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 21:48:08 UTC (rev 6426) +++ trunk/scipy/stats/distributions.py 2010-05-29 22:58:41 UTC (rev 6427) @@ -1,7 +1,8 @@ # Functions to implement several important functions for # various Continous and Discrete Probability Distributions # -# Author: Travis Oliphant 2002-2003 +# Author: Travis Oliphant 2002-2003 with contributions from +# SciPy Developers 2004-2010 # import scipy @@ -11,13 +12,13 @@ import scipy.integrate import inspect -from numpy import alltrue, where, arange, put, putmask, \ +from numpy import alltrue, where, arange, putmask, \ ravel, take, ones, sum, shape, product, repeat, reshape, \ zeros, floor, logical_and, log, sqrt, exp, arctanh, tan, sin, arcsin, \ arctan, tanh, ndarray, cos, cosh, sinh, newaxis, array, log1p, expm1 -from numpy import atleast_1d, polyval, angle, ceil, place, extract, \ - any, argsort, argmax, vectorize, r_, asarray, nan, inf, pi, isnan, isinf, \ - power +from numpy import atleast_1d, polyval, ceil, place, extract, \ + any, argsort, argmax, vectorize, r_, asarray, nan, inf, pi, isinf, \ + power, NINF, empty import numpy import numpy as np import numpy.random as mtrand @@ -56,7 +57,6 @@ errp = special.errprint arr = asarray gam = special.gamma -lgam = special.gammaln import types import stats as st @@ -370,8 +370,11 @@ ## ## rvs -- Random Variates (alternatively calling the class could produce these) ## pdf -- PDF +## logpdf -- log PDF (more numerically accurate if possible) ## cdf -- CDF +## logcdf -- log of CDF ## sf -- Survival Function (1-CDF) +## logsf --- log of SF ## ppf -- Percent Point Function (Inverse of CDF) ## isf -- Inverse Survival Function (Inverse of SF) ## stats -- Return mean, variance, (Fisher's) skew, or (Fisher's) kurtosis @@ -401,7 +404,7 @@ ## ## _cdf, _ppf, _rvs, _isf, _sf ## -## Rarely would you override _isf and _sf but you could. +## Rarely would you override _isf and _sf but you could for numerical precision. ## ## Statistics are computed using numerical integration by default. ## For speed you can redefine this using @@ -430,7 +433,7 @@ if typecode is not None: out = out.astype(typecode) if not isinstance(out, ndarray): - out = asarray(out) + out = arr(out) return out # This should be rewritten @@ -582,9 +585,9 @@ Returns ------- a, b: array-like (float) - end-points of range that contain alpha % of the rvs + end-points of range that contain alpha % of the rvs """ - alpha = asarray(alpha) + alpha = arr(alpha) if any((alpha > 1) | (alpha < 0)): raise ValueError, "alpha must be between 0 and 1 inclusive" q1 = (1.0-alpha)/2 @@ -826,7 +829,11 @@ def _pdf(self,x,*args): return derivative(self._cdf,x,dx=1e-5,args=args,order=5) - ## Could also define any of these (return 1-d using self._size to get number) + ## Could also define any of these + def _logpdf(self, x, *args): + return log(self._pdf(x, *args)) + + ##(return 1-d using self._size to get number) def _rvs(self, *args): ## Use basic inverse cdf algorithm for RV generation as default. U = mtrand.sample(self._size) @@ -839,9 +846,15 @@ def _cdf(self, x, *args): return self.veccdf(x,*args) + def _logcdf(self, x, *args): + return log(self._cdf(x, *args)) + def _sf(self, x, *args): return 1.0-self._cdf(x,*args) + def _logsf(self, x, *args): + return log(self._sf(x, *args)) + def _ppf(self, q, *args): return self.vecfunc(q,*args) @@ -858,7 +871,6 @@ # If these are defined, the others won't be looked at. # Otherwise, the other set can be defined. def _stats(self,*args, **kwds): - moments = kwds.get('moments') return None, None, None, None # Central moments @@ -904,6 +916,49 @@ return output[()] return output + def logpdf(self, x, *args, **kwds): + """ + Log of the probability density function at x of the given RV. + + This uses more numerically accurate calculation if available. + + Parameters + ---------- + x : array-like + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + logpdf : array-like + Log of the probability density function evaluated at x + + """ + loc,scale=map(kwds.get,['loc','scale']) + args, loc, scale = self._fix_loc_scale(args, loc, scale) + x,loc,scale = map(arr,(x,loc,scale)) + args = tuple(map(arr,args)) + x = arr((x-loc)*1.0/scale) + cond0 = self._argcheck(*args) & (scale > 0) + cond1 = (scale > 0) & (x >= self.a) & (x <= self.b) + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) + goodargs = argsreduce(cond, *((x,)+args+(scale,))) + scale, goodargs = goodargs[-1], goodargs[:-1] + place(output,cond,self._logpdf(*goodargs) - log(scale)) + if output.ndim == 0: + return output[()] + return output + + def cdf(self,x,*args,**kwds): """ Cumulative distribution function at x of the given RV. @@ -945,6 +1000,48 @@ return output[()] return output + def logcdf(self,x,*args,**kwds): + """ + Log of the cumulative distribution function at x of the given RV. + + Parameters + ---------- + x : array-like + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + logcdf : array-like + Log of the cumulative distribution function evaluated at x + + """ + loc,scale=map(kwds.get,['loc','scale']) + args, loc, scale = self._fix_loc_scale(args, loc, scale) + x,loc,scale = map(arr,(x,loc,scale)) + args = tuple(map(arr,args)) + x = (x-loc)*1.0/scale + cond0 = self._argcheck(*args) & (scale > 0) + cond1 = (scale > 0) & (x > self.a) & (x < self.b) + cond2 = (x >= self.b) & cond0 + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + place(output,(1-cond0)*(cond1==cond1),self.badvalue) + place(output,cond2,0.0) + if any(cond): #call only if at least 1 entry + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._logcdf(*goodargs)) + if output.ndim == 0: + return output[()] + return output + def sf(self,x,*args,**kwds): """ Survival function (1-cdf) at x of the given RV. @@ -985,6 +1082,46 @@ return output[()] return output + def logsf(self,x,*args,**kwds): + """ + Log of the Survival function log(1-cdf) at x of the given RV. + + Parameters + ---------- + x : array-like + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + logsf : array-like + Log of the survival function evaluated at x + """ + loc,scale=map(kwds.get,['loc','scale']) + args, loc, scale = self._fix_loc_scale(args, loc, scale) + x,loc,scale = map(arr,(x,loc,scale)) + args = tuple(map(arr,args)) + x = (x-loc)*1.0/scale + cond0 = self._argcheck(*args) & (scale > 0) + cond1 = (scale > 0) & (x > self.a) & (x < self.b) + cond2 = cond0 & (x <= self.a) + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + place(output,(1-cond0)*(cond1==cond1),self.badvalue) + place(output,cond2,0.0) + goodargs = argsreduce(cond, *((x,)+args)) + place(output,cond,self._logsf(*goodargs)) + if output.ndim == 0: + return output[()] + return output + def ppf(self,q,*args,**kwds): """ Percent point function (inverse of cdf) at q of the given RV. @@ -1239,7 +1376,7 @@ return self._munp(n,*args) def _nnlf(self, x, *args): - return -sum(log(self._pdf(x, *args)),axis=0) + return -sum(self._logpdf(x, *args),axis=0) def nnlf(self, theta, x): # - sum (log pdf(x, theta),axis=0) @@ -1261,19 +1398,42 @@ N = len(x) return self._nnlf(x, *args) + N*log(scale) + def _fitstart(self, data): + return (1.0,)*self.numargs + def fit(self, data, *args, **kwds): - loc0, scale0 = map(kwds.get, ['loc', 'scale'],[0.0, 1.0]) + """ + Return max like estimators to shape, location, and scale from data + + Starting points for the fit are given by input arguments. For any + arguments not given starting points, self._fitstart(data) is called + to get the starting estimates. + + Parameters + ---------- + data : array-like + Data to use in calculating the MLE + args : optional + Starting values for any shape arguments + kwds : loc, scale + Starting values for the location and scale parameters + + Return + ------ + shape, loc, scale : tuple of float + MLE estimates for any shape arguments followed by location and scale + """ Narg = len(args) - if Narg != self.numargs: - if Narg > self.numargs: + if Narg > self.numargs: raise ValueError, "Too many input arguments." - else: - args += (1.0,)*(self.numargs-Narg) + if (Narg < self.numargs): + start = self._fitstart(data) # get distribution specific starting locations + args += start[Narg:] # location and scale are at the end - x0 = args + (loc0, scale0) + x0 = args + map(kwds.get, ['loc', 'scale'], self.fit_loc_scale(data)) return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0) - def est_loc_scale(self, data, *args): + def fit_loc_scale(self, data, *args): mu, mu2 = self.stats(*args,**{'moments':'mv'}) muhat = st.nanmean(data) mu2hat = st.nanstd(data) @@ -1281,6 +1441,11 @@ Lhat = muhat - Shat*mu return Lhat, Shat + @np.deprecate + def est_loc_scale(self, data, *args): + """This function is deprecated, use self.fit_loc_scale(data) instead. """ + return self.fit_loc_scale(data, *args) + def freeze(self,*args,**kwds): return rv_frozen(self,*args,**kwds) @@ -1376,10 +1541,17 @@ # loc = mu, scale = std # Keep these implementations out of the class definition so they can be reused # by other distributions. +import math +_norm_pdf_C = math.sqrt(2*pi) +_norm_pdf_logC = math.log(_norm_pdf_C) def _norm_pdf(x): - return 1.0/sqrt(2*pi)*exp(-x**2/2.0) + return exp(-x**2/2.0) / _norm_pdf_C +def _norm_logpdf(x): + return -x**2 / 2.0 - _norm_pdf_logC def _norm_cdf(x): return special.ndtr(x) +def _norm_logcdf(x): + return log(special.ndtr(x)) def _norm_ppf(q): return special.ndtri(q) class norm_gen(rv_continuous): @@ -1387,10 +1559,16 @@ return mtrand.standard_normal(self._size) def _pdf(self,x): return _norm_pdf(x) + def _logpdf(self, x): + return _norm_logpdf(x) def _cdf(self,x): return _norm_cdf(x) + def _logcdf(self, x): + return _norm_logcdf(x) def _sf(self, x): return _norm_cdf(-x) + def _logsf(self, x): + return _norm_logcdf(-x) def _ppf(self,q): return _norm_ppf(q) def _isf(self,q): @@ -1399,8 +1577,7 @@ return 0.0, 1.0, 0.0, 0.0 def _entropy(self): return 0.5*(log(2*pi)+1) - def _logpdf(self, x): - return -0.5 * np.log(2.0*np.pi) - x**2/2.0 + return arr(data).mean(), arr(data).std(ddof=0) norm = norm_gen(name='norm',longname='A normal',extradoc=""" Normal distribution @@ -1416,7 +1593,9 @@ ## class alpha_gen(rv_continuous): def _pdf(self, x, a): - return 1.0/arr(x**2)/special.ndtr(a)*norm.pdf(a-1.0/x) + return 1.0/(x**2)/special.ndtr(a)*_norm_pdf(a-1.0/x) + def _logpdf(self, x, a): + return -2*log(x) + _norm_logpdf(a-1.0/x) - log(special.ndtr(a)) def _cdf(self, x, a): return special.ndtr(a-1.0/x) / special.ndtr(a) def _ppf(self, q, a): @@ -1462,7 +1641,7 @@ def _ppf(self, q): return sin(pi/2.0*q)**2.0 def _stats(self): - mup = 0.5, 3.0/8.0, 15.0/48.0, 35.0/128.0 + #mup = 0.5, 3.0/8.0, 15.0/48.0, 35.0/128.0 mu = 0.5 mu2 = 1.0/8 g1 = 0 @@ -1488,6 +1667,10 @@ Px = (1.0-x)**(b-1.0) * x**(a-1.0) Px /= special.beta(a,b) return Px + def _logpdf(self, x, a, b): + lPx = (b-1.0)*log(1.0-x) + (a-1.0)*log(x) + lPx -= log(special.beta(a,b)) + return lPx def _cdf(self, x, a, b): return special.btdtr(a,b,x) def _ppf(self, q, a, b): @@ -1515,6 +1698,8 @@ return (u1 / u2) def _pdf(self, x, a, b): return 1.0/special.beta(a,b)*x**(a-1.0)/(1+x)**(a+b) + def _logpdf(self, x, a, b): + return (a-1.0)*log(x) - (a+b)*log(1+x) - log(special.beta(a,b)) def _cdf_skip(self, x, a, b): # remove for now: special.hyp2f1 is incorrect for large a x = where(x==1.0, 1.0-1e-6,x) @@ -1710,10 +1895,12 @@ def _rvs(self, df): return mtrand.chisquare(df,self._size) def _pdf(self, x, df): - return exp((df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2.) + return exp(self._logpdf(x, df)) + def _logpdf(self, x, df): + return (df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2. ## Px = x**(df/2.0-1)*exp(-x/2.0) ## Px /= special.gamma(df/2.0)* 2**(df/2.0) -## return Px +## return log(Px) def _cdf(self, x, df): return special.chdtr(df, x) def _sf(self, x, df): @@ -1763,6 +1950,9 @@ def _pdf(self, x, a): ax = abs(x) return 1.0/(2*special.gamma(a))*ax**(a-1.0) * exp(-ax) + def _logpdf(self, x, a): + ax = abs(x) + return (a-1.0)*log(ax) - ax - log(2) - gamln(a) def _cdf(self, x, a): fac = 0.5*special.gammainc(a,abs(x)) return where(x>0,0.5+fac,0.5-fac) @@ -1796,6 +1986,9 @@ ax = abs(x) Px = c/2.0*ax**(c-1.0)*exp(-ax**c) return Px + def _logpdf(self, x, c): + ax = abs(x) + return log(c) - log(2.0) + (c-1.0)*log(ax) - ax**c def _cdf(self, x, c): Cx1 = 0.5*exp(-abs(x)**c) return where(x > 0, 1-Cx1, Cx1) @@ -1827,6 +2020,8 @@ def _pdf(self, x, n): Px = (x)**(n-1.0)*exp(-x)/special.gamma(n) return Px + def _logpdf(self, x, n): + return (n-1.0)*log(x) - x - gamln(n) def _cdf(self, x, n): return special.gdtr(1.0,n,x) def _sf(self, x, n): @@ -1837,7 +2032,7 @@ n = n*1.0 return n, n, 2/sqrt(n), 6/n def _entropy(self, n): - return special.psi(n)*(1-n) + 1 + special.gammaln(n) + return special.psi(n)*(1-n) + 1 + gamln(n) erlang = erlang_gen(a=0.0,name='erlang',longname='An Erlang', shapes='n',extradoc=""" @@ -1853,12 +2048,16 @@ return mtrand.standard_exponential(self._size) def _pdf(self, x): return exp(-x) + def _logpdf(self, x): + return -x def _cdf(self, x): return -expm1(-x) def _ppf(self, q): return -log1p(-q) def _sf(self,x): return exp(-x) + def _logsf(self, x): + return -x def _isf(self,q): return -log(q) def _stats(self): @@ -1884,7 +2083,10 @@ class exponweib_gen(rv_continuous): def _pdf(self, x, a, c): exc = exp(-x**c) - return a*c*(1-exc)**arr(a-1) * exc * x**arr(c-1) + return a*c*(1-exc)**arr(a-1) * exc * x**(c-1) + def _logpdf(self, x, a, c): + exc = exp(-x**c) + return log(a) + log(c) + (a-1.)*log(1-exc) - x**c + (c-1.0)*log(x) def _cdf(self, x, a, c): exm1c = -expm1(-x**c) return arr((exm1c)**a) @@ -1908,6 +2110,9 @@ xbm1 = arr(x**(b-1.0)) xb = xbm1 * x return exp(1)*b*xbm1 * exp(xb - exp(xb)) + def _logpdf(self, x, b): + xb = x**(b-1.0)*x + return log(b) + (b-1.0)*log(x) + xb - exp(xb) def _cdf(self, x, b): xb = arr(x**b) return -expm1(-expm1(xb)) @@ -1938,6 +2143,8 @@ return t def _pdf(self, x, c): return (x+1)/arr(2*c*sqrt(2*pi*x**3))*exp(-(x-1)**2/arr((2.0*x*c**2))) + def _logpdf(self, x, c): + return log(x+1) - (x-1)**2 / (2.0*x*c**2) - log(2*c) - 0.5*(log(2*pi) + 3*log(x)) def _cdf(self, x, c): return special.ndtr(1.0/c*(sqrt(x)-1.0/arr(sqrt(x)))) def _ppf(self, q, c): @@ -1991,11 +2198,17 @@ def _rvs(self, dfn, dfd): return mtrand.f(dfn, dfd, self._size) def _pdf(self, x, dfn, dfd): - n = arr(1.0*dfn) - m = arr(1.0*dfd) - Px = m**(m/2) * n**(n/2) * x**(n/2-1) - Px /= (m+n*x)**((n+m)/2)*special.beta(n/2,m/2) - return Px +# n = arr(1.0*dfn) +# m = arr(1.0*dfd) +# Px = m**(m/2) * n**(n/2) * x**(n/2-1) +# Px /= (m+n*x)**((n+m)/2)*special.beta(n/2,m/2) + return exp(self._logpdf(x, dfn, dfd)) + def _logpdf(self, x, dfn, dfd): + n = 1.0*dfn + m = 1.0*dfd + lPx = m/2 * log(m) + n/2 * log(n) + (n/2-1)*log(x) + lPx -= (n+m)/2*log(m+n*x) - special.betaln(n/2,m/2) + return lPx def _cdf(self, x, dfn, dfd): return special.fdtr(dfn, dfd, x) def _sf(self, x, dfn, dfd): @@ -2332,6 +2545,8 @@ return mtrand.standard_gamma(a, self._size) def _pdf(self, x, a): return x**(a-1)*exp(-x)/special.gamma(a) + def _logpdf(self, x, a): + return (a-1)*log(x) - x - gamln(a) def _cdf(self, x, a): return special.gammainc(a, x) def _ppf(self, q, a): @@ -2339,7 +2554,10 @@ def _stats(self, a): return a, a, 2.0/sqrt(a), 6.0/a def _entropy(self, a): - return special.psi(a)*(1-a) + 1 + special.gammaln(a) + return special.psi(a)*(1-a) + 1 + gamln(a) + def _fitstart(self, x): + from distributions import skew + return (4 / skew(x)**2,) def _logpdf(self, x, a): return (a-1)*log(x) - x - special.gammaln(a) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', @@ -2360,7 +2578,7 @@ def _argcheck(self, a, c): return (a > 0) & (c != 0) def _pdf(self, x, a, c): - return abs(c)* exp((c*a-1)*log(x)-x**c- special.gammaln(a)) + return abs(c)* exp((c*a-1)*log(x)-x**c- gamln(a)) def _cdf(self, x, a, c): val = special.gammainc(a,x**c) cond = c + 0*val @@ -2375,7 +2593,7 @@ return special.gamma(a+n*1.0/c) / special.gamma(a) def _entropy(self, a,c): val = special.psi(a) - return a*(1-val) + 1.0/c*val + special.gammaln(a)-log(abs(c)) + return a*(1-val) + 1.0/c*val + gamln(a)-log(abs(c)) gengamma = gengamma_gen(a=0.0, name='gengamma', longname='A generalized gamma', shapes="a, c", extradoc=""" @@ -2636,15 +2854,15 @@ class invgamma_gen(rv_continuous): def _pdf(self, x, a): - return exp(-(a+1)*log(x)-special.gammaln(a) - 1.0/x) + return exp(-(a+1)*log(x)-gamln(a) - 1.0/x) def _cdf(self, x, a): return 1.0-special.gammainc(a, 1.0/x) def _ppf(self, q, a): return 1.0/special.gammaincinv(a,1-q) def _munp(self, n, a): - return exp(special.gammaln(a-n) - special.gammaln(a)) + return exp(gamln(a-n) - gamln(a)) def _entropy(self, a): - return a - (a+1.0)*special.psi(a) + special.gammaln(a) + return a - (a+1.0)*special.psi(a) + gamln(a) def _logpdf(self, x, a): return (-(a+1)*np.log(x)-special.gammaln(a) - 1.0/x) invgamma = invgamma_gen(a=0.0, name='invgamma',longname="An inverted gamma", @@ -2901,7 +3119,7 @@ def _rvs(self, c): return log(mtrand.gamma(c, size=self._size)) def _pdf(self, x, c): - return exp(c*x-exp(x)-special.gammaln(c)) + return exp(c*x-exp(x)-gamln(c)) def _cdf(self, x, c): return special.gammainc(c, exp(x)) def _ppf(self, q, c): @@ -3188,9 +3406,14 @@ #return 0.5*sqrt(df)*(sY-1.0/sY) def _pdf(self, x, df): r = arr(df*1.0) - Px = exp(special.gammaln((r+1)/2)-special.gammaln(r/2)) + Px = exp(gamln((r+1)/2)-gamln(r/2)) Px /= sqrt(r*pi)*(1+(x**2)/r)**((r+1)/2) return Px + def _logpdf(self, x, df): + r = df*1.0 + lPx = gamln((r+1)/2)-gamln(r/2) + lPx -= 0.5*log(r*pi) + (r+1)/2*log(1+(x**2)/r) + return lPx def _cdf(self, x, df): return special.stdtr(df, x) def _sf(self, x, df): @@ -3333,8 +3556,14 @@ class lomax_gen(rv_continuous): def _pdf(self, x, c): return c*1.0/(1.0+x)**(c+1.0) + def _logpdf(self, x, c): + return log(c) - (c+1)*log(1+x) def _cdf(self, x, c): return 1.0-1.0/(1.0+x)**c + def _sf(self, x, c): + return 1.0/(1.0+x)**c + def _logsf(self, x, c): + return -c*log(1+x) def _ppf(self, q, c): return pow(1.0-q,-1.0/c)-1 def _stats(self, c): @@ -3358,8 +3587,12 @@ class powerlaw_gen(rv_continuous): def _pdf(self, x, a): return a*x**(a-1.0) + def _logpdf(self, x, a): + return log(a) + (a-1)*log(x) def _cdf(self, x, a): return x**(a*1.0) + def _logcdf(self, x, a): + return a*log(x) def _ppf(self, q, a): return pow(q, 1.0/a) def _stats(self, a): @@ -3404,10 +3637,12 @@ class powernorm_gen(rv_continuous): def _pdf(self, x, c): - return c*norm.pdf(x)* \ - (norm.cdf(-x)**(c-1.0)) + return c*_norm_pdf(x)* \ + (_norm_cdf(-x)**(c-1.0)) + def _logpdf(self, x, c): + return log(c) + _norm_logpdf(x) + (c-1)*_norm_logcdf(-x) def _cdf(self, x, c): - return 1.0-norm.cdf(-x)**(c*1.0) + return 1.0-_norm_cdf(-x)**(c*1.0) def _ppf(self, q, c): return -norm.ppf(pow(1.0-q,1.0/c)) powernorm = powernorm_gen(name='powernorm', longname="A power normal", @@ -3482,6 +3717,8 @@ def _pdf(self, x, a, b): # argcheck should be called before _pdf return 1.0/(x*self.d) + def _logpdf(self, x, a, b): + return -log(x) - log(self.d) def _cdf(self, x, a, b): return (log(x)-log(a)) / self.d def _ppf(self, q, a, b): @@ -3507,6 +3744,8 @@ class rice_gen(rv_continuous): def _pdf(self, x, b): return x*exp(-(x*x+b*b)/2.0)*special.i0(x*b) + def _logpdf(self, x, b): + return log(x) - (x*x + b*b)/2.0 + log(special.i0(x*b)) def _munp(self, n, b): nd2 = n/2.0 n1 = 1+nd2 @@ -3531,11 +3770,13 @@ return 1.0/mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): return 1.0/sqrt(2*pi*x)*exp(-(1-mu*x)**2.0 / (2*x*mu**2.0)) + def _logpdf(self, x, mu): + return -(1-mu*x)**2.0 / (2*x*mu**2.0) - 0.5*log(2*pi*x) def _cdf(self, x, mu): trm1 = 1.0/mu - x trm2 = 1.0/mu + x isqx = 1.0/sqrt(x) - return 1.0-norm.cdf(isqx*trm1)-exp(2.0/mu)*norm.cdf(-isqx*trm2) + return 1.0-_norm_cdf(isqx*trm1)-exp(2.0/mu)*_norm_cdf(-isqx*trm2) # xb=50 or something large is necessary for stats to converge without exception recipinvgauss = recipinvgauss_gen(a=0.0, xb=50, name='recipinvgauss', longname="A reciprocal inverse Gaussian", @@ -3613,6 +3854,8 @@ return (b > 0) def _pdf(self, x, b): return exp(-x)/(1-exp(-b)) + def _logpdf(self, x, b): + return -x - log(1-exp(-b)) def _cdf(self, x, b): return (1.0-exp(-x))/(1-exp(-b)) def _ppf(self, q, b): @@ -3648,19 +3891,25 @@ def _argcheck(self, a, b): self.a = a self.b = b - self.nb = norm._cdf(b) - self.na = norm._cdf(a) + self._nb = _norm_cdf(b) + self._na = _norm_cdf(a) + self._delta = self._nb - self._na + self._logdelta = log(self._delta) return (a != b) + # All of these assume that _argcheck is called first + # and no other thread calls _pdf before. def _pdf(self, x, a, b): - return norm._pdf(x) / (self.nb - self.na) + return _norm_pdf(x) / self._delta + def _logpdf(self, x, a, b): + return _norm_logpdf(x) - self._logdelta def _cdf(self, x, a, b): - return (norm._cdf(x) - self.na) / (self.nb - self.na) + return (_norm_cdf(x) - self._na) / self._delta def _ppf(self, q, a, b): - return norm._ppf(q*self.nb + self.na*(1.0-q)) + return norm._ppf(q*self._nb + self._na*(1.0-q)) def _stats(self, a, b): - nA, nB = self.na, self.nb + nA, nB = self._na, self._nb d = nB - nA - pA, pB = norm._pdf(a), norm._pdf(b) + pA, pB = _norm_pdf(a), _norm_pdf(b) mu = (pA - pB) / d #correction sign mu2 = 1 + (a*pA - b*pB) / d - mu*mu return mu, mu2, None, None @@ -4189,8 +4438,11 @@ return cond def _pmf(self, k, *args): - return self.cdf(k,*args) - self.cdf(k-1,*args) + return self._cdf(k,*args) - self._cdf(k-1,*args) + def _logpmf(self, k, *args): + return log(self._pmf(k, *args)) + def _cdfsingle(self, k, *args): m = arange(int(self.a),k+1) return sum(self._pmf(m,*args),axis=0) @@ -4199,9 +4451,15 @@ k = floor(x) return self._cdfvec(k,*args) + def _logcdf(self, x, *args): + return log(self._cdf(x, *args)) + def _sf(self, x, *args): return 1.0-self._cdf(x,*args) + def _logsf(self, x, *args): + return log(self._sf(x, *args)) + def _ppf(self, q, *args): return self._vecppf(q, *args) @@ -4275,6 +4533,44 @@ return output[()] return output + def logpmf(self, k,*args, **kwds): + """ + Log of the probability mass function at k of the given RV. + + + Parameters + ---------- + k : array-like + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + + Returns + ------- + logpmf : array-like + Log of the probability mass function evaluated at k + + """ + loc = kwds.get('loc') + args, loc = self._fix_loc(args, loc) + k,loc = map(arr,(k,loc)) + args = tuple(map(arr,args)) + k = arr((k-loc)) + cond0 = self._argcheck(*args) + cond1 = (k >= self.a) & (k <= self.b) & self._nonzero(k,*args) + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + place(output,(1-cond0)*(cond1==cond1),self.badvalue) + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logpmf(*goodargs)) + if output.ndim == 0: + return output[()] + return output + def cdf(self, k, *args, **kwds): """ Cumulative distribution function at k of the given RV @@ -4315,6 +4611,47 @@ return output[()] return output + def logcdf(self, k, *args, **kwds): + """ + Log of the cumulative distribution function at k of the given RV + + Parameters + ---------- + k : array-like, int + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + + Returns + ------- + logcdf : array-like + Log of the cumulative distribution function evaluated at k + + """ + loc = kwds.get('loc') + args, loc = self._fix_loc(args, loc) + k,loc = map(arr,(k,loc)) + args = tuple(map(arr,args)) + k = arr((k-loc)) + cond0 = self._argcheck(*args) + cond1 = (k >= self.a) & (k < self.b) + cond2 = (k >= self.b) + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + place(output,(1-cond0)*(cond1==cond1),self.badvalue) + place(output,cond2*(cond0==cond0), 0.0) + + if any(cond): + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logcdf(*goodargs)) + if output.ndim == 0: + return output[()] + return output + def sf(self,k,*args,**kwds): """ Survival function (1-cdf) at k of the given RV @@ -4353,6 +4690,45 @@ return output[()] return output + def logsf(self,k,*args,**kwds): + """ + Log of the survival function (1-cdf) at k of the given RV + + Parameters + ---------- + k : array-like + quantiles + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + + Returns + ------- + sf : array-like + Survival function evaluated at k + + """ + loc= kwds.get('loc') + args, loc = self._fix_loc(args, loc) + k,loc = map(arr,(k,loc)) + args = tuple(map(arr,args)) + k = arr(k-loc) + cond0 = self._argcheck(*args) + cond1 = (k >= self.a) & (k <= self.b) + cond2 = (k < self.a) & cond0 + cond = cond0 & cond1 + output = empty(shape(cond),'d') + output.fill(NINF) + place(output,(1-cond0)*(cond1==cond1),self.badvalue) + place(output,cond2,0.0) + goodargs = argsreduce(cond, *((k,)+args)) + place(output,cond,self._logsf(*goodargs)) + if output.ndim == 0: + return output[()] + return output + def ppf(self,q,*args,**kwds): """ Percent point function (inverse of cdf) at q of the given RV @@ -4649,11 +5025,13 @@ def _argcheck(self, n, pr): self.b = n return (n>=0) & (pr >= 0) & (pr <= 1) + def _logpmf(self, x, n, pr): + k = floor(x) + combiln = (gamln(n+1) - (gamln(k+1) + + gamln(n-k+1))) + return combiln + k*np.log(pr) + (n-k)*np.log(1-pr) def _pmf(self, x, n, pr): - k = floor(x) - combiln = (special.gammaln(n+1) - (special.gammaln(k+1) + - special.gammaln(n-k+1))) - return np.exp(combiln + k*np.log(pr) + (n-k)*np.log(1-pr)) + return exp(self._logpmf(x, n, pr)) def _cdf(self, x, n, pr): k = floor(x) vals = special.bdtr(k,n,pr) @@ -4696,6 +5074,8 @@ return binom_gen._rvs(self, 1, pr) def _argcheck(self, pr): return (pr >=0 ) & (pr <= 1) + def _logpmf(self, x, pr): + return binom_gen._logpmf(self, x, 1, pr) def _pmf(self, x, pr): return binom_gen._pmf(self, x, 1, pr) def _cdf(self, x, pr): @@ -4739,8 +5119,11 @@ def _argcheck(self, n, pr): return (n >= 0) & (pr >= 0) & (pr <= 1) def _pmf(self, x, n, pr): - coeff = exp(special.gammaln(n+x) - special.gammaln(x+1) - special.gammaln(n)) + coeff = exp(gamln(n+x) - gamln(x+1) - gamln(n)) return coeff * power(pr,n) * power(1-pr,x) + def _logpmf(self, x, n, pr): + coeff = gamln(n+x) - gamln(x+1) - gamln(n) + return coeff + n*log(pr) + x*log(1-pr) def _cdf(self, x, n, pr): k = floor(x) return special.betainc(n, k+1, pr) @@ -4780,6 +5163,8 @@ return (pr<=1) & (pr >= 0) def _pmf(self, k, pr): return (1-pr)**(k-1) * pr + def _logpmf(self, k, pr): + return (k-1)*log(1-pr) + pr def _cdf(self, x, pr): k = floor(x) return (1.0-(1.0-pr)**k) @@ -4818,14 +5203,16 @@ self.a = N-(M-n) self.b = min(n,N) return cond - def _pmf(self, k, M, n, N): + def _logpmf(self, k, M, n, N): tot, good = M, n bad = tot - good - return np.exp(lgam(good+1) - lgam(good-k+1) - lgam(k+1) + lgam(bad+1) - - lgam(bad-N+k+1) - lgam(N-k+1) - lgam(tot+1) + lgam(tot-N+1) - + lgam(N+1)) + return gamln(good+1) - gamln(good-k+1) - gamln(k+1) + gamln(bad+1) \ + - gamln(bad-N+k+1) - gamln(N-k+1) - gamln(tot+1) + gamln(tot-N+1) \ + + gamln(N+1) + def _pmf(self, k, M, n, N): #same as the following but numerically more precise #return comb(good,k) * comb(bad,N-k) / comb(tot,N) + return exp(self._logpmf(k, M, n, N)) def _stats(self, M, n, N): tot, good = M, n n = good*1.0 @@ -4905,7 +5292,7 @@ def _rvs(self, mu): return mtrand.poisson(mu, self._size) def _pmf(self, k, mu): - Pk = k*log(mu)-special.gammaln(k+1) - mu + Pk = k*log(mu)-gamln(k+1) - mu return exp(Pk) def _cdf(self, x, mu): k = floor(x) From scipy-svn at scipy.org Sat May 29 19:21:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 18:21:12 -0500 (CDT) Subject: [Scipy-svn] r6428 - trunk/scipy/stats Message-ID: <20100529232112.4D43C39CAED@scipy.org> Author: oliphant Date: 2010-05-29 18:21:12 -0500 (Sat, 29 May 2010) New Revision: 6428 Modified: trunk/scipy/stats/distributions.py Log: Use super to walk class tree and use bound class. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 22:58:41 UTC (rev 6427) +++ trunk/scipy/stats/distributions.py 2010-05-29 23:21:12 UTC (rev 6428) @@ -4494,7 +4494,7 @@ """ kwargs['discrete'] = True - return rv_generic.rvs(self, *args, **kwargs) + return super(rv_generic, self).rvs(*args, **kwargs) def pmf(self, k,*args, **kwds): """ @@ -5075,17 +5075,17 @@ def _argcheck(self, pr): return (pr >=0 ) & (pr <= 1) def _logpmf(self, x, pr): - return binom_gen._logpmf(self, x, 1, pr) + return binom._logpmf(x, 1, pr) def _pmf(self, x, pr): - return binom_gen._pmf(self, x, 1, pr) + return binom._pmf(x, 1, pr) def _cdf(self, x, pr): - return binom_gen._cdf(self, x, 1, pr) + return binom._cdf(x, 1, pr) def _sf(self, x, pr): - return binom_gen._sf(self, x, 1, pr) + return binom._sf(x, 1, pr) def _ppf(self, q, pr): - return binom_gen._ppf(self, q, 1, pr) + return binom._ppf(q, 1, pr) def _stats(self, pr): - return binom_gen._stats(self, 1, pr) + return binom._stats(1, pr) def _entropy(self, pr): return -pr*log(pr)-(1-pr)*log(1-pr) bernoulli = bernoulli_gen(b=1,name='bernoulli',shapes="pr",extradoc=""" From scipy-svn at scipy.org Sat May 29 19:22:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 18:22:56 -0500 (CDT) Subject: [Scipy-svn] r6429 - trunk/scipy/stats Message-ID: <20100529232256.B2B7739CAED@scipy.org> Author: oliphant Date: 2010-05-29 18:22:56 -0500 (Sat, 29 May 2010) New Revision: 6429 Modified: trunk/scipy/stats/distributions.py Log: Use super to walk class tree and use bound class. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 23:21:12 UTC (rev 6428) +++ trunk/scipy/stats/distributions.py 2010-05-29 23:22:56 UTC (rev 6429) @@ -4494,7 +4494,7 @@ """ kwargs['discrete'] = True - return super(rv_generic, self).rvs(*args, **kwargs) + return super(rv_discrete, self).rvs(*args, **kwargs) def pmf(self, k,*args, **kwds): """ From scipy-svn at scipy.org Sat May 29 19:29:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 18:29:26 -0500 (CDT) Subject: [Scipy-svn] r6430 - trunk/scipy/stats Message-ID: <20100529232926.7B83039CAED@scipy.org> Author: oliphant Date: 2010-05-29 18:29:26 -0500 (Sat, 29 May 2010) New Revision: 6430 Modified: trunk/scipy/stats/distributions.py Log: Fix typo in F distribution. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-29 23:22:56 UTC (rev 6429) +++ trunk/scipy/stats/distributions.py 2010-05-29 23:29:26 UTC (rev 6430) @@ -2206,8 +2206,8 @@ def _logpdf(self, x, dfn, dfd): n = 1.0*dfn m = 1.0*dfd - lPx = m/2 * log(m) + n/2 * log(n) + (n/2-1)*log(x) - lPx -= (n+m)/2*log(m+n*x) - special.betaln(n/2,m/2) + lPx = m/2*log(m) + n/2*log(n) + (n/2-1)*log(x) + lPx -= ((n+m)/2)*log(m+n*x) + special.betaln(n/2,m/2) return lPx def _cdf(self, x, dfn, dfd): return special.fdtr(dfn, dfd, x) From scipy-svn at scipy.org Sat May 29 22:56:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 21:56:26 -0500 (CDT) Subject: [Scipy-svn] r6431 - in trunk: doc/release doc/source/tutorial scipy/io Message-ID: <20100530025626.EC89639CAED@scipy.org> Author: matthew.brett at gmail.com Date: 2010-05-29 21:56:26 -0500 (Sat, 29 May 2010) New Revision: 6431 Added: trunk/doc/source/tutorial/octave_a.mat trunk/doc/source/tutorial/octave_cells.mat trunk/doc/source/tutorial/octave_struct.mat Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/tutorial/io.rst trunk/scipy/io/info.py Log: DOC - updated tutorial and release notes for matlab io changes Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-29 23:29:26 UTC (rev 6430) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-30 02:56:26 UTC (rev 6431) @@ -142,7 +142,29 @@ decompositions. These can be accessed via `scipy.sparse.linalg.spilu`. Upgrade to SuperLU 4.0 also fixes some known bugs. +Faster matlab file reader and default behavior change +----------------------------------------------------- +We've rewritten the matlab file reader in Cython and it should now read +matlab files at around the same speed that Matlab does. + +The reader reads matlab named and anonymous functions, but it can't +write them. + +Until scipy 0.8.0 we have returned arrays of matlab structs as numpy +object arrays, where the objects have attributes named for the struct +fields. As of 0.8.0, we return matlab structs as numpy structured +arrays. You can get the older behavior by using the optional +``struct_as_record=False`` keyword argument to `scipy.io.loadmat` and +friends. + +There is an inconsistency in the matlab file writer, in that it writes +numpy 1D arrays as column vectors in matlab 5 files, and row vectors in +matlab 4 files. We will change this in the next version, so both write +row vectors. There is a `FutureWarning` when calling the writer to warn +of this change; for now we suggest using the ``oned_as='row'`` keyword +argument to `scipy.io.savemat` and friends. + Removed features ================ Modified: trunk/doc/source/tutorial/io.rst =================================================================== --- trunk/doc/source/tutorial/io.rst 2010-05-29 23:29:26 UTC (rev 6430) +++ trunk/doc/source/tutorial/io.rst 2010-05-30 02:56:26 UTC (rev 6431) @@ -79,12 +79,10 @@ Now, to Python: >>> mat_contents = sio.loadmat('octave_a.mat') - /home/mb312/usr/local/lib/python2.5/site-packages/scipy/io/Matlab/mio.py:84: FutureWarning: Using struct_as_record default value (False) This will change to True in future versions - return MatFile5Reader(byte_stream, **kwargs) >>> print mat_contents {'a': array([[[ 1., 4., 7., 10.], [ 2., 5., 8., 11.], - [ 3., 6., 9., 12.]]]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.0.1, 2009-05-14 22:21:44 UTC', '__globals__': []} + [ 3., 6., 9., 12.]]]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:13:40 UTC', '__globals__': []} >>> oct_a = mat_contents['a'] >>> print oct_a [[[ 1. 4. 7. 10.] @@ -93,16 +91,15 @@ >>> print oct_a.shape (1, 3, 4) -We'll get to the deprecation warning in a second. Now let's try the -other way round: +Now let's try the other way round: >>> import numpy as np >>> vect = np.arange(10) >>> print vect.shape (10,) >>> sio.savemat('np_vector.mat', {'vect':vect}) - /home/mb312/usr/local/lib/python2.5/site-packages/scipy/io/Matlab/mio.py:165: FutureWarning: Using oned_as default value ('column') This will change to 'row' in future versions - oned_as=oned_as) + /Users/mb312/usr/local/lib/python2.6/site-packages/scipy/io/matlab/mio.py:196: FutureWarning: Using oned_as default value ('column') This will change to 'row' in future versions + oned_as=oned_as) Then back to Octave: @@ -173,21 +170,24 @@ >>> mat_contents = sio.loadmat('octave_struct.mat') >>> print mat_contents - {'my_struct': array([[]], dtype=object), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.0.1, 2009-05-14 22:40:04 UTC', '__globals__': []} + {'my_struct': array([[([[1.0]], [[2.0]])]], + dtype=[('field1', '|O8'), ('field2', '|O8')]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:00:26 UTC', '__globals__': []} >>> oct_struct = mat_contents['my_struct'] >>> print oct_struct.shape (1, 1) >>> val = oct_struct[0,0] >>> print val - - >>> print val.field1 + ([[1.0]], [[2.0]]) + >>> print val['field1'] [[ 1.]] - >>> print val.field2 + >>> print val['field2'] [[ 2.]] + >>> print val.dtype + [('field1', '|O8'), ('field2', '|O8')] -In this version of Scipy (0.7.1), Matlab structs come back as custom -objects, called ``mat_struct``, with attributes named for the fields in -the structure. Note also: +In this version of Scipy (0.8.0), Matlab structs come back as numpy +structured arrays, with fields named for the struct fields. You can see +the field names in the ``dtype`` output above. Note also: >>> val = oct_struct[0,0] @@ -206,12 +206,29 @@ >>> mat_contents = sio.loadmat('octave_struct.mat', squeeze_me=True) >>> oct_struct = mat_contents['my_struct'] + >>> oct_struct.shape + () + +Sometimes, it's more convenient to load the matlab structs as python +objects rather than numpy structured arrarys - it can make the access +syntax in python a bit more similar to that in matlab. In order to do +this, use the ``struct_as_record=False`` parameter to ``loadmat``. + + >>> mat_contents = sio.loadmat('octave_struct.mat', struct_as_record=False) + >>> oct_struct = mat_contents['my_struct'] + >>> oct_struct[0,0].field1 + array([[ 1.]]) + +``struct_as_record=False`` works nicely with ``squeeze_me``: + + >>> mat_contents = sio.loadmat('octave_struct.mat', struct_as_record=False, squeeze_me=True) + >>> oct_struct = mat_contents['my_struct'] >>> oct_struct.shape # but no - it's a scalar Traceback (most recent call last): File "", line 1, in AttributeError: 'mat_struct' object has no attribute 'shape' - >>> print oct_struct - + >>> print type(oct_struct) + >>> print oct_struct.field1 1.0 @@ -233,22 +250,6 @@ field1 = 0.50000 } -Further up, you'll remember this deprecation warning:: - - >>> mat_contents = sio.loadmat('octave_a.mat') - /home/mb312/usr/local/lib/python2.5/site-packages/scipy/io/Matlab/mio.py:84: FutureWarning: Using struct_as_record default value (False) This will change to True in future versions - return MatFile5Reader(byte_stream, **kwargs) - -The way that the reader returns struct arrays will soon change. Like this: - - >>> mat_contents = sio.loadmat('octave_struct.mat', struct_as_record=True) - >>> oct_struct = mat_contents['my_struct'] - >>> val = oct_struct[0,0] - >>> print val - ([[1.0]], [[2.0]]) - >>> print val.dtype - [('field1', '|O8'), ('field2', '|O8')] - You can also save structs back again to Matlab (or Octave in our case) like this: Added: trunk/doc/source/tutorial/octave_a.mat =================================================================== --- trunk/doc/source/tutorial/octave_a.mat (rev 0) +++ trunk/doc/source/tutorial/octave_a.mat 2010-05-30 02:56:26 UTC (rev 6431) @@ -0,0 +1 @@ +MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:13:40 UTC IM? a `??@@@@@@ @"@$@&@(@ \ No newline at end of file Added: trunk/doc/source/tutorial/octave_cells.mat =================================================================== --- trunk/doc/source/tutorial/octave_cells.mat (rev 0) +++ trunk/doc/source/tutorial/octave_cells.mat 2010-05-30 02:56:26 UTC (rev 6431) @@ -0,0 +1 @@ +MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:14:35 UTC IM?my_cells8 ??@ @@ \ No newline at end of file Added: trunk/doc/source/tutorial/octave_struct.mat =================================================================== --- trunk/doc/source/tutorial/octave_struct.mat (rev 0) +++ trunk/doc/source/tutorial/octave_struct.mat 2010-05-30 02:56:26 UTC (rev 6431) @@ -0,0 +1 @@ +MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:00:26 UTC IM my_struct @field1field28 ??8 @ \ No newline at end of file Modified: trunk/scipy/io/info.py =================================================================== --- trunk/scipy/io/info.py 2010-05-29 23:29:26 UTC (rev 6430) +++ trunk/scipy/io/info.py 2010-05-30 02:56:26 UTC (rev 6431) @@ -7,7 +7,6 @@ loadmat -- read a MATLAB style mat file (version 4 through 7.1) savemat -- write a MATLAB (version through 7.1) style mat file netcdf_file -- read NetCDF files (version of ``pupynere`` package) - This version cannot write NetCDF files. save_as_module -- simple storing of Python dictionary into module that can then be imported and the data accessed as attributes of the module. From scipy-svn at scipy.org Sat May 29 23:11:17 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 22:11:17 -0500 (CDT) Subject: [Scipy-svn] r6432 - trunk/scipy/stats Message-ID: <20100530031117.65C0639CAED@scipy.org> Author: oliphant Date: 2010-05-29 22:11:17 -0500 (Sat, 29 May 2010) New Revision: 6432 Modified: trunk/scipy/stats/distributions.py Log: Add a few more _logpdf functions and remove duplicates. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 02:56:26 UTC (rev 6431) +++ trunk/scipy/stats/distributions.py 2010-05-30 03:11:17 UTC (rev 6432) @@ -861,12 +861,6 @@ def _isf(self, q, *args): return self._ppf(1.0-q,*args) #use correct _ppf for subclasses - def _logpdf(self, x, *arg): - return np.log(self._pdf(x, *arg)) - - def _logcdf(self, x, *arg): - return np.log(self._cdf(x, *arg)) - # The actual cacluation functions (no basic checking need be done) # If these are defined, the others won't be looked at. # Otherwise, the other set can be defined. @@ -1434,6 +1428,9 @@ return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0) def fit_loc_scale(self, data, *args): + """ + Estimate loc and scale parameters from data using 1st and 2nd moments + """ mu, mu2 = self.stats(*args,**{'moments':'mv'}) muhat = st.nanmean(data) mu2hat = st.nanstd(data) @@ -2064,8 +2061,6 @@ return 1.0, 1.0, 2.0, 6.0 def _entropy(self): return 1.0 - def _logpdf(self, x): - return -x expon = expon_gen(a=0.0,name='expon',longname="An exponential", extradoc=""" @@ -2284,6 +2279,8 @@ class frechet_r_gen(rv_continuous): def _pdf(self, x, c): return c*pow(x,c-1)*exp(-pow(x,c)) + def _logpdf(self, x, c): + return log(c) + (c-1)*log(x) - pow(x,c) def _cdf(self, x, c): return -expm1(-pow(x,c)) def _ppf(self, q, c): @@ -2292,8 +2289,6 @@ return special.gamma(1.0+n*1.0/c) def _entropy(self, c): return -_EULER / c - log(c) + _EULER + 1 - def _logpdf(self, x, c): - return log(c) + (c-1)*log(x) - np.power(x,c) frechet_r = frechet_r_gen(a=0.0,name='frechet_r',longname="A Frechet right", shapes='c',extradoc=""" @@ -2355,6 +2350,8 @@ def _pdf(self, x, c): Px = c*exp(-x)/(1+exp(-x))**(c+1.0) return Px + def _logpdf(self, x, c): + return log(c) - x - (c+1.0)*log1p(exp(-x)) def _cdf(self, x, c): Cx = (1+exp(-x))**(-c) return Cx @@ -2370,8 +2367,6 @@ g2 = pi**4/15.0 + 6*zeta(4,c) g2 /= mu2**2.0 return mu, mu2, g1, g2 - def _logpdf(self, x, c): - return log(c) - x - (c+1.0)*log1p(exp(-x)) genlogistic = genlogistic_gen(name='genlogistic', longname="A generalized logistic", shapes='c',extradoc=""" @@ -2392,6 +2387,8 @@ def _pdf(self, x, c): Px = pow(1+c*x,arr(-1.0-1.0/c)) return Px + def _logpdf(self, x, c): + return (-1.0-1.0/c) * np.log1p(c*x) def _cdf(self, x, c): return 1.0 - pow(1+c*x,arr(-1.0/c)) def _ppf(self, q, c): @@ -2407,8 +2404,6 @@ else: self.b = -1.0 / c return rv_continuous._entropy(self, c) - def _logpdf(self, x, c): - return (-1.0-1.0/c) * np.log1p(c*x) genpareto = genpareto_gen(a=0.0,name='genpareto', longname="A generalized Pareto", @@ -2558,8 +2553,6 @@ def _fitstart(self, x): from distributions import skew return (4 / skew(x)**2,) - def _logpdf(self, x, a): - return (a-1)*log(x) - x - special.gammaln(a) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', shapes='a',extradoc=""" @@ -2670,8 +2663,12 @@ def _pdf(self, x): ex = exp(-x) return ex*exp(-ex) + def _logpdf(self, x): + return -x - exp(-x) def _cdf(self, x): return exp(-exp(-x)) + def _logcdf(self, x): + return -exp(-x) def _ppf(self, q): return -log(-log(q)) def _stats(self): @@ -2679,10 +2676,6 @@ 12*sqrt(6)/pi**3 * _ZETA3, 12.0/5 def _entropy(self): return 1.0608407169541684911 - def _logpdf(self, x): - return -x - exp(-x) - def _logcdf(self, x): - return -exp(-x) gumbel_r = gumbel_r_gen(name='gumbel_r',longname="A (right-skewed) Gumbel", extradoc=""" @@ -2695,6 +2688,8 @@ def _pdf(self, x): ex = exp(x) return ex*exp(-ex) + def _logpdf(self, x): + return x - exp(x) def _cdf(self, x): return 1.0-exp(-exp(x)) def _ppf(self, q): @@ -2704,8 +2699,6 @@ -12*sqrt(6)/pi**3 * _ZETA3, 12.0/5 def _entropy(self): return 1.0608407169541684911 - def _logpdf(self, x): - return x - exp(x) gumbel_l = gumbel_l_gen(name='gumbel_l',longname="A left-skewed Gumbel", extradoc=""" @@ -2720,6 +2713,8 @@ class halfcauchy_gen(rv_continuous): def _pdf(self, x): return 2.0/pi/(1.0+x*x) + def _logpdf(self, x): + return np.log(2.0/pi) - np.log1p(x*x) def _cdf(self, x): return 2.0/pi*arctan(x) def _ppf(self, q): @@ -2728,8 +2723,6 @@ return inf, inf, nan, nan def _entropy(self): return log(2*pi) - def _logpdf(self, x): - return np.log(2.0/pi) - np.log1p(x*x) halfcauchy = halfcauchy_gen(a=0.0,name='halfcauchy', longname="A Half-Cauchy",extradoc=""" @@ -2778,6 +2771,8 @@ return abs(norm.rvs(size=self._size)) def _pdf(self, x): return sqrt(2.0/pi)*exp(-x*x/2.0) + def _logpdf(self, x): + return 0.5 * np.log(2.0/pi) - x*x/2.0 def _cdf(self, x): return special.ndtr(x)*2-1.0 def _ppf(self, q): @@ -2787,8 +2782,6 @@ 8*(pi-3)/(pi-2)**2 def _entropy(self): return 0.5*log(pi/2.0)+0.5 - def _logpdf(self, x): - return 0.5 * np.log(2.0/pi) - x*x/2.0 halfnorm = halfnorm_gen(a=0.0, name='halfnorm', longname="A half-normal", extradoc=""" @@ -2854,7 +2847,9 @@ class invgamma_gen(rv_continuous): def _pdf(self, x, a): - return exp(-(a+1)*log(x)-gamln(a) - 1.0/x) + return exp(-self._logpdf(x,a)) + def _logpdf(self, x, a): + return (-(a+1)*log(x)-gamln(a) - 1.0/x) def _cdf(self, x, a): return 1.0-special.gammainc(a, 1.0/x) def _ppf(self, q, a): @@ -2863,8 +2858,6 @@ return exp(gamln(a-n) - gamln(a)) def _entropy(self, a): return a - (a+1.0)*special.psi(a) + gamln(a) - def _logpdf(self, x, a): - return (-(a+1)*np.log(x)-special.gammaln(a) - 1.0/x) invgamma = invgamma_gen(a=0.0, name='invgamma',longname="An inverted gamma", shapes='a',extradoc=""" @@ -2884,6 +2877,8 @@ return mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): return 1.0/sqrt(2*pi*x**3.0)*exp(-1.0/(2*x)*((x-mu)/mu)**2) + def _logpdf(self, x, mu): + return -0.5*log(2*pi) - 1.5*log(x) - ((x-mu)/mu)**2/(2*x) def _cdf(self, x, mu): fac = sqrt(1.0/x) C1 = norm.cdf(fac*(x-mu)/mu) From scipy-svn at scipy.org Sat May 29 23:51:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 22:51:49 -0500 (CDT) Subject: [Scipy-svn] r6433 - trunk/scipy/stats Message-ID: <20100530035149.8B46539CAED@scipy.org> Author: oliphant Date: 2010-05-29 22:51:49 -0500 (Sat, 29 May 2010) New Revision: 6433 Modified: trunk/scipy/stats/_support.py trunk/scipy/stats/distributions.py trunk/scipy/stats/stats.py Log: A few cleanups. Modified: trunk/scipy/stats/_support.py =================================================================== --- trunk/scipy/stats/_support.py 2010-05-30 03:11:17 UTC (rev 6432) +++ trunk/scipy/stats/_support.py 2010-05-30 03:51:49 UTC (rev 6433) @@ -134,8 +134,7 @@ Format: adm (a,criterion) where criterion is like 'x[2]==37'\n""" - function = 'lines = filter(lambda x: '+criterion+',a)' - exec(function) + lines = eval('filter(lambda x: '+criterion+',a)') try: lines = np.array(lines) except: Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 03:11:17 UTC (rev 6432) +++ trunk/scipy/stats/distributions.py 2010-05-30 03:51:49 UTC (rev 6433) @@ -1423,15 +1423,26 @@ if (Narg < self.numargs): start = self._fitstart(data) # get distribution specific starting locations args += start[Narg:] - # location and scale are at the end - x0 = args + map(kwds.get, ['loc', 'scale'], self.fit_loc_scale(data)) + # location and scale + loc0, scale0 = None, None + if 'loc' not in kwds or 'scale' not in kwds: + loc0, scale0 = self.fit_loc_scale(data, *args) + loc = kwds.get('loc', loc0) + scale = kwds.get('scale', scale0) + + if not np.isfinite(scale): + scale = np.sqrt(data.std()) + if not np.isfinite(loc): + loc = data.mean() + + x0 = args + (loc, scale) return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0) def fit_loc_scale(self, data, *args): """ Estimate loc and scale parameters from data using 1st and 2nd moments """ - mu, mu2 = self.stats(*args,**{'moments':'mv'}) + mu, mu2 = self.stats(*args,moments='mv') muhat = st.nanmean(data) mu2hat = st.nanstd(data) Shat = sqrt(mu2hat / mu2) @@ -1574,6 +1585,7 @@ return 0.0, 1.0, 0.0, 0.0 def _entropy(self): return 0.5*(log(2*pi)+1) + def fit(self, data, *args, **kwds): return arr(data).mean(), arr(data).std(ddof=0) norm = norm_gen(name='norm',longname='A normal',extradoc=""" @@ -4861,7 +4873,7 @@ signature = inspect.getargspec(self._stats.im_func) if (signature[2] is not None) or ('moments' in signature[0]): - mu, mu2, g1, g2 = self._stats(*args,**{'moments':moments}) + mu, mu2, g1, g2 = self._stats(*args,moments=moments) else: mu, mu2, g1, g2 = self._stats(*args) if g1 is None: Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-05-30 03:11:17 UTC (rev 6432) +++ trunk/scipy/stats/stats.py 2010-05-30 03:51:49 UTC (rev 6433) @@ -2,7 +2,7 @@ # # Disclaimer # -# This software is provided "as-is". There are no expressed or implied +# This software is provided "as-is". There are no exprgoessed or implied # warranties of any kind, including, but not limited to, the warranties # of merchantability and fittness for a given application. In no event # shall Gary Strangman be liable for any direct, indirect, incidental, @@ -1777,18 +1777,6 @@ -def zmap(scores, compare, axis=0): - """ -Returns an array of z-scores the shape of scores (e.g., [x,y]), compared to -array passed to compare (e.g., [time,x,y]). Assumes collapsing over dim 0 -of the compare array. - -""" - mns = np.mean(compare,axis) - sstd = samplestd(compare,0) - return (scores - mns) / sstd - - ##################################### ####### TRIMMING FUNCTIONS ####### ##################################### From scipy-svn at scipy.org Sat May 29 23:53:50 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 29 May 2010 22:53:50 -0500 (CDT) Subject: [Scipy-svn] r6434 - trunk/scipy/stats Message-ID: <20100530035350.E58C039CAED@scipy.org> Author: oliphant Date: 2010-05-29 22:53:50 -0500 (Sat, 29 May 2010) New Revision: 6434 Modified: trunk/scipy/stats/distributions.py Log: A few cleanups. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 03:51:49 UTC (rev 6433) +++ trunk/scipy/stats/distributions.py 2010-05-30 03:53:50 UTC (rev 6434) @@ -1443,8 +1443,8 @@ Estimate loc and scale parameters from data using 1st and 2nd moments """ mu, mu2 = self.stats(*args,moments='mv') - muhat = st.nanmean(data) - mu2hat = st.nanstd(data) + muhat = arr(data).mean() + mu2hat = arr(data).var() Shat = sqrt(mu2hat / mu2) Lhat = muhat - Shat*mu return Lhat, Shat From scipy-svn at scipy.org Sun May 30 02:33:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 01:33:02 -0500 (CDT) Subject: [Scipy-svn] r6435 - trunk/scipy/stats Message-ID: <20100530063302.3D35139CAED@scipy.org> Author: oliphant Date: 2010-05-30 01:33:01 -0500 (Sun, 30 May 2010) New Revision: 6435 Modified: trunk/scipy/stats/distributions.py Log: Add the ability to fix some parameters during a fitting funtion. Add some special cases to a few distributions. Add some helper functions for internal use in method of moments. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 03:53:50 UTC (rev 6434) +++ trunk/scipy/stats/distributions.py 2010-05-30 06:33:01 UTC (rev 6435) @@ -27,7 +27,25 @@ from copy import copy import vonmises_cython +def _moment(data, n, mu=None): + if mu is None: + mu = data.mean() + return ((data - mu)**n).mean() +def _skew(data): + data = np.ravel(data) + mu = data.mean() + m2 = ((data - mu)**2).mean() + m3 = ((data - mu)**3).mean() + return m3 / m2**1.5 + +def _kurtosis(data): + data = np.ravel(data) + mu = data.mean() + m2 = ((data - mu)**2).mean() + m4 = ((data - mu)**4).mean() + return m4 / m2**2 - 3 + __all__ = [ 'rv_continuous', 'ksone', 'kstwobign', 'norm', 'alpha', 'anglit', 'arcsine', @@ -59,7 +77,6 @@ gam = special.gamma import types -import stats as st from scipy.misc import doccer all = alltrue sgf = vectorize @@ -1392,9 +1409,49 @@ N = len(x) return self._nnlf(x, *args) + N*log(scale) - def _fitstart(self, data): - return (1.0,)*self.numargs + # return starting point for fit (shape arguments + loc + scale) + def _fitstart(self, data, args=None): + if args is None: + args = (1.0,)*self.numargs + return args + self.fit_loc_scale(data, *args) + def _reduce_func(self, args, kwds): + args = list(args) + Nargs = len(args) - 2 + fixedn = [] + index = range(Nargs) + [-2, -1] + names = ['f%d' % n for n in range(Nargs)] + ['floc', 'fscale'] + x0 = args[:] + for n, key in zip(index, names): + if kwds.has_key(key): + fixedn.append(n) + args[n] = kwds[key] + del x0[n] + + if len(fixedn) == 0: + func = self.nnlf + restore = None + else: + if len(fixedn) == len(index): + raise ValueError, "All parameters fixed. There is nothing to optimize." + def restore(args, theta): + # Replace with theta for all numbers not in fixedn + # This allows the non-fixed values to vary, but + # we still call self.nnlf with all parameters. + i = 0 + for n in range(Nargs): + if n not in fixedn: + args[n] = theta[i] + i += 1 + return args + + def func(theta, x): + newtheta = restore(args[:], theta) + return self.nnlf(newtheta, x) + + return x0, func, restore, args + + def fit(self, data, *args, **kwds): """ Return max like estimators to shape, location, and scale from data @@ -1403,15 +1460,25 @@ arguments not given starting points, self._fitstart(data) is called to get the starting estimates. + You can hold some parameters fixed to specific values by passing in + keyword arguments f0..fn for shape paramters and floc, fscale for + location and scale parameters. + Parameters ---------- data : array-like Data to use in calculating the MLE args : optional - Starting values for any shape arguments + Starting values for any shape arguments (those not specified + will be determined by _fitstart(data)) kwds : loc, scale Starting values for the location and scale parameters - + Special keyword arguments are recognized as holding certain + parameters fixed: + f1..fn : hold respective shape paramters fixed + floc : hold location parameter fixed to specified value + fscale : hold scale parameter fixed to specified value + Return ------ shape, loc, scale : tuple of float @@ -1420,24 +1487,21 @@ Narg = len(args) if Narg > self.numargs: raise ValueError, "Too many input arguments." - if (Narg < self.numargs): + start = [None]*2 + if (Narg < self.numargs) or not (kwds.has_key('loc') and + kwds.has_key('scale')): start = self._fitstart(data) # get distribution specific starting locations - args += start[Narg:] - # location and scale - loc0, scale0 = None, None - if 'loc' not in kwds or 'scale' not in kwds: - loc0, scale0 = self.fit_loc_scale(data, *args) - loc = kwds.get('loc', loc0) - scale = kwds.get('scale', scale0) + args += start[Narg:-2] + loc = kwds.get('loc', start[-2]) + scale = kwds.get('scale', start[-1]) + args += (loc, scale) + x0, func, restore, args = self._reduce_func(args, kwds) + vals = optimize.fmin(func,x0,args=(ravel(data),),disp=0) + vals = tuple(vals) + if restore is not None: + vals = restore(args, vals) + return vals - if not np.isfinite(scale): - scale = np.sqrt(data.std()) - if not np.isfinite(loc): - loc = data.mean() - - x0 = args + (loc, scale) - return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0) - def fit_loc_scale(self, data, *args): """ Estimate loc and scale parameters from data using 1st and 2nd moments @@ -1585,8 +1649,6 @@ return 0.0, 1.0, 0.0, 0.0 def _entropy(self): return 0.5*(log(2*pi)+1) - def fit(self, data, *args, **kwds): - return arr(data).mean(), arr(data).std(ddof=0) norm = norm_gen(name='norm',longname='A normal',extradoc=""" Normal distribution @@ -1691,6 +1753,32 @@ g2 = 6.0*(a**3 + a**2*(1-2*b) + b**2*(1+b) - 2*a*b*(2+b)) g2 /= a*b*(a+b+2)*(a+b+3) return mn, var, g1, g2 + def _fitstart(self, data): + g1 = _skew(data) + g2 = _kurtosis(data) + def func(x): + a, b = x + sk = 2*(b-a)*math.sqrt(a + b + 1) / (a + b + 2) / math.sqrt(a*b) + ku = a**3 - a**2*(2*b-1) + b**2*(b+1) - 2*a*b*(b+2) + ku /= a*b*(a+b+2)*(a+b+3) + ku *= 6 + return [sk-g1, ku-g2] + a, b = optimize.fsolve(func, (1.0, 1.0)) + return super(beta_gen, self)._fitstart(data, args=(a,b)) + def fit(self, data, *args, **kwds): + floc = kwds.get('floc', None) + fscale = kwds.get('fscale', None) + if floc == 0 and fscale == 1: + # special case + xbar = arr(data).mean() + v = arr(data).var(ddof=0) + fac = xbar*(1-xbar)/v - 1 + a = xbar * fac + b = (1-xbar) * fac + return a, b, floc, fscale + else: # do general fit + return super(beta_gen, self).fit(data, *args, **kwds) + beta = beta_gen(a=0.0, b=1.0, name='beta',shapes='a, b',extradoc=""" Beta distribution @@ -2562,9 +2650,9 @@ return a, a, 2.0/sqrt(a), 6.0/a def _entropy(self, a): return special.psi(a)*(1-a) + 1 + gamln(a) - def _fitstart(self, x): - from distributions import skew - return (4 / skew(x)**2,) + def _fitstart(self, data): + a = 4 / _skew(data)**2 + return super(gamma_gen, self)._fitstart(data, args=(a,)) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', shapes='a',extradoc=""" From scipy-svn at scipy.org Sun May 30 02:46:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 01:46:37 -0500 (CDT) Subject: [Scipy-svn] r6436 - trunk/scipy/stats Message-ID: <20100530064637.F05ED39CAED@scipy.org> Author: oliphant Date: 2010-05-30 01:46:37 -0500 (Sun, 30 May 2010) New Revision: 6436 Modified: trunk/scipy/stats/distributions.py Log: Add the ability to fix some parameters during a fitting funtion. Add some special cases to a few distributions. Add some helper functions for internal use in method of moments. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 06:33:01 UTC (rev 6435) +++ trunk/scipy/stats/distributions.py 2010-05-30 06:46:37 UTC (rev 6436) @@ -2653,6 +2653,22 @@ def _fitstart(self, data): a = 4 / _skew(data)**2 return super(gamma_gen, self)._fitstart(data, args=(a,)) + def fit(self, data, *args, **kwds): + floc = kwds.get('floc', None): + if floc == 0: + xbar = ravel(data).mean() + logx_bar = ravel(log(data)).mean() + s = log(xbar) - logx_bar + def func(a): + return log(a) - special.digamma(a) - s + aest = (3-s + math.sqrt((s-3)**2 + 24*s)) / (12*s) + xa = aest*(1-0.4) + xb = aest*(1+0.4) + a = optimize.brentq(func, [xa, xb], disp=0) + scale = xbar / a + return a, floc, scale + else: + return super(gamma_gen, self).fit(data, *args, **kwds) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', shapes='a',extradoc=""" From scipy-svn at scipy.org Sun May 30 02:50:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 01:50:45 -0500 (CDT) Subject: [Scipy-svn] r6437 - trunk/scipy/stats Message-ID: <20100530065045.1897939CAED@scipy.org> Author: oliphant Date: 2010-05-30 01:50:44 -0500 (Sun, 30 May 2010) New Revision: 6437 Modified: trunk/scipy/stats/distributions.py Log: Fix typo and function call arguments. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 06:46:37 UTC (rev 6436) +++ trunk/scipy/stats/distributions.py 2010-05-30 06:50:44 UTC (rev 6437) @@ -2654,7 +2654,7 @@ a = 4 / _skew(data)**2 return super(gamma_gen, self)._fitstart(data, args=(a,)) def fit(self, data, *args, **kwds): - floc = kwds.get('floc', None): + floc = kwds.get('floc', None) if floc == 0: xbar = ravel(data).mean() logx_bar = ravel(log(data)).mean() @@ -2664,7 +2664,7 @@ aest = (3-s + math.sqrt((s-3)**2 + 24*s)) / (12*s) xa = aest*(1-0.4) xb = aest*(1+0.4) - a = optimize.brentq(func, [xa, xb], disp=0) + a = optimize.brentq(func, xa, xb, disp=0) scale = xbar / a return a, floc, scale else: From scipy-svn at scipy.org Sun May 30 02:54:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 01:54:22 -0500 (CDT) Subject: [Scipy-svn] r6438 - trunk/scipy/stats Message-ID: <20100530065422.ADBF939CAED@scipy.org> Author: oliphant Date: 2010-05-30 01:54:22 -0500 (Sun, 30 May 2010) New Revision: 6438 Modified: trunk/scipy/stats/distributions.py Log: Fix inverted gamma pdf Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 06:50:44 UTC (rev 6437) +++ trunk/scipy/stats/distributions.py 2010-05-30 06:54:22 UTC (rev 6438) @@ -2963,7 +2963,7 @@ class invgamma_gen(rv_continuous): def _pdf(self, x, a): - return exp(-self._logpdf(x,a)) + return exp(self._logpdf(x,a)) def _logpdf(self, x, a): return (-(a+1)*log(x)-gamln(a) - 1.0/x) def _cdf(self, x, a): From scipy-svn at scipy.org Sun May 30 03:13:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 02:13:39 -0500 (CDT) Subject: [Scipy-svn] r6439 - in trunk/doc: release source/tutorial Message-ID: <20100530071339.7166E39CAED@scipy.org> Author: oliphant Date: 2010-05-30 02:13:39 -0500 (Sun, 30 May 2010) New Revision: 6439 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/tutorial/stats.rst Log: Update documentation surrounding recent changes to distribution objects. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-30 06:54:22 UTC (rev 6438) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-30 07:13:39 UTC (rev 6439) @@ -143,8 +143,7 @@ Upgrade to SuperLU 4.0 also fixes some known bugs. Faster matlab file reader and default behavior change ------------------------------------------------------ - +------------------------------------------------------ We've rewritten the matlab file reader in Cython and it should now read matlab files at around the same speed that Matlab does. @@ -165,6 +164,23 @@ of this change; for now we suggest using the ``oned_as='row'`` keyword argument to `scipy.io.savemat` and friends. + +Improvements to scipy.stats +--------------------------- + +* addition of mvsdist function which returns distribution objects + providing full information about mean, variance, and standard deviation + of a data-set +* addition of 'median', 'mean', 'std', 'var', 'interval', 'logpdf', + 'logcdf', 'logsf' +* addition of 'fit_loc_scale' (deprecation of 'est_loc_scale') +* improvement to 'fit' method of distribution objects so that sub-classes + can add a _fitstart method to fix the starting position of the arguments. + Also, some parameters can be fixed and the data-fitting proceed over the + remaining free parameters using f0..fn and floc and fscale keywords to the + fit function. + + Removed features ================ Modified: trunk/doc/source/tutorial/stats.rst =================================================================== --- trunk/doc/source/tutorial/stats.rst 2010-05-30 06:54:22 UTC (rev 6438) +++ trunk/doc/source/tutorial/stats.rst 2010-05-30 07:13:39 UTC (rev 6439) @@ -112,7 +112,7 @@ * fit: maximum likelihood estimation of distribution parameters, including location and scale -* est_loc_scale: estimation of location and scale when shape parameters are given +* fit_loc_scale: estimation of location and scale when shape parameters are given * nnlf: negative log likelihood function All continuous distributions take `loc` and `scale` as keyword From scipy-svn at scipy.org Sun May 30 03:53:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 02:53:02 -0500 (CDT) Subject: [Scipy-svn] r6440 - in trunk: doc/release doc/source/tutorial scipy/stats Message-ID: <20100530075302.E282F39CAF2@scipy.org> Author: oliphant Date: 2010-05-30 02:53:02 -0500 (Sun, 30 May 2010) New Revision: 6440 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/tutorial/stats.rst trunk/scipy/stats/distributions.py Log: Add expect methods from Joesf Perktold. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-05-30 07:13:39 UTC (rev 6439) +++ trunk/doc/release/0.8.0-notes.rst 2010-05-30 07:53:02 UTC (rev 6440) @@ -172,7 +172,7 @@ providing full information about mean, variance, and standard deviation of a data-set * addition of 'median', 'mean', 'std', 'var', 'interval', 'logpdf', - 'logcdf', 'logsf' + 'logcdf', 'logsf', 'expect' * addition of 'fit_loc_scale' (deprecation of 'est_loc_scale') * improvement to 'fit' method of distribution objects so that sub-classes can add a _fitstart method to fix the starting position of the arguments. Modified: trunk/doc/source/tutorial/stats.rst =================================================================== --- trunk/doc/source/tutorial/stats.rst 2010-05-30 07:13:39 UTC (rev 6439) +++ trunk/doc/source/tutorial/stats.rst 2010-05-30 07:53:02 UTC (rev 6440) @@ -114,6 +114,7 @@ and scale * fit_loc_scale: estimation of location and scale when shape parameters are given * nnlf: negative log likelihood function +* expect: Calculate the expectation of a function against the pdf or pmf All continuous distributions take `loc` and `scale` as keyword parameters to adjust the location and scale of the distribution, Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-30 07:13:39 UTC (rev 6439) +++ trunk/scipy/stats/distributions.py 2010-05-30 07:53:02 UTC (rev 6440) @@ -1,15 +1,14 @@ # Functions to implement several important functions for # various Continous and Discrete Probability Distributions # -# Author: Travis Oliphant 2002-2003 with contributions from +# Author: Travis Oliphant 2002-2010 with contributions from # SciPy Developers 2004-2010 # -import scipy from scipy.misc import comb, derivative from scipy import special from scipy import optimize -import scipy.integrate +from scipy import integrate import inspect from numpy import alltrue, where, arange, putmask, \ @@ -825,13 +824,13 @@ def _mom_integ0(self, x,m,*args): return x**m * self.pdf(x,*args) def _mom0_sc(self, m,*args): - return scipy.integrate.quad(self._mom_integ0, self.a, + return integrate.quad(self._mom_integ0, self.a, self.b, args=(m,)+args)[0] # moment calculated using ppf def _mom_integ1(self, q,m,*args): return (self.ppf(q,*args))**m def _mom1_sc(self, m,*args): - return scipy.integrate.quad(self._mom_integ1, 0, 1,args=(m,)+args)[0] + return integrate.quad(self._mom_integ1, 0, 1,args=(m,)+args)[0] ## These are the methods you must define (standard form functions) def _argcheck(self, *args): @@ -858,7 +857,7 @@ return Y def _cdf_single_call(self, x, *args): - return scipy.integrate.quad(self._pdf, self.a, x, args=args)[0] + return integrate.quad(self._pdf, self.a, x, args=args)[0] def _cdf(self, x, *args): return self.veccdf(x,*args) @@ -1529,7 +1528,7 @@ val = self._pdf(x, *args) return val*log(val) - entr = -scipy.integrate.quad(integ,self.a,self.b)[0] + entr = -integrate.quad(integ,self.a,self.b)[0] if not np.isnan(entr): return entr else: # try with different limits if integration problems @@ -1542,7 +1541,7 @@ lower = low else: lower = self.a - return -scipy.integrate.quad(integ,lower,upper)[0] + return -integrate.quad(integ,lower,upper)[0] def entropy(self, *args, **kwds): @@ -1574,8 +1573,55 @@ else: place(output,cond0,self.vecentropy(*goodargs)+log(scale)) return output - + + def expect(self, func=None, args=(), loc=0, scale=1, lb=None, ub=None, + conditional=False, **kwds): + """calculate expected value of a function with respect to the distribution + location and scale only tested on a few examples + + Parameters + ---------- + all parameters are keyword parameters + func : function (default: identity mapping) + Function for which integral is calculated. Takes only one argument. + args : tuple + argument (parameters) of the distribution + lb, ub : numbers + lower and upper bound for integration, default is set to the support + of the distribution + conditional : boolean (False) + If true then the integral is corrected by the conditional probability + of the integration interval. The return value is the expectation + of the function, conditional on being in the given interval. + + Returns + ------- + expected value : float + + Notes + ----- + This function has not been checked for it's behavior when the integral is + not finite. The integration behavior is inherited from integrate.quad. + """ + if func is None: + def fun(x, *args): + return x*self.pdf(x, *args, loc=loc, scale=scale) + else: + def fun(x, *args): + return func(x)*self.pdf(x, *args, loc=loc, scale=scale) + if lb is None: + lb = (self.a - loc)/(1.0*scale) + if ub is None: + ub = (self.b - loc)/(1.0*scale) + if conditional: + invfac = self.sf(lb,*args) - self.sf(ub,*args) + else: + invfac = 1.0 + kwds['args'] = args + return integrate.quad(fun, lb, ub, **kwds)[0] / invfac + + _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) _ZETA3 = 1.202056903159594285399738161511449990765 # special.zeta(3,1) Apery's constant @@ -1768,10 +1814,11 @@ def fit(self, data, *args, **kwds): floc = kwds.get('floc', None) fscale = kwds.get('fscale', None) - if floc == 0 and fscale == 1: + if floc is not None and fscale is not None: # special case - xbar = arr(data).mean() - v = arr(data).var(ddof=0) + data = (ravel(data)-floc)/fscale + xbar = data.mean() + v = data.var(ddof=0) fac = xbar*(1-xbar)/v - 1 a = xbar * fac b = (1-xbar) * fac @@ -4071,7 +4118,7 @@ def _entropy(self, lam): def integ(p): return log(pow(p,lam-1)+pow(1-p,lam-1)) - return scipy.integrate.quad(integ,0,1)[0] + return integrate.quad(integ,0,1)[0] tukeylambda = tukeylambda_gen(name='tukeylambda', longname="A Tukey-Lambda", shapes="lam", extradoc=""" @@ -5128,6 +5175,110 @@ def __call__(self, *args, **kwds): return self.freeze(*args,**kwds) + def expect(self, func=None, args=(), loc=0, lb=None, ub=None, conditional=False): + """calculate expected value of a function with respect to the distribution + for discrete distribution + + Parameters + ---------- + fn : function (default: identity mapping) + Function for which integral is calculated. Takes only one argument. + args : tuple + argument (parameters) of the distribution + optional keyword parameters + lb, ub : numbers + lower and upper bound for integration, default is set to the support + of the distribution, lb and ub are inclusive (ul<=k<=ub) + conditional : boolean (False) + If true then the expectation is corrected by the conditional + probability of the integration interval. The return value is the + expectation of the function, conditional on being in the given + interval (k such that ul<=k<=ub). + + Returns + ------- + expected value : float + + Notes + ----- + * function is not vectorized + * accuracy: uses self.moment_tol as stopping criterium + for heavy tailed distribution e.g. zipf(4), accuracy for + mean, variance in example is only 1e-5, + increasing precision (moment_tol) makes zipf very slow + * suppnmin=100 internal parameter for minimum number of points to evaluate + could be added as keyword parameter, to evaluate functions with + non-monotonic shapes, points include integers in (-suppnmin, suppnmin) + * uses maxcount=1000 limits the number of points that are evaluated + to break loop for infinite sums + (a maximum of suppnmin+1000 positive plus suppnmin+1000 negative integers + are evaluated) + + + """ + + #moment_tol = 1e-12 # increase compared to self.moment_tol, + # too slow for only small gain in precision for zipf + + #avoid endless loop with unbound integral, eg. var of zipf(2) + maxcount = 1000 + suppnmin = 100 #minimum number of points to evaluate (+ and -) + + if func is None: + def fun(x): + #loc and args from outer scope + return (x+loc)*self._pmf(x, *args) + else: + def fun(x): + #loc and args from outer scope + return func(x+loc)*self._pmf(x, *args) + # used pmf because _pmf does not check support in randint + # and there might be problems(?) with correct self.a, self.b at this stage + # maybe not anymore, seems to work now with _pmf + + self._argcheck(*args) # (re)generate scalar self.a and self.b + if lb is None: + lb = (self.a) + if ub is None: + ub = (self.b) + if conditional: + invfac = self.sf(lb,*args) - self.sf(ub+1,*args) + else: + invfac = 1.0 + + tot = 0.0 + low, upp = self._ppf(0.001, *args), self._ppf(0.999, *args) + low = max(min(-suppnmin, low), lb) + upp = min(max(suppnmin, upp), ub) + supp = np.arange(low, upp+1, self.inc) #check limits + #print 'low, upp', low, upp + tot = np.sum(fun(supp)) + diff = 1e100 + pos = upp + self.inc + count = 0 + + #handle cases with infinite support + + while (pos <= ub) and (diff > self.moment_tol) and count <= maxcount: + diff = fun(pos) + tot += diff + pos += self.inc + count += 1 + + if self.a < 0: #handle case when self.a = -inf + diff = 1e100 + pos = low - self.inc + while (pos >= lb) and (diff > self.moment_tol) and count <= maxcount: + diff = fun(pos) + tot += diff + pos -= self.inc + count += 1 + if count > maxcount: + # replace with proper warning + print 'sum did not converge' + return tot/invfac + + # Binomial class binom_gen(rv_discrete): From scipy-svn at scipy.org Sun May 30 08:36:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 07:36:00 -0500 (CDT) Subject: [Scipy-svn] r6441 - trunk/scipy/linalg/tests Message-ID: <20100530123600.DFC1339CAF2@scipy.org> Author: rgommers Date: 2010-05-30 07:36:00 -0500 (Sun, 30 May 2010) New Revision: 6441 Modified: trunk/scipy/linalg/tests/test_lapack.py Log: TST: Remove outdated printed warnings about flapack/clapack being empty. Modified: trunk/scipy/linalg/tests/test_lapack.py =================================================================== --- trunk/scipy/linalg/tests/test_lapack.py 2010-05-30 07:53:02 UTC (rev 6440) +++ trunk/scipy/linalg/tests/test_lapack.py 2010-05-30 12:36:00 UTC (rev 6441) @@ -45,25 +45,14 @@ def test_flapack(self): if hasattr(flapack,'empty_module'): - print """ -**************************************************************** -WARNING: flapack module is empty ------------ -See scipy/INSTALL.txt for troubleshooting. -**************************************************************** -""" + #flapack module is empty + pass + def test_clapack(self): if hasattr(clapack,'empty_module'): - print """ -**************************************************************** -WARNING: clapack module is empty ------------ -See scipy/INSTALL.txt for troubleshooting. -Notes: -* If atlas library is not found by numpy/distutils/system_info.py, - then scipy uses flapack instead of clapack. -**************************************************************** -""" + #clapack module is empty + pass + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sun May 30 08:36:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 07:36:19 -0500 (CDT) Subject: [Scipy-svn] r6442 - trunk/scipy/linalg/tests Message-ID: <20100530123619.C539C39CAF2@scipy.org> Author: rgommers Date: 2010-05-30 07:36:19 -0500 (Sun, 30 May 2010) New Revision: 6442 Modified: trunk/scipy/linalg/tests/test_matfuncs.py Log: TST: Do not print warnings for linalg.funm/signm tests. Modified: trunk/scipy/linalg/tests/test_matfuncs.py =================================================================== --- trunk/scipy/linalg/tests/test_matfuncs.py 2010-05-30 12:36:00 UTC (rev 6441) +++ trunk/scipy/linalg/tests/test_matfuncs.py 2010-05-30 12:36:19 UTC (rev 6442) @@ -31,7 +31,7 @@ def test_defective1(self): a = array([[0.0,1,0,0],[1,0,1,0],[0,0,0,1],[0,0,1,0]]) - r = signm(a) + r = signm(a, disp=False) #XXX: what would be the correct result? def test_defective2(self): @@ -41,7 +41,7 @@ [-10.0,6.0,-20.0,-18.0,-2.0], [-9.6,9.6,-25.5,-15.4,-2.0], [9.8,-4.8,18.0,18.2,2.0])) - r = signm(a) + r = signm(a, disp=False) #XXX: what would be the correct result? def test_defective3(self): @@ -52,7 +52,7 @@ [ 0., 0., 0., 0., 3., 10., 0.], [ 0., 0., 0., 0., 0., -2., 25.], [ 0., 0., 0., 0., 0., 0., -3.]]) - r = signm(a) + r = signm(a, disp=False) #XXX: what would be the correct result? class TestLogM(TestCase): @@ -66,7 +66,8 @@ [ 0., 0., 0., 0., 0., -2., 25.], [ 0., 0., 0., 0., 0., 0., -3.]]) m = (identity(7)*3.1+0j)-a - logm(m) + logm(m, disp=False) + #XXX: what would be the correct result? class TestSqrtM(TestCase): @@ -83,7 +84,7 @@ [0,0,se,0], [0,0,0,1]]) assert_array_almost_equal(dot(sa,sa),a) - esa = sqrtm(a) + esa = sqrtm(a, disp=False)[0] assert_array_almost_equal(dot(esa,esa),a) class TestExpM(TestCase): From scipy-svn at scipy.org Sun May 30 08:36:35 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 07:36:35 -0500 (CDT) Subject: [Scipy-svn] r6443 - trunk/scipy/stats Message-ID: <20100530123635.1E29539CAF2@scipy.org> Author: rgommers Date: 2010-05-30 07:36:34 -0500 (Sun, 30 May 2010) New Revision: 6443 Modified: trunk/scipy/stats/stats.py Log: TST: Remove printing of warning in friedmanchisquare. Closes #1147. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-05-30 12:36:19 UTC (rev 6442) +++ trunk/scipy/stats/stats.py 2010-05-30 12:36:34 UTC (rev 6443) @@ -3205,8 +3205,6 @@ for i in range(1,k): if len(args[i]) <> n: raise ValueError, 'Unequal N in friedmanchisquare. Aborting.' - if n < 10 and k < 6: - print 'Warning: friedmanchisquare test using Chisquared aproximation' # Rank data data = apply(_support.abut,args) From scipy-svn at scipy.org Sun May 30 08:36:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 07:36:52 -0500 (CDT) Subject: [Scipy-svn] r6444 - trunk/scipy/weave/tests Message-ID: <20100530123652.1495F39CAF2@scipy.org> Author: rgommers Date: 2010-05-30 07:36:51 -0500 (Sun, 30 May 2010) New Revision: 6444 Modified: trunk/scipy/weave/tests/test_ext_tools.py Log: TST: Remove printed message about where weave compiles extensions. Modified: trunk/scipy/weave/tests/test_ext_tools.py =================================================================== --- trunk/scipy/weave/tests/test_ext_tools.py 2010-05-30 12:36:34 UTC (rev 6443) +++ trunk/scipy/weave/tests/test_ext_tools.py 2010-05-30 12:36:51 UTC (rev 6444) @@ -11,7 +11,6 @@ from weave_test_utils import * build_dir = empty_temp_dir() -print 'building extensions here:', build_dir class TestExtModule(TestCase): #should really do some testing of where modules end up From scipy-svn at scipy.org Sun May 30 08:37:10 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 07:37:10 -0500 (CDT) Subject: [Scipy-svn] r6445 - in trunk/scipy/weave: . tests Message-ID: <20100530123710.E893D39CAF2@scipy.org> Author: rgommers Date: 2010-05-30 07:37:10 -0500 (Sun, 30 May 2010) New Revision: 6445 Modified: trunk/scipy/weave/build_tools.py trunk/scipy/weave/tests/test_build_tools.py Log: TST: Change print statement to warning for bad path in weave. This plus the filter ensures it works as before in code, but the test is not talking anymore. Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2010-05-30 12:36:51 UTC (rev 6444) +++ trunk/scipy/weave/build_tools.py 2010-05-30 12:37:10 UTC (rev 6445) @@ -24,6 +24,7 @@ import exceptions import commands import subprocess +import warnings import platform_info @@ -414,8 +415,9 @@ # make sure build_dir exists and is writable if build_dir and (not os.path.exists(build_dir) or not os.access(build_dir,os.W_OK)): - print "warning: specified build_dir '%s' does not exist " \ - "or is not writable. Trying default locations" % build_dir + msg = "specified build_dir '%s' does not exist " \ + "or is not writable. Trying default locations" % build_dir + warnings.warn(msg) build_dir = None if build_dir is None: Modified: trunk/scipy/weave/tests/test_build_tools.py =================================================================== --- trunk/scipy/weave/tests/test_build_tools.py 2010-05-30 12:36:51 UTC (rev 6444) +++ trunk/scipy/weave/tests/test_build_tools.py 2010-05-30 12:37:10 UTC (rev 6445) @@ -2,12 +2,17 @@ # tests for MingW32Compiler # don't know how to test gcc_exists() and msvc_exists()... -import os, sys, tempfile +import os, sys, tempfile, warnings from numpy.testing import * from scipy.weave import build_tools +# filter warnings generated by checking for bad paths +warnings.filterwarnings('ignore', + message="specified build_dir", + module='scipy.weave') + def is_writable(val): return os.access(val,os.W_OK) From scipy-svn at scipy.org Sun May 30 09:26:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 08:26:57 -0500 (CDT) Subject: [Scipy-svn] r6446 - branches Message-ID: <20100530132657.E8BB639CAF2@scipy.org> Author: rgommers Date: 2010-05-30 08:26:57 -0500 (Sun, 30 May 2010) New Revision: 6446 Added: branches/0.8.x/ Log: Create release branch for 0.8 series. Copied: branches/0.8.x (from rev 6445, trunk) From scipy-svn at scipy.org Sun May 30 09:30:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 30 May 2010 08:30:31 -0500 (CDT) Subject: [Scipy-svn] r6447 - trunk Message-ID: <20100530133031.EAEA139CAF2@scipy.org> Author: rgommers Date: 2010-05-30 08:30:31 -0500 (Sun, 30 May 2010) New Revision: 6447 Modified: trunk/setup.py Log: Trunk is open for development of 0.9 series. Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2010-05-30 13:26:57 UTC (rev 6446) +++ trunk/setup.py 2010-05-30 13:30:31 UTC (rev 6447) @@ -41,7 +41,7 @@ """ MAJOR = 0 -MINOR = 8 +MINOR = 9 MICRO = 0 ISRELEASED = False VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) From scipy-svn at scipy.org Mon May 31 04:40:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:40:06 -0500 (CDT) Subject: [Scipy-svn] r6448 - trunk/doc/frontpage/_templates Message-ID: <20100531084006.44A9639CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:40:06 -0500 (Mon, 31 May 2010) New Revision: 6448 Modified: trunk/doc/frontpage/_templates/indexsidebar.html Log: DOC: frontpage: improve front page sidebar text Modified: trunk/doc/frontpage/_templates/indexsidebar.html =================================================================== --- trunk/doc/frontpage/_templates/indexsidebar.html 2010-05-30 13:30:31 UTC (rev 6447) +++ trunk/doc/frontpage/_templates/indexsidebar.html 2010-05-31 08:40:06 UTC (rev 6448) @@ -3,8 +3,8 @@
  • SciPy.org
    all things NumPy/SciPy (bug reports, downloads, conferences, etc.)
  • -
  • Additional documentation
    - documentation not yet integrated with this site +
  • Additional documentation
    + additional tutorials and other documentation resources
  • Cookbook
    user-contributed examples and recipes for common tasks From scipy-svn at scipy.org Mon May 31 04:40:13 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:40:13 -0500 (CDT) Subject: [Scipy-svn] r6449 - trunk/scipy/special Message-ID: <20100531084013.4741739CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:40:13 -0500 (Mon, 31 May 2010) New Revision: 6449 Modified: trunk/scipy/special/lambertw.pyx Log: BUG: special: add a missing piece of code to lambertw, lost in python -> cython transcription Modified: trunk/scipy/special/lambertw.pyx =================================================================== --- trunk/scipy/special/lambertw.pyx 2010-05-31 08:40:06 UTC (rev 6448) +++ trunk/scipy/special/lambertw.pyx 2010-05-31 08:40:13 UTC (rev 6449) @@ -111,6 +111,8 @@ w = 0.7 + 0.7j else: w = 0.7 - 0.7j + else: + w = z else: if z.real == NPY_INFINITY: From scipy-svn at scipy.org Mon May 31 04:40:20 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:40:20 -0500 (CDT) Subject: [Scipy-svn] r6450 - trunk/scipy/special Message-ID: <20100531084020.30D7039CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:40:20 -0500 (Mon, 31 May 2010) New Revision: 6450 Modified: trunk/scipy/special/lambertw.pyx trunk/scipy/special/orthogonal_eval.pyx Log: BUG: special: handle GIL safely inside the ufunc loops in Cython files Modified: trunk/scipy/special/lambertw.pyx =================================================================== --- trunk/scipy/special/lambertw.pyx 2010-05-31 08:40:13 UTC (rev 6449) +++ trunk/scipy/special/lambertw.pyx 2010-05-31 08:40:20 UTC (rev 6450) @@ -20,11 +20,12 @@ # TODO: use a series expansion when extremely close to the branch point # at `-1/e` and make sure that the proper branch is chosen there +import cython import warnings cdef extern from "math.h": - double exp(double x) - double log(double x) + double exp(double x) nogil + double log(double x) nogil # Use Numpy's portable C99-compatible complex functios @@ -33,38 +34,38 @@ double real double imag - double npy_cabs(npy_cdouble z) - npy_cdouble npy_clog(npy_cdouble z) - npy_cdouble npy_cexp(npy_cdouble z) - int npy_isnan(double x) + double npy_cabs(npy_cdouble z) nogil + npy_cdouble npy_clog(npy_cdouble z) nogil + npy_cdouble npy_cexp(npy_cdouble z) nogil + int npy_isnan(double x) nogil double NPY_INFINITY double NPY_PI - enum NPY_ALLOW_C_API_DEF: NPY_ALLOW_C_API_DEF - enum NPY_ALLOW_C_API: NPY_ALLOW_C_API - enum NPY_DISABLE_C_API: NPY_DISABLE_C_API - -cdef inline bint zisnan(double complex x): +cdef inline bint zisnan(double complex x) nogil: return npy_isnan(x.real) or npy_isnan(x.imag) -cdef inline double zabs(double complex x): +cdef inline double zabs(double complex x) nogil: cdef double r r = npy_cabs((&x)[0]) return r -cdef inline double complex zlog(double complex x): +cdef inline double complex zlog(double complex x) nogil: cdef npy_cdouble r r = npy_clog((&x)[0]) return (&r)[0] -cdef inline double complex zexp(double complex x): +cdef inline double complex zexp(double complex x) nogil: cdef npy_cdouble r r = npy_cexp((&x)[0]) return (&r)[0] +cdef void lambertw_raise_warning(double complex z) with gil: + warnings.warn("Lambert W iteration failed to converge: %r" % z) + # Heavy lifting is here: -cdef double complex lambertw_scalar(double complex z, long k, double tol): + at cython.cdivision(True) +cdef double complex lambertw_scalar(double complex z, long k, double tol) nogil: """ This is just the implementation of W for a single input z. See the docstring for lambertw() below for the full description. @@ -141,11 +142,7 @@ else: w = wn - if True: - NPY_ALLOW_C_API_DEF - NPY_ALLOW_C_API - warnings.warn("Lambert W iteration failed to converge: %r" % z) - NPY_DISABLE_C_API + lambertw_raise_warning(z) return wn @@ -167,11 +164,11 @@ int identity, char* name, char* doc, int c) cdef void _apply_func_to_1d_vec(char **args, npy_intp *dimensions, npy_intp *steps, - void *func): + void *func) nogil: cdef npy_intp i cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] for i in range(0, dimensions[0]): - (op)[0] = (func)( + (op)[0] = (func)( (ip1)[0], (ip2)[0], (ip3)[0]) ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] Modified: trunk/scipy/special/orthogonal_eval.pyx =================================================================== --- trunk/scipy/special/orthogonal_eval.pyx 2010-05-31 08:40:13 UTC (rev 6449) +++ trunk/scipy/special/orthogonal_eval.pyx 2010-05-31 08:40:20 UTC (rev 6450) @@ -1,5 +1,6 @@ """ -Evaluate orthogonal polynomial values using recurrence relations. +Evaluate orthogonal polynomial values using recurrence relations +or by calling special functions. References ---------- @@ -19,9 +20,9 @@ #------------------------------------------------------------------------------ cdef extern from "math.h": - double sqrt(double x) + double sqrt(double x) nogil -cdef double eval_poly_chebyt(long k, double x): +cdef double eval_poly_chebyt(long k, double x) nogil: # Use Chebyshev T recurrence directly, see [MH] cdef long m cdef double b2, b1, b0 @@ -30,7 +31,7 @@ b1 = -1 b0 = 0 x = 2*x - for m in range(k+1, 0, -1): + for m in range(k+1): b2 = b1 b1 = b0 b0 = x*b1 - b2 @@ -55,12 +56,12 @@ int identity, char* name, char* doc, int c) cdef void _loop_id_d(char **args, npy_intp *dimensions, npy_intp *steps, - void *func): + void *func) nogil: cdef int i cdef double x cdef char *ip1=args[0], *ip2=args[1], *op=args[2] for i in range(0, dimensions[0]): - (op)[0] = (func)( + (op)[0] = (func)( (ip1)[0], (ip2)[0]) ip1 += steps[0]; ip2 += steps[1]; op += steps[2] From scipy-svn at scipy.org Mon May 31 04:40:27 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:40:27 -0500 (CDT) Subject: [Scipy-svn] r6451 - trunk/scipy/special Message-ID: <20100531084027.8DD5939CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:40:26 -0500 (Mon, 31 May 2010) New Revision: 6451 Modified: trunk/scipy/special/lambertw.c trunk/scipy/special/orthogonal_eval.c Log: special: regenerate lambertw.c and orthogonal_eval.c from Cython sources Modified: trunk/scipy/special/lambertw.c =================================================================== --- trunk/scipy/special/lambertw.c 2010-05-31 08:40:20 UTC (rev 6450) +++ trunk/scipy/special/lambertw.c 2010-05-31 08:40:26 UTC (rev 6451) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12 on Thu Dec 31 12:01:02 2009 */ +/* Generated by Cython 0.12.1 on Mon May 31 10:16:35 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -36,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -60,18 +64,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type @@ -80,6 +88,7 @@ #define PyBytes_Type PyString_Type #define PyBytes_CheckExact PyString_CheckExact #endif + #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) @@ -99,10 +108,13 @@ #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -116,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -125,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -144,12 +158,14 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -171,8 +187,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -236,9 +252,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -286,6 +302,11 @@ #endif #endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; @@ -373,15 +394,7 @@ #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #endif -#else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); -#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) @@ -400,15 +413,15 @@ /*#define __Pyx_c_abs(z) (cabs(z))*/ #endif #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ @@ -419,57 +432,68 @@ PyComplex_FromDoubles((double)__Pyx_CREAL(z), \ (double)__Pyx_CIMAG(z)) -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); -static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +#ifndef __PYX_FORCE_INIT_THREADS + #if PY_VERSION_HEX < 0x02040200 + #define __PYX_FORCE_INIT_THREADS 1 + #else + #define __PYX_FORCE_INIT_THREADS 0 + #endif +#endif +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + static void __Pyx_WriteUnraisable(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cython */ + /* Module declarations from scipy.special.lambertw */ static PyUFuncGenericFunction __pyx_v_5scipy_7special_8lambertw__loop_funcs[1]; static char __pyx_v_5scipy_7special_8lambertw__inp_outp_types[4]; static void *__pyx_v_5scipy_7special_8lambertw_the_func_to_apply[1]; -static INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex); /*proto*/ -static INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex); /*proto*/ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex); /*proto*/ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex); /*proto*/ +static void __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_t_double_complex); /*proto*/ static __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_lambertw_scalar(__pyx_t_double_complex, long, double); /*proto*/ static void __pyx_f_5scipy_7special_8lambertw__apply_func_to_1d_vec(char **, npy_intp *, npy_intp *, void *); /*proto*/ #define __Pyx_MODULE_NAME "scipy.special.lambertw" @@ -479,7 +503,7 @@ static PyObject *__pyx_builtin_range; static char __pyx_k_1[] = "Lambert W iteration failed to converge: %r"; static char __pyx_k_3[] = ""; -static char __pyx_k_4[] = "lambertw (line 194)"; +static char __pyx_k_4[] = "lambertw (line 193)"; static char __pyx_k__k[] = "k"; static char __pyx_k__z[] = "z"; static char __pyx_k__tol[] = "tol"; @@ -509,27 +533,26 @@ static PyObject *__pyx_int_0; static PyObject *__pyx_k_2; -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":47 - * enum NPY_DISABLE_C_API: NPY_DISABLE_C_API +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":44 + * double NPY_PI * - * cdef inline bint zisnan(double complex x): # <<<<<<<<<<<<<< + * cdef inline bint zisnan(double complex x) nogil: # <<<<<<<<<<<<<< * return npy_isnan(x.real) or npy_isnan(x.imag) * */ -static INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex __pyx_v_x) { int __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("zisnan"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":48 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":45 * - * cdef inline bint zisnan(double complex x): + * cdef inline bint zisnan(double complex x) nogil: * return npy_isnan(x.real) or npy_isnan(x.imag) # <<<<<<<<<<<<<< * - * cdef inline double zabs(double complex x): + * cdef inline double zabs(double complex x) nogil: */ __pyx_t_1 = npy_isnan(__Pyx_CREAL(__pyx_v_x)); if (!__pyx_t_1) { @@ -543,25 +566,23 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":50 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":47 * return npy_isnan(x.real) or npy_isnan(x.imag) * - * cdef inline double zabs(double complex x): # <<<<<<<<<<<<<< + * cdef inline double zabs(double complex x) nogil: # <<<<<<<<<<<<<< * cdef double r * r = npy_cabs((&x)[0]) */ -static INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex __pyx_v_x) { double __pyx_v_r; double __pyx_r; - __Pyx_RefNannySetupContext("zabs"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":52 - * cdef inline double zabs(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":49 + * cdef inline double zabs(double complex x) nogil: * cdef double r * r = npy_cabs((&x)[0]) # <<<<<<<<<<<<<< * return r @@ -569,37 +590,35 @@ */ __pyx_v_r = npy_cabs((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":53 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":50 * cdef double r * r = npy_cabs((&x)[0]) * return r # <<<<<<<<<<<<<< * - * cdef inline double complex zlog(double complex x): + * cdef inline double complex zlog(double complex x) nogil: */ __pyx_r = __pyx_v_r; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":55 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":52 * return r * - * cdef inline double complex zlog(double complex x): # <<<<<<<<<<<<<< + * cdef inline double complex zlog(double complex x) nogil: # <<<<<<<<<<<<<< * cdef npy_cdouble r * r = npy_clog((&x)[0]) */ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex __pyx_v_x) { npy_cdouble __pyx_v_r; __pyx_t_double_complex __pyx_r; - __Pyx_RefNannySetupContext("zlog"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":57 - * cdef inline double complex zlog(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":54 + * cdef inline double complex zlog(double complex x) nogil: * cdef npy_cdouble r * r = npy_clog((&x)[0]) # <<<<<<<<<<<<<< * return (&r)[0] @@ -607,37 +626,35 @@ */ __pyx_v_r = npy_clog((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":58 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":55 * cdef npy_cdouble r * r = npy_clog((&x)[0]) * return (&r)[0] # <<<<<<<<<<<<<< * - * cdef inline double complex zexp(double complex x): + * cdef inline double complex zexp(double complex x) nogil: */ __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_r))[0]); goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":60 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":57 * return (&r)[0] * - * cdef inline double complex zexp(double complex x): # <<<<<<<<<<<<<< + * cdef inline double complex zexp(double complex x) nogil: # <<<<<<<<<<<<<< * cdef npy_cdouble r * r = npy_cexp((&x)[0]) */ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex __pyx_v_x) { npy_cdouble __pyx_v_r; __pyx_t_double_complex __pyx_r; - __Pyx_RefNannySetupContext("zexp"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":62 - * cdef inline double complex zexp(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":59 + * cdef inline double complex zexp(double complex x) nogil: * cdef npy_cdouble r * r = npy_cexp((&x)[0]) # <<<<<<<<<<<<<< * return (&r)[0] @@ -645,26 +662,79 @@ */ __pyx_v_r = npy_cexp((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":63 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":60 * cdef npy_cdouble r * r = npy_cexp((&x)[0]) * return (&r)[0] # <<<<<<<<<<<<<< * - * # Heavy lifting is here: + * cdef void lambertw_raise_warning(double complex z) with gil: */ __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_r))[0]); goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":67 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":62 + * return (&r)[0] + * + * cdef void lambertw_raise_warning(double complex z) with gil: # <<<<<<<<<<<<<< + * warnings.warn("Lambert W iteration failed to converge: %r" % z) + * + */ + +static void __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_t_double_complex __pyx_v_z) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_RefNannySetupContext("lambertw_raise_warning"); + + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":63 + * + * cdef void lambertw_raise_warning(double complex z) with gil: + * warnings.warn("Lambert W iteration failed to converge: %r" % z) # <<<<<<<<<<<<<< + * * # Heavy lifting is here: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("scipy.special.lambertw.lambertw_raise_warning"); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + PyGILState_Release(_save); +} + +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":68 * - * cdef double complex lambertw_scalar(double complex z, long k, double tol): # <<<<<<<<<<<<<< + * @cython.cdivision(True) + * cdef double complex lambertw_scalar(double complex z, long k, double tol) nogil: # <<<<<<<<<<<<<< * """ * This is just the implementation of W for a single input z. */ @@ -685,15 +755,8 @@ int __pyx_t_4; long __pyx_t_5; int __pyx_t_6; - __pyx_t_double_complex __pyx_t_7; - __pyx_t_double_complex __pyx_t_8; - __pyx_t_double_complex __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("lambertw_scalar"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":73 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":74 * """ * # Comments copied verbatim from [2] are marked with '>' * if zisnan(z): # <<<<<<<<<<<<<< @@ -703,7 +766,7 @@ __pyx_t_1 = __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_v_z); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":74 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":75 * # Comments copied verbatim from [2] are marked with '>' * if zisnan(z): * return z # <<<<<<<<<<<<<< @@ -716,7 +779,7 @@ } __pyx_L3:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":81 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":82 * #> We must be extremely careful near the singularities at -1/e and 0 * cdef double u * u = exp(-1) # <<<<<<<<<<<<<< @@ -725,7 +788,7 @@ */ __pyx_v_u = exp(-1); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":84 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":85 * * cdef double absz * absz = zabs(z) # <<<<<<<<<<<<<< @@ -734,7 +797,7 @@ */ __pyx_v_absz = __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":85 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":86 * cdef double absz * absz = zabs(z) * if absz <= u: # <<<<<<<<<<<<<< @@ -744,7 +807,7 @@ __pyx_t_1 = (__pyx_v_absz <= __pyx_v_u); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":86 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":87 * absz = zabs(z) * if absz <= u: * if z == 0: # <<<<<<<<<<<<<< @@ -754,7 +817,7 @@ __pyx_t_1 = (__Pyx_c_eq(__pyx_v_z, __pyx_t_double_complex_from_parts(0, 0))); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":88 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":89 * if z == 0: * #> w(0,0) = 0; for all other branches we hit the pole * if k == 0: # <<<<<<<<<<<<<< @@ -764,7 +827,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":89 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":90 * #> w(0,0) = 0; for all other branches we hit the pole * if k == 0: * return z # <<<<<<<<<<<<<< @@ -777,7 +840,7 @@ } __pyx_L6:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":90 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":91 * if k == 0: * return z * return -NPY_INFINITY # <<<<<<<<<<<<<< @@ -790,7 +853,7 @@ } __pyx_L5:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":92 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":93 * return -NPY_INFINITY * * if k == 0: # <<<<<<<<<<<<<< @@ -800,7 +863,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":93 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":94 * * if k == 0: * w = z # Initial guess for iteration # <<<<<<<<<<<<<< @@ -811,7 +874,7 @@ goto __pyx_L7; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":95 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":96 * w = z # Initial guess for iteration * #> For small real z < 0, the -1 branch beaves roughly like log(-z) * elif k == -1 and z.imag ==0 and z.real < 0: # <<<<<<<<<<<<<< @@ -833,7 +896,7 @@ } if (__pyx_t_2) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":96 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":97 * #> For small real z < 0, the -1 branch beaves roughly like log(-z) * elif k == -1 and z.imag ==0 and z.real < 0: * w = log(-z.real) # <<<<<<<<<<<<<< @@ -845,7 +908,7 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":99 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":100 * #> Use a simple asymptotic approximation. * else: * w = zlog(z) # <<<<<<<<<<<<<< @@ -854,7 +917,7 @@ */ __pyx_v_w = __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":103 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":104 * #> gets better for large |k|; need to check that this always * #> works for k ~= -1, 0, 1. * if k: w = w + k*2*NPY_PI*1j # <<<<<<<<<<<<<< @@ -872,7 +935,7 @@ goto __pyx_L4; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":105 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":106 * if k: w = w + k*2*NPY_PI*1j * * elif k == 0 and z.imag and zabs(z) <= 0.7: # <<<<<<<<<<<<<< @@ -893,7 +956,7 @@ } if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":109 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":110 * #> down around z ~= -0.5 (converging to the wrong branch), so patch * #> with a constant approximation (adjusted for sign) * if zabs(z+0.5) < 0.1: # <<<<<<<<<<<<<< @@ -903,7 +966,7 @@ __pyx_t_1 = (__pyx_f_5scipy_7special_8lambertw_zabs(__Pyx_c_sum(__pyx_v_z, __pyx_t_double_complex_from_parts(0.5, 0))) < 0.10000000000000001); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":110 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":111 * #> with a constant approximation (adjusted for sign) * if zabs(z+0.5) < 0.1: * if z.imag > 0: # <<<<<<<<<<<<<< @@ -913,7 +976,7 @@ __pyx_t_1 = (__Pyx_CIMAG(__pyx_v_z) > 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":111 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":112 * if zabs(z+0.5) < 0.1: * if z.imag > 0: * w = 0.7 + 0.7j # <<<<<<<<<<<<<< @@ -925,24 +988,35 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":113 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":114 * w = 0.7 + 0.7j * else: * w = 0.7 - 0.7j # <<<<<<<<<<<<<< - * - * else: + * else: + * w = z */ __pyx_v_w = __Pyx_c_diff(__pyx_t_double_complex_from_parts(0.69999999999999996, 0), __pyx_t_double_complex_from_parts(0, 0.69999999999999996)); } __pyx_L10:; goto __pyx_L9; } + /*else*/ { + + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":116 + * w = 0.7 - 0.7j + * else: + * w = z # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_v_w = __pyx_v_z; + } __pyx_L9:; goto __pyx_L4; } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":116 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":119 * * else: * if z.real == NPY_INFINITY: # <<<<<<<<<<<<<< @@ -952,7 +1026,7 @@ __pyx_t_1 = (__Pyx_CREAL(__pyx_v_z) == NPY_INFINITY); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":117 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":120 * else: * if z.real == NPY_INFINITY: * if k == 0: # <<<<<<<<<<<<<< @@ -962,7 +1036,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":118 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":121 * if z.real == NPY_INFINITY: * if k == 0: * return z # <<<<<<<<<<<<<< @@ -975,7 +1049,7 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":120 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":123 * return z * else: * return z + 2*k*NPY_PI*1j # <<<<<<<<<<<<<< @@ -990,7 +1064,7 @@ } __pyx_L11:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":122 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":125 * return z + 2*k*NPY_PI*1j * * if z.real == -NPY_INFINITY: # <<<<<<<<<<<<<< @@ -1000,7 +1074,7 @@ __pyx_t_1 = (__Pyx_CREAL(__pyx_v_z) == (-NPY_INFINITY)); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":123 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":126 * * if z.real == -NPY_INFINITY: * return (-z) + (2*k+1)*NPY_PI*1j # <<<<<<<<<<<<<< @@ -1013,7 +1087,7 @@ } __pyx_L13:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":126 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":129 * * #> Simple asymptotic approximation as above * w = zlog(z) # <<<<<<<<<<<<<< @@ -1022,7 +1096,7 @@ */ __pyx_v_w = __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":127 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":130 * #> Simple asymptotic approximation as above * w = zlog(z) * if k: w = w + k*2*NPY_PI*1j # <<<<<<<<<<<<<< @@ -1038,7 +1112,7 @@ } __pyx_L4:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":132 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":135 * cdef double complex ew, wew, wewz, wn * cdef int i * for i in range(100): # <<<<<<<<<<<<<< @@ -1048,7 +1122,7 @@ for (__pyx_t_6 = 0; __pyx_t_6 < 100; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":133 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":136 * cdef int i * for i in range(100): * ew = zexp(w) # <<<<<<<<<<<<<< @@ -1057,7 +1131,7 @@ */ __pyx_v_ew = __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_v_w); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":134 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":137 * for i in range(100): * ew = zexp(w) * wew = w*ew # <<<<<<<<<<<<<< @@ -1066,7 +1140,7 @@ */ __pyx_v_wew = __Pyx_c_prod(__pyx_v_w, __pyx_v_ew); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":135 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":138 * ew = zexp(w) * wew = w*ew * wewz = wew-z # <<<<<<<<<<<<<< @@ -1075,27 +1149,16 @@ */ __pyx_v_wewz = __Pyx_c_diff(__pyx_v_wew, __pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":136 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":139 * wew = w*ew * wewz = wew-z * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) # <<<<<<<<<<<<<< * if zabs(wn-w) < tol*zabs(wn): * return wn */ - __pyx_t_7 = __Pyx_c_prod(__Pyx_c_sum(__pyx_v_w, __pyx_t_double_complex_from_parts(2, 0)), __pyx_v_wewz); - __pyx_t_8 = __Pyx_c_sum(__Pyx_c_prod(__pyx_t_double_complex_from_parts(2, 0), __pyx_v_w), __pyx_t_double_complex_from_parts(2, 0)); - if (unlikely(__Pyx_c_is_zero(__pyx_t_8))) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = __Pyx_c_diff(__Pyx_c_sum(__pyx_v_wew, __pyx_v_ew), __Pyx_c_quot(__pyx_t_7, __pyx_t_8)); - if (unlikely(__Pyx_c_is_zero(__pyx_t_9))) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_wn = __Pyx_c_diff(__pyx_v_w, __Pyx_c_quot(__pyx_v_wewz, __pyx_t_9)); + __pyx_v_wn = __Pyx_c_diff(__pyx_v_w, __Pyx_c_quot(__pyx_v_wewz, __Pyx_c_diff(__Pyx_c_sum(__pyx_v_wew, __pyx_v_ew), __Pyx_c_quot(__Pyx_c_prod(__Pyx_c_sum(__pyx_v_w, __pyx_t_double_complex_from_parts(2, 0)), __pyx_v_wewz), __Pyx_c_sum(__Pyx_c_prod(__pyx_t_double_complex_from_parts(2, 0), __pyx_v_w), __pyx_t_double_complex_from_parts(2, 0)))))); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":137 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":140 * wewz = wew-z * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) * if zabs(wn-w) < tol*zabs(wn): # <<<<<<<<<<<<<< @@ -1105,7 +1168,7 @@ __pyx_t_1 = (__pyx_f_5scipy_7special_8lambertw_zabs(__Pyx_c_diff(__pyx_v_wn, __pyx_v_w)) < (__pyx_v_tol * __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_v_wn))); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":138 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":141 * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) * if zabs(wn-w) < tol*zabs(wn): * return wn # <<<<<<<<<<<<<< @@ -1118,89 +1181,30 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":140 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":143 * return wn * else: * w = wn # <<<<<<<<<<<<<< * - * if True: + * lambertw_raise_warning(z) */ __pyx_v_w = __pyx_v_wn; } __pyx_L17:; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":142 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":145 * w = wn * - * if True: # <<<<<<<<<<<<<< - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API - */ - __pyx_t_1 = 1; - if (__pyx_t_1) { - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":143 - * - * if True: - * NPY_ALLOW_C_API_DEF # <<<<<<<<<<<<<< - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - */ - NPY_ALLOW_C_API_DEF; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":144 - * if True: - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API # <<<<<<<<<<<<<< - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API - */ - NPY_ALLOW_C_API; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":145 - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) # <<<<<<<<<<<<<< - * NPY_DISABLE_C_API + * lambertw_raise_warning(z) # <<<<<<<<<<<<<< * return wn - */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__warn); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __pyx_PyComplex_FromComplex(__pyx_v_z); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":146 - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API # <<<<<<<<<<<<<< - * return wn * */ - NPY_DISABLE_C_API; - goto __pyx_L18; - } - __pyx_L18:; + __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":147 - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":146 + * + * lambertw_raise_warning(z) * return wn # <<<<<<<<<<<<<< * * @@ -1209,23 +1213,15 @@ goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_WriteUnraisable("scipy.special.lambertw.lambertw_scalar"); - __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":167 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":166 * int identity, char* name, char* doc, int c) * * cdef void _apply_func_to_1d_vec(char **args, npy_intp *dimensions, npy_intp *steps, # <<<<<<<<<<<<<< - * void *func): + * void *func) nogil: * cdef npy_intp i */ @@ -1237,42 +1233,41 @@ char *__pyx_v_op; npy_intp __pyx_t_1; npy_intp __pyx_t_2; - __Pyx_RefNannySetupContext("_apply_func_to_1d_vec"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":170 - * void *func): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":169 + * void *func) nogil: * cdef npy_intp i * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] # <<<<<<<<<<<<<< * for i in range(0, dimensions[0]): - * (op)[0] = (func)( + * (op)[0] = (func)( */ __pyx_v_ip1 = (__pyx_v_args[0]); __pyx_v_ip2 = (__pyx_v_args[1]); __pyx_v_ip3 = (__pyx_v_args[2]); __pyx_v_op = (__pyx_v_args[3]); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":171 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":170 * cdef npy_intp i * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] * for i in range(0, dimensions[0]): # <<<<<<<<<<<<<< - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0], (ip3)[0]) */ __pyx_t_1 = (__pyx_v_dimensions[0]); for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":172 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":171 * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] * for i in range(0, dimensions[0]): - * (op)[0] = (func)( # <<<<<<<<<<<<<< + * (op)[0] = (func)( # <<<<<<<<<<<<<< * (ip1)[0], (ip2)[0], (ip3)[0]) * ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] */ (((__pyx_t_double_complex *)__pyx_v_op)[0]) = ((__pyx_t_double_complex (*)(__pyx_t_double_complex, long, double))__pyx_v_func)((((__pyx_t_double_complex *)__pyx_v_ip1)[0]), (((long *)__pyx_v_ip2)[0]), (((double *)__pyx_v_ip3)[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":174 - * (op)[0] = (func)( + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":173 + * (op)[0] = (func)( * (ip1)[0], (ip2)[0], (ip3)[0]) * ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] # <<<<<<<<<<<<<< * @@ -1284,10 +1279,9 @@ __pyx_v_op += (__pyx_v_steps[3]); } - __Pyx_RefNannyFinishContext(); } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":194 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":193 * _inp_outp_types, 1, 3, 1, 0, "", "", 0) * * def lambertw(z, k=0, tol=1e-8): # <<<<<<<<<<<<<< @@ -1337,7 +1331,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lambertw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lambertw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_z = values[0]; __pyx_v_k = values[1]; @@ -1355,22 +1349,22 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambertw", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lambertw", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scipy.special.lambertw.lambertw"); return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":341 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":340 * * """ * return _lambertw(z, k, tol) # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___lambertw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___lambertw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_z); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_z); @@ -1381,7 +1375,7 @@ __Pyx_INCREF(__pyx_v_tol); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_tol); __Pyx_GIVEREF(__pyx_v_tol); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -1442,7 +1436,7 @@ {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -1519,19 +1513,19 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":23 - * # at `-1/e` and make sure that the proper branch is chosen there + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":24 * + * import cython * import warnings # <<<<<<<<<<<<<< * * cdef extern from "math.h": */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":177 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":176 * * cdef PyUFuncGenericFunction _loop_funcs[1] * _loop_funcs[0] = _apply_func_to_1d_vec # <<<<<<<<<<<<<< @@ -1540,7 +1534,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__loop_funcs[0]) = __pyx_f_5scipy_7special_8lambertw__apply_func_to_1d_vec; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":180 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":179 * * cdef char _inp_outp_types[4] * _inp_outp_types[0] = NPY_CDOUBLE # <<<<<<<<<<<<<< @@ -1549,7 +1543,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[0]) = NPY_CDOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":181 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":180 * cdef char _inp_outp_types[4] * _inp_outp_types[0] = NPY_CDOUBLE * _inp_outp_types[1] = NPY_LONG # <<<<<<<<<<<<<< @@ -1558,7 +1552,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[1]) = NPY_LONG; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":182 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":181 * _inp_outp_types[0] = NPY_CDOUBLE * _inp_outp_types[1] = NPY_LONG * _inp_outp_types[2] = NPY_DOUBLE # <<<<<<<<<<<<<< @@ -1567,7 +1561,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[2]) = NPY_DOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":183 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":182 * _inp_outp_types[1] = NPY_LONG * _inp_outp_types[2] = NPY_DOUBLE * _inp_outp_types[3] = NPY_CDOUBLE # <<<<<<<<<<<<<< @@ -1576,7 +1570,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[3]) = NPY_CDOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":185 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":184 * _inp_outp_types[3] = NPY_CDOUBLE * * import_array() # <<<<<<<<<<<<<< @@ -1585,7 +1579,7 @@ */ import_array(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":186 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":185 * * import_array() * import_ufunc() # <<<<<<<<<<<<<< @@ -1594,7 +1588,7 @@ */ import_ufunc(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":190 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":189 * # The actual ufunc declaration: * cdef void *the_func_to_apply[1] * the_func_to_apply[0] = lambertw_scalar # <<<<<<<<<<<<<< @@ -1603,32 +1597,32 @@ */ (__pyx_v_5scipy_7special_8lambertw_the_func_to_apply[0]) = ((void *)__pyx_f_5scipy_7special_8lambertw_lambertw_scalar); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":192 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":191 * the_func_to_apply[0] = lambertw_scalar * _lambertw = PyUFunc_FromFuncAndData(_loop_funcs, the_func_to_apply, * _inp_outp_types, 1, 3, 1, 0, "", "", 0) # <<<<<<<<<<<<<< * * def lambertw(z, k=0, tol=1e-8): */ - __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_8lambertw__loop_funcs, __pyx_v_5scipy_7special_8lambertw_the_func_to_apply, __pyx_v_5scipy_7special_8lambertw__inp_outp_types, 1, 3, 1, 0, __pyx_k_3, __pyx_k_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_8lambertw__loop_funcs, __pyx_v_5scipy_7special_8lambertw_the_func_to_apply, __pyx_v_5scipy_7special_8lambertw__inp_outp_types, 1, 3, 1, 0, __pyx_k_3, __pyx_k_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___lambertw, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___lambertw, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":194 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":193 * _inp_outp_types, 1, 3, 1, 0, "", "", 0) * * def lambertw(z, k=0, tol=1e-8): # <<<<<<<<<<<<<< * r""" * lambertw(z, k=0, tol=1e-8) */ - __pyx_t_1 = PyFloat_FromDouble(1e-08); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1e-08); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_2 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":1 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":1 * # Implementation of the Lambert W function [1]. Based on the MPMath # <<<<<<<<<<<<<< * # implementation [2], and documentaion [3]. * # @@ -1798,70 +1792,70 @@ #if CYTHON_CCOMPLEX #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if HAVE_HYPOT return hypot(z.real, z.imag); #else @@ -1912,7 +1906,7 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) < sizeof(long)) { @@ -1930,7 +1924,7 @@ } } -static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) == sizeof(char)) { @@ -1971,7 +1965,7 @@ return (npy_intp)-1; } -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { @@ -1990,7 +1984,7 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { @@ -2009,7 +2003,7 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { @@ -2028,7 +2022,7 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { @@ -2047,7 +2041,7 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { @@ -2066,7 +2060,7 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { @@ -2085,7 +2079,7 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { @@ -2104,7 +2098,7 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { @@ -2123,7 +2117,7 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { @@ -2142,7 +2136,7 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2177,7 +2171,7 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2212,7 +2206,7 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2247,7 +2241,7 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2282,7 +2276,7 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2317,7 +2311,7 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2352,7 +2346,7 @@ } } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -2367,7 +2361,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -2499,13 +2493,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -2551,7 +2545,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -2560,7 +2554,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -2574,7 +2568,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: trunk/scipy/special/orthogonal_eval.c =================================================================== --- trunk/scipy/special/orthogonal_eval.c 2010-05-31 08:40:20 UTC (rev 6450) +++ trunk/scipy/special/orthogonal_eval.c 2010-05-31 08:40:26 UTC (rev 6451) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12 on Wed Mar 31 17:45:34 2010 */ +/* Generated by Cython 0.12.1 on Mon May 31 10:17:30 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -36,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -60,18 +64,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type @@ -80,6 +88,7 @@ #define PyBytes_Type PyString_Type #define PyBytes_CheckExact PyString_CheckExact #endif + #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) @@ -99,10 +108,13 @@ #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -116,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -125,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -143,12 +157,14 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -170,8 +186,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -235,9 +251,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -323,9 +339,9 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ @@ -334,42 +350,42 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static void __Pyx_AddTraceback(const char *funcname); /*proto*/ @@ -511,9 +527,9 @@ static PyObject *__pyx_int_neg_1; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":24 - * double sqrt(double x) + * double sqrt(double x) nogil * - * cdef double eval_poly_chebyt(long k, double x): # <<<<<<<<<<<<<< + * cdef double eval_poly_chebyt(long k, double x) nogil: # <<<<<<<<<<<<<< * # Use Chebyshev T recurrence directly, see [MH] * cdef long m */ @@ -525,7 +541,7 @@ double __pyx_v_b0; double __pyx_r; long __pyx_t_1; - __Pyx_RefNannySetupContext("eval_poly_chebyt"); + long __pyx_t_2; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":29 * cdef double b2, b1, b0 @@ -550,7 +566,7 @@ * b1 = -1 * b0 = 0 # <<<<<<<<<<<<<< * x = 2*x - * for m in range(k+1, 0, -1): + * for m in range(k+1): */ __pyx_v_b0 = 0; @@ -558,7 +574,7 @@ * b1 = -1 * b0 = 0 * x = 2*x # <<<<<<<<<<<<<< - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 */ __pyx_v_x = (2 * __pyx_v_x); @@ -566,16 +582,17 @@ /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":33 * b0 = 0 * x = 2*x - * for m in range(k+1, 0, -1): # <<<<<<<<<<<<<< + * for m in range(k+1): # <<<<<<<<<<<<<< * b2 = b1 * b1 = b0 */ - for (__pyx_t_1 = (__pyx_v_k + 1); __pyx_t_1 > 0; __pyx_t_1-=1) { - __pyx_v_m = __pyx_t_1; + __pyx_t_1 = (__pyx_v_k + 1); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_m = __pyx_t_2; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":34 * x = 2*x - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 # <<<<<<<<<<<<<< * b1 = b0 * b0 = x*b1 - b2 @@ -583,7 +600,7 @@ __pyx_v_b2 = __pyx_v_b1; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":35 - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 * b1 = b0 # <<<<<<<<<<<<<< * b0 = x*b1 - b2 @@ -613,7 +630,6 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -621,7 +637,7 @@ * int identity, char* name, char* doc, int c) * * cdef void _loop_id_d(char **args, npy_intp *dimensions, npy_intp *steps, # <<<<<<<<<<<<<< - * void *func): + * void *func) nogil: * cdef int i */ @@ -632,14 +648,13 @@ char *__pyx_v_op; npy_intp __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("_loop_id_d"); /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":61 * cdef int i * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] # <<<<<<<<<<<<<< * for i in range(0, dimensions[0]): - * (op)[0] = (func)( + * (op)[0] = (func)( */ __pyx_v_ip1 = (__pyx_v_args[0]); __pyx_v_ip2 = (__pyx_v_args[1]); @@ -649,7 +664,7 @@ * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): # <<<<<<<<<<<<<< - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0]) */ __pyx_t_1 = (__pyx_v_dimensions[0]); @@ -659,14 +674,14 @@ /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":63 * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): - * (op)[0] = (func)( # <<<<<<<<<<<<<< + * (op)[0] = (func)( # <<<<<<<<<<<<<< * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] */ (((double *)__pyx_v_op)[0]) = ((double (*)(long, double))__pyx_v_func)((((long *)__pyx_v_ip1)[0]), (((double *)__pyx_v_ip2)[0])); /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":65 - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] # <<<<<<<<<<<<<< * @@ -677,7 +692,6 @@ __pyx_v_op += (__pyx_v_steps[2]); } - __Pyx_RefNannyFinishContext(); } /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":96 @@ -4376,7 +4390,7 @@ return -1; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, @@ -4386,7 +4400,7 @@ (index == 1) ? "" : "s"); } -static INLINE void __Pyx_RaiseTooManyValuesError(void) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } @@ -4454,7 +4468,7 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) < sizeof(long)) { @@ -4472,7 +4486,7 @@ } } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -4487,7 +4501,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -4609,7 +4623,7 @@ } #endif -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { @@ -4628,7 +4642,7 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { @@ -4647,7 +4661,7 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { @@ -4666,7 +4680,7 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { @@ -4685,7 +4699,7 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { @@ -4704,7 +4718,7 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { @@ -4723,7 +4737,7 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { @@ -4742,7 +4756,7 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { @@ -4761,7 +4775,7 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { @@ -4780,7 +4794,7 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4815,7 +4829,7 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4850,7 +4864,7 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4885,7 +4899,7 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4920,7 +4934,7 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4955,7 +4969,7 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -5092,13 +5106,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -5144,7 +5158,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -5153,7 +5167,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -5167,7 +5181,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; From scipy-svn at scipy.org Mon May 31 04:45:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:45:45 -0500 (CDT) Subject: [Scipy-svn] r6452 - branches/0.8.x/scipy/special Message-ID: <20100531084545.CA18139CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:45:45 -0500 (Mon, 31 May 2010) New Revision: 6452 Modified: branches/0.8.x/scipy/special/lambertw.pyx Log: BUG: special: add a missing piece of code to lambertw, lost in python -> cython transcription (cherry picked from commit r6449) Modified: branches/0.8.x/scipy/special/lambertw.pyx =================================================================== --- branches/0.8.x/scipy/special/lambertw.pyx 2010-05-31 08:40:26 UTC (rev 6451) +++ branches/0.8.x/scipy/special/lambertw.pyx 2010-05-31 08:45:45 UTC (rev 6452) @@ -111,6 +111,8 @@ w = 0.7 + 0.7j else: w = 0.7 - 0.7j + else: + w = z else: if z.real == NPY_INFINITY: From scipy-svn at scipy.org Mon May 31 04:45:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:45:53 -0500 (CDT) Subject: [Scipy-svn] r6453 - branches/0.8.x/scipy/special Message-ID: <20100531084553.89CD939CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:45:53 -0500 (Mon, 31 May 2010) New Revision: 6453 Modified: branches/0.8.x/scipy/special/lambertw.pyx branches/0.8.x/scipy/special/orthogonal_eval.pyx Log: BUG: special: handle GIL safely inside the ufunc loops in Cython files (cherry picked from commit r6450) Modified: branches/0.8.x/scipy/special/lambertw.pyx =================================================================== --- branches/0.8.x/scipy/special/lambertw.pyx 2010-05-31 08:45:45 UTC (rev 6452) +++ branches/0.8.x/scipy/special/lambertw.pyx 2010-05-31 08:45:53 UTC (rev 6453) @@ -20,11 +20,12 @@ # TODO: use a series expansion when extremely close to the branch point # at `-1/e` and make sure that the proper branch is chosen there +import cython import warnings cdef extern from "math.h": - double exp(double x) - double log(double x) + double exp(double x) nogil + double log(double x) nogil # Use Numpy's portable C99-compatible complex functios @@ -33,38 +34,38 @@ double real double imag - double npy_cabs(npy_cdouble z) - npy_cdouble npy_clog(npy_cdouble z) - npy_cdouble npy_cexp(npy_cdouble z) - int npy_isnan(double x) + double npy_cabs(npy_cdouble z) nogil + npy_cdouble npy_clog(npy_cdouble z) nogil + npy_cdouble npy_cexp(npy_cdouble z) nogil + int npy_isnan(double x) nogil double NPY_INFINITY double NPY_PI - enum NPY_ALLOW_C_API_DEF: NPY_ALLOW_C_API_DEF - enum NPY_ALLOW_C_API: NPY_ALLOW_C_API - enum NPY_DISABLE_C_API: NPY_DISABLE_C_API - -cdef inline bint zisnan(double complex x): +cdef inline bint zisnan(double complex x) nogil: return npy_isnan(x.real) or npy_isnan(x.imag) -cdef inline double zabs(double complex x): +cdef inline double zabs(double complex x) nogil: cdef double r r = npy_cabs((&x)[0]) return r -cdef inline double complex zlog(double complex x): +cdef inline double complex zlog(double complex x) nogil: cdef npy_cdouble r r = npy_clog((&x)[0]) return (&r)[0] -cdef inline double complex zexp(double complex x): +cdef inline double complex zexp(double complex x) nogil: cdef npy_cdouble r r = npy_cexp((&x)[0]) return (&r)[0] +cdef void lambertw_raise_warning(double complex z) with gil: + warnings.warn("Lambert W iteration failed to converge: %r" % z) + # Heavy lifting is here: -cdef double complex lambertw_scalar(double complex z, long k, double tol): + at cython.cdivision(True) +cdef double complex lambertw_scalar(double complex z, long k, double tol) nogil: """ This is just the implementation of W for a single input z. See the docstring for lambertw() below for the full description. @@ -141,11 +142,7 @@ else: w = wn - if True: - NPY_ALLOW_C_API_DEF - NPY_ALLOW_C_API - warnings.warn("Lambert W iteration failed to converge: %r" % z) - NPY_DISABLE_C_API + lambertw_raise_warning(z) return wn @@ -167,11 +164,11 @@ int identity, char* name, char* doc, int c) cdef void _apply_func_to_1d_vec(char **args, npy_intp *dimensions, npy_intp *steps, - void *func): + void *func) nogil: cdef npy_intp i cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] for i in range(0, dimensions[0]): - (op)[0] = (func)( + (op)[0] = (func)( (ip1)[0], (ip2)[0], (ip3)[0]) ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] Modified: branches/0.8.x/scipy/special/orthogonal_eval.pyx =================================================================== --- branches/0.8.x/scipy/special/orthogonal_eval.pyx 2010-05-31 08:45:45 UTC (rev 6452) +++ branches/0.8.x/scipy/special/orthogonal_eval.pyx 2010-05-31 08:45:53 UTC (rev 6453) @@ -1,5 +1,6 @@ """ -Evaluate orthogonal polynomial values using recurrence relations. +Evaluate orthogonal polynomial values using recurrence relations +or by calling special functions. References ---------- @@ -19,9 +20,9 @@ #------------------------------------------------------------------------------ cdef extern from "math.h": - double sqrt(double x) + double sqrt(double x) nogil -cdef double eval_poly_chebyt(long k, double x): +cdef double eval_poly_chebyt(long k, double x) nogil: # Use Chebyshev T recurrence directly, see [MH] cdef long m cdef double b2, b1, b0 @@ -30,7 +31,7 @@ b1 = -1 b0 = 0 x = 2*x - for m in range(k+1, 0, -1): + for m in range(k+1): b2 = b1 b1 = b0 b0 = x*b1 - b2 @@ -55,12 +56,12 @@ int identity, char* name, char* doc, int c) cdef void _loop_id_d(char **args, npy_intp *dimensions, npy_intp *steps, - void *func): + void *func) nogil: cdef int i cdef double x cdef char *ip1=args[0], *ip2=args[1], *op=args[2] for i in range(0, dimensions[0]): - (op)[0] = (func)( + (op)[0] = (func)( (ip1)[0], (ip2)[0]) ip1 += steps[0]; ip2 += steps[1]; op += steps[2] From scipy-svn at scipy.org Mon May 31 04:46:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 03:46:01 -0500 (CDT) Subject: [Scipy-svn] r6454 - branches/0.8.x/scipy/special Message-ID: <20100531084601.DFAB839CAEA@scipy.org> Author: ptvirtan Date: 2010-05-31 03:46:01 -0500 (Mon, 31 May 2010) New Revision: 6454 Modified: branches/0.8.x/scipy/special/lambertw.c branches/0.8.x/scipy/special/orthogonal_eval.c Log: special: regenerate lambertw.c and orthogonal_eval.c from Cython sources (cherry picked from commit r6451) Modified: branches/0.8.x/scipy/special/lambertw.c =================================================================== --- branches/0.8.x/scipy/special/lambertw.c 2010-05-31 08:45:53 UTC (rev 6453) +++ branches/0.8.x/scipy/special/lambertw.c 2010-05-31 08:46:01 UTC (rev 6454) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12 on Thu Dec 31 12:01:02 2009 */ +/* Generated by Cython 0.12.1 on Mon May 31 10:16:35 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -36,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -60,18 +64,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type @@ -80,6 +88,7 @@ #define PyBytes_Type PyString_Type #define PyBytes_CheckExact PyString_CheckExact #endif + #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) @@ -99,10 +108,13 @@ #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -116,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -125,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -144,12 +158,14 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -171,8 +187,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -236,9 +252,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -286,6 +302,11 @@ #endif #endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; @@ -373,15 +394,7 @@ #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #endif -#else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); -#endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) @@ -400,15 +413,15 @@ /*#define __Pyx_c_abs(z) (cabs(z))*/ #endif #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ #endif static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ @@ -419,57 +432,68 @@ PyComplex_FromDoubles((double)__Pyx_CREAL(z), \ (double)__Pyx_CIMAG(z)) -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); -static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject *); -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +#ifndef __PYX_FORCE_INIT_THREADS + #if PY_VERSION_HEX < 0x02040200 + #define __PYX_FORCE_INIT_THREADS 1 + #else + #define __PYX_FORCE_INIT_THREADS 0 + #endif +#endif +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + static void __Pyx_WriteUnraisable(const char *name); /*proto*/ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cython */ + /* Module declarations from scipy.special.lambertw */ static PyUFuncGenericFunction __pyx_v_5scipy_7special_8lambertw__loop_funcs[1]; static char __pyx_v_5scipy_7special_8lambertw__inp_outp_types[4]; static void *__pyx_v_5scipy_7special_8lambertw_the_func_to_apply[1]; -static INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex); /*proto*/ -static INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex); /*proto*/ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex); /*proto*/ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex); /*proto*/ +static void __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_t_double_complex); /*proto*/ static __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_lambertw_scalar(__pyx_t_double_complex, long, double); /*proto*/ static void __pyx_f_5scipy_7special_8lambertw__apply_func_to_1d_vec(char **, npy_intp *, npy_intp *, void *); /*proto*/ #define __Pyx_MODULE_NAME "scipy.special.lambertw" @@ -479,7 +503,7 @@ static PyObject *__pyx_builtin_range; static char __pyx_k_1[] = "Lambert W iteration failed to converge: %r"; static char __pyx_k_3[] = ""; -static char __pyx_k_4[] = "lambertw (line 194)"; +static char __pyx_k_4[] = "lambertw (line 193)"; static char __pyx_k__k[] = "k"; static char __pyx_k__z[] = "z"; static char __pyx_k__tol[] = "tol"; @@ -509,27 +533,26 @@ static PyObject *__pyx_int_0; static PyObject *__pyx_k_2; -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":47 - * enum NPY_DISABLE_C_API: NPY_DISABLE_C_API +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":44 + * double NPY_PI * - * cdef inline bint zisnan(double complex x): # <<<<<<<<<<<<<< + * cdef inline bint zisnan(double complex x) nogil: # <<<<<<<<<<<<<< * return npy_isnan(x.real) or npy_isnan(x.imag) * */ -static INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE int __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_t_double_complex __pyx_v_x) { int __pyx_r; int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("zisnan"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":48 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":45 * - * cdef inline bint zisnan(double complex x): + * cdef inline bint zisnan(double complex x) nogil: * return npy_isnan(x.real) or npy_isnan(x.imag) # <<<<<<<<<<<<<< * - * cdef inline double zabs(double complex x): + * cdef inline double zabs(double complex x) nogil: */ __pyx_t_1 = npy_isnan(__Pyx_CREAL(__pyx_v_x)); if (!__pyx_t_1) { @@ -543,25 +566,23 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":50 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":47 * return npy_isnan(x.real) or npy_isnan(x.imag) * - * cdef inline double zabs(double complex x): # <<<<<<<<<<<<<< + * cdef inline double zabs(double complex x) nogil: # <<<<<<<<<<<<<< * cdef double r * r = npy_cabs((&x)[0]) */ -static INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE double __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_t_double_complex __pyx_v_x) { double __pyx_v_r; double __pyx_r; - __Pyx_RefNannySetupContext("zabs"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":52 - * cdef inline double zabs(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":49 + * cdef inline double zabs(double complex x) nogil: * cdef double r * r = npy_cabs((&x)[0]) # <<<<<<<<<<<<<< * return r @@ -569,37 +590,35 @@ */ __pyx_v_r = npy_cabs((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":53 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":50 * cdef double r * r = npy_cabs((&x)[0]) * return r # <<<<<<<<<<<<<< * - * cdef inline double complex zlog(double complex x): + * cdef inline double complex zlog(double complex x) nogil: */ __pyx_r = __pyx_v_r; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":55 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":52 * return r * - * cdef inline double complex zlog(double complex x): # <<<<<<<<<<<<<< + * cdef inline double complex zlog(double complex x) nogil: # <<<<<<<<<<<<<< * cdef npy_cdouble r * r = npy_clog((&x)[0]) */ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_t_double_complex __pyx_v_x) { npy_cdouble __pyx_v_r; __pyx_t_double_complex __pyx_r; - __Pyx_RefNannySetupContext("zlog"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":57 - * cdef inline double complex zlog(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":54 + * cdef inline double complex zlog(double complex x) nogil: * cdef npy_cdouble r * r = npy_clog((&x)[0]) # <<<<<<<<<<<<<< * return (&r)[0] @@ -607,37 +626,35 @@ */ __pyx_v_r = npy_clog((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":58 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":55 * cdef npy_cdouble r * r = npy_clog((&x)[0]) * return (&r)[0] # <<<<<<<<<<<<<< * - * cdef inline double complex zexp(double complex x): + * cdef inline double complex zexp(double complex x) nogil: */ __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_r))[0]); goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":60 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":57 * return (&r)[0] * - * cdef inline double complex zexp(double complex x): # <<<<<<<<<<<<<< + * cdef inline double complex zexp(double complex x) nogil: # <<<<<<<<<<<<<< * cdef npy_cdouble r * r = npy_cexp((&x)[0]) */ -static INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex __pyx_v_x) { +static CYTHON_INLINE __pyx_t_double_complex __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_t_double_complex __pyx_v_x) { npy_cdouble __pyx_v_r; __pyx_t_double_complex __pyx_r; - __Pyx_RefNannySetupContext("zexp"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":62 - * cdef inline double complex zexp(double complex x): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":59 + * cdef inline double complex zexp(double complex x) nogil: * cdef npy_cdouble r * r = npy_cexp((&x)[0]) # <<<<<<<<<<<<<< * return (&r)[0] @@ -645,26 +662,79 @@ */ __pyx_v_r = npy_cexp((((npy_cdouble *)(&__pyx_v_x))[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":63 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":60 * cdef npy_cdouble r * r = npy_cexp((&x)[0]) * return (&r)[0] # <<<<<<<<<<<<<< * - * # Heavy lifting is here: + * cdef void lambertw_raise_warning(double complex z) with gil: */ __pyx_r = (((__pyx_t_double_complex *)(&__pyx_v_r))[0]); goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":67 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":62 + * return (&r)[0] + * + * cdef void lambertw_raise_warning(double complex z) with gil: # <<<<<<<<<<<<<< + * warnings.warn("Lambert W iteration failed to converge: %r" % z) + * + */ + +static void __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_t_double_complex __pyx_v_z) { + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyGILState_STATE _save = PyGILState_Ensure(); + __Pyx_RefNannySetupContext("lambertw_raise_warning"); + + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":63 + * + * cdef void lambertw_raise_warning(double complex z) with gil: + * warnings.warn("Lambert W iteration failed to converge: %r" % z) # <<<<<<<<<<<<<< + * * # Heavy lifting is here: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_z); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("scipy.special.lambertw.lambertw_raise_warning"); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + PyGILState_Release(_save); +} + +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":68 * - * cdef double complex lambertw_scalar(double complex z, long k, double tol): # <<<<<<<<<<<<<< + * @cython.cdivision(True) + * cdef double complex lambertw_scalar(double complex z, long k, double tol) nogil: # <<<<<<<<<<<<<< * """ * This is just the implementation of W for a single input z. */ @@ -685,15 +755,8 @@ int __pyx_t_4; long __pyx_t_5; int __pyx_t_6; - __pyx_t_double_complex __pyx_t_7; - __pyx_t_double_complex __pyx_t_8; - __pyx_t_double_complex __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - __Pyx_RefNannySetupContext("lambertw_scalar"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":73 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":74 * """ * # Comments copied verbatim from [2] are marked with '>' * if zisnan(z): # <<<<<<<<<<<<<< @@ -703,7 +766,7 @@ __pyx_t_1 = __pyx_f_5scipy_7special_8lambertw_zisnan(__pyx_v_z); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":74 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":75 * # Comments copied verbatim from [2] are marked with '>' * if zisnan(z): * return z # <<<<<<<<<<<<<< @@ -716,7 +779,7 @@ } __pyx_L3:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":81 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":82 * #> We must be extremely careful near the singularities at -1/e and 0 * cdef double u * u = exp(-1) # <<<<<<<<<<<<<< @@ -725,7 +788,7 @@ */ __pyx_v_u = exp(-1); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":84 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":85 * * cdef double absz * absz = zabs(z) # <<<<<<<<<<<<<< @@ -734,7 +797,7 @@ */ __pyx_v_absz = __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":85 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":86 * cdef double absz * absz = zabs(z) * if absz <= u: # <<<<<<<<<<<<<< @@ -744,7 +807,7 @@ __pyx_t_1 = (__pyx_v_absz <= __pyx_v_u); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":86 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":87 * absz = zabs(z) * if absz <= u: * if z == 0: # <<<<<<<<<<<<<< @@ -754,7 +817,7 @@ __pyx_t_1 = (__Pyx_c_eq(__pyx_v_z, __pyx_t_double_complex_from_parts(0, 0))); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":88 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":89 * if z == 0: * #> w(0,0) = 0; for all other branches we hit the pole * if k == 0: # <<<<<<<<<<<<<< @@ -764,7 +827,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":89 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":90 * #> w(0,0) = 0; for all other branches we hit the pole * if k == 0: * return z # <<<<<<<<<<<<<< @@ -777,7 +840,7 @@ } __pyx_L6:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":90 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":91 * if k == 0: * return z * return -NPY_INFINITY # <<<<<<<<<<<<<< @@ -790,7 +853,7 @@ } __pyx_L5:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":92 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":93 * return -NPY_INFINITY * * if k == 0: # <<<<<<<<<<<<<< @@ -800,7 +863,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":93 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":94 * * if k == 0: * w = z # Initial guess for iteration # <<<<<<<<<<<<<< @@ -811,7 +874,7 @@ goto __pyx_L7; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":95 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":96 * w = z # Initial guess for iteration * #> For small real z < 0, the -1 branch beaves roughly like log(-z) * elif k == -1 and z.imag ==0 and z.real < 0: # <<<<<<<<<<<<<< @@ -833,7 +896,7 @@ } if (__pyx_t_2) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":96 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":97 * #> For small real z < 0, the -1 branch beaves roughly like log(-z) * elif k == -1 and z.imag ==0 and z.real < 0: * w = log(-z.real) # <<<<<<<<<<<<<< @@ -845,7 +908,7 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":99 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":100 * #> Use a simple asymptotic approximation. * else: * w = zlog(z) # <<<<<<<<<<<<<< @@ -854,7 +917,7 @@ */ __pyx_v_w = __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":103 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":104 * #> gets better for large |k|; need to check that this always * #> works for k ~= -1, 0, 1. * if k: w = w + k*2*NPY_PI*1j # <<<<<<<<<<<<<< @@ -872,7 +935,7 @@ goto __pyx_L4; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":105 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":106 * if k: w = w + k*2*NPY_PI*1j * * elif k == 0 and z.imag and zabs(z) <= 0.7: # <<<<<<<<<<<<<< @@ -893,7 +956,7 @@ } if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":109 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":110 * #> down around z ~= -0.5 (converging to the wrong branch), so patch * #> with a constant approximation (adjusted for sign) * if zabs(z+0.5) < 0.1: # <<<<<<<<<<<<<< @@ -903,7 +966,7 @@ __pyx_t_1 = (__pyx_f_5scipy_7special_8lambertw_zabs(__Pyx_c_sum(__pyx_v_z, __pyx_t_double_complex_from_parts(0.5, 0))) < 0.10000000000000001); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":110 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":111 * #> with a constant approximation (adjusted for sign) * if zabs(z+0.5) < 0.1: * if z.imag > 0: # <<<<<<<<<<<<<< @@ -913,7 +976,7 @@ __pyx_t_1 = (__Pyx_CIMAG(__pyx_v_z) > 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":111 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":112 * if zabs(z+0.5) < 0.1: * if z.imag > 0: * w = 0.7 + 0.7j # <<<<<<<<<<<<<< @@ -925,24 +988,35 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":113 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":114 * w = 0.7 + 0.7j * else: * w = 0.7 - 0.7j # <<<<<<<<<<<<<< - * - * else: + * else: + * w = z */ __pyx_v_w = __Pyx_c_diff(__pyx_t_double_complex_from_parts(0.69999999999999996, 0), __pyx_t_double_complex_from_parts(0, 0.69999999999999996)); } __pyx_L10:; goto __pyx_L9; } + /*else*/ { + + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":116 + * w = 0.7 - 0.7j + * else: + * w = z # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_v_w = __pyx_v_z; + } __pyx_L9:; goto __pyx_L4; } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":116 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":119 * * else: * if z.real == NPY_INFINITY: # <<<<<<<<<<<<<< @@ -952,7 +1026,7 @@ __pyx_t_1 = (__Pyx_CREAL(__pyx_v_z) == NPY_INFINITY); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":117 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":120 * else: * if z.real == NPY_INFINITY: * if k == 0: # <<<<<<<<<<<<<< @@ -962,7 +1036,7 @@ __pyx_t_1 = (__pyx_v_k == 0); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":118 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":121 * if z.real == NPY_INFINITY: * if k == 0: * return z # <<<<<<<<<<<<<< @@ -975,7 +1049,7 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":120 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":123 * return z * else: * return z + 2*k*NPY_PI*1j # <<<<<<<<<<<<<< @@ -990,7 +1064,7 @@ } __pyx_L11:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":122 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":125 * return z + 2*k*NPY_PI*1j * * if z.real == -NPY_INFINITY: # <<<<<<<<<<<<<< @@ -1000,7 +1074,7 @@ __pyx_t_1 = (__Pyx_CREAL(__pyx_v_z) == (-NPY_INFINITY)); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":123 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":126 * * if z.real == -NPY_INFINITY: * return (-z) + (2*k+1)*NPY_PI*1j # <<<<<<<<<<<<<< @@ -1013,7 +1087,7 @@ } __pyx_L13:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":126 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":129 * * #> Simple asymptotic approximation as above * w = zlog(z) # <<<<<<<<<<<<<< @@ -1022,7 +1096,7 @@ */ __pyx_v_w = __pyx_f_5scipy_7special_8lambertw_zlog(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":127 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":130 * #> Simple asymptotic approximation as above * w = zlog(z) * if k: w = w + k*2*NPY_PI*1j # <<<<<<<<<<<<<< @@ -1038,7 +1112,7 @@ } __pyx_L4:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":132 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":135 * cdef double complex ew, wew, wewz, wn * cdef int i * for i in range(100): # <<<<<<<<<<<<<< @@ -1048,7 +1122,7 @@ for (__pyx_t_6 = 0; __pyx_t_6 < 100; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":133 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":136 * cdef int i * for i in range(100): * ew = zexp(w) # <<<<<<<<<<<<<< @@ -1057,7 +1131,7 @@ */ __pyx_v_ew = __pyx_f_5scipy_7special_8lambertw_zexp(__pyx_v_w); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":134 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":137 * for i in range(100): * ew = zexp(w) * wew = w*ew # <<<<<<<<<<<<<< @@ -1066,7 +1140,7 @@ */ __pyx_v_wew = __Pyx_c_prod(__pyx_v_w, __pyx_v_ew); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":135 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":138 * ew = zexp(w) * wew = w*ew * wewz = wew-z # <<<<<<<<<<<<<< @@ -1075,27 +1149,16 @@ */ __pyx_v_wewz = __Pyx_c_diff(__pyx_v_wew, __pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":136 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":139 * wew = w*ew * wewz = wew-z * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) # <<<<<<<<<<<<<< * if zabs(wn-w) < tol*zabs(wn): * return wn */ - __pyx_t_7 = __Pyx_c_prod(__Pyx_c_sum(__pyx_v_w, __pyx_t_double_complex_from_parts(2, 0)), __pyx_v_wewz); - __pyx_t_8 = __Pyx_c_sum(__Pyx_c_prod(__pyx_t_double_complex_from_parts(2, 0), __pyx_v_w), __pyx_t_double_complex_from_parts(2, 0)); - if (unlikely(__Pyx_c_is_zero(__pyx_t_8))) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_t_9 = __Pyx_c_diff(__Pyx_c_sum(__pyx_v_wew, __pyx_v_ew), __Pyx_c_quot(__pyx_t_7, __pyx_t_8)); - if (unlikely(__Pyx_c_is_zero(__pyx_t_9))) { - PyErr_Format(PyExc_ZeroDivisionError, "float division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - __pyx_v_wn = __Pyx_c_diff(__pyx_v_w, __Pyx_c_quot(__pyx_v_wewz, __pyx_t_9)); + __pyx_v_wn = __Pyx_c_diff(__pyx_v_w, __Pyx_c_quot(__pyx_v_wewz, __Pyx_c_diff(__Pyx_c_sum(__pyx_v_wew, __pyx_v_ew), __Pyx_c_quot(__Pyx_c_prod(__Pyx_c_sum(__pyx_v_w, __pyx_t_double_complex_from_parts(2, 0)), __pyx_v_wewz), __Pyx_c_sum(__Pyx_c_prod(__pyx_t_double_complex_from_parts(2, 0), __pyx_v_w), __pyx_t_double_complex_from_parts(2, 0)))))); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":137 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":140 * wewz = wew-z * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) * if zabs(wn-w) < tol*zabs(wn): # <<<<<<<<<<<<<< @@ -1105,7 +1168,7 @@ __pyx_t_1 = (__pyx_f_5scipy_7special_8lambertw_zabs(__Pyx_c_diff(__pyx_v_wn, __pyx_v_w)) < (__pyx_v_tol * __pyx_f_5scipy_7special_8lambertw_zabs(__pyx_v_wn))); if (__pyx_t_1) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":138 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":141 * wn = w - wewz / (wew + ew - (w + 2)*wewz/(2*w + 2)) * if zabs(wn-w) < tol*zabs(wn): * return wn # <<<<<<<<<<<<<< @@ -1118,89 +1181,30 @@ } /*else*/ { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":140 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":143 * return wn * else: * w = wn # <<<<<<<<<<<<<< * - * if True: + * lambertw_raise_warning(z) */ __pyx_v_w = __pyx_v_wn; } __pyx_L17:; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":142 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":145 * w = wn * - * if True: # <<<<<<<<<<<<<< - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API - */ - __pyx_t_1 = 1; - if (__pyx_t_1) { - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":143 - * - * if True: - * NPY_ALLOW_C_API_DEF # <<<<<<<<<<<<<< - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - */ - NPY_ALLOW_C_API_DEF; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":144 - * if True: - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API # <<<<<<<<<<<<<< - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API - */ - NPY_ALLOW_C_API; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":145 - * NPY_ALLOW_C_API_DEF - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) # <<<<<<<<<<<<<< - * NPY_DISABLE_C_API + * lambertw_raise_warning(z) # <<<<<<<<<<<<<< * return wn - */ - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__warn); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __pyx_PyComplex_FromComplex(__pyx_v_z); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":146 - * NPY_ALLOW_C_API - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API # <<<<<<<<<<<<<< - * return wn * */ - NPY_DISABLE_C_API; - goto __pyx_L18; - } - __pyx_L18:; + __pyx_f_5scipy_7special_8lambertw_lambertw_raise_warning(__pyx_v_z); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":147 - * warnings.warn("Lambert W iteration failed to converge: %r" % z) - * NPY_DISABLE_C_API + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":146 + * + * lambertw_raise_warning(z) * return wn # <<<<<<<<<<<<<< * * @@ -1209,23 +1213,15 @@ goto __pyx_L0; __pyx_r = __pyx_t_double_complex_from_parts(0, 0); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_WriteUnraisable("scipy.special.lambertw.lambertw_scalar"); - __pyx_r = __pyx_t_double_complex_from_parts(0, 0); __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":167 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":166 * int identity, char* name, char* doc, int c) * * cdef void _apply_func_to_1d_vec(char **args, npy_intp *dimensions, npy_intp *steps, # <<<<<<<<<<<<<< - * void *func): + * void *func) nogil: * cdef npy_intp i */ @@ -1237,42 +1233,41 @@ char *__pyx_v_op; npy_intp __pyx_t_1; npy_intp __pyx_t_2; - __Pyx_RefNannySetupContext("_apply_func_to_1d_vec"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":170 - * void *func): + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":169 + * void *func) nogil: * cdef npy_intp i * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] # <<<<<<<<<<<<<< * for i in range(0, dimensions[0]): - * (op)[0] = (func)( + * (op)[0] = (func)( */ __pyx_v_ip1 = (__pyx_v_args[0]); __pyx_v_ip2 = (__pyx_v_args[1]); __pyx_v_ip3 = (__pyx_v_args[2]); __pyx_v_op = (__pyx_v_args[3]); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":171 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":170 * cdef npy_intp i * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] * for i in range(0, dimensions[0]): # <<<<<<<<<<<<<< - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0], (ip3)[0]) */ __pyx_t_1 = (__pyx_v_dimensions[0]); for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":172 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":171 * cdef char *ip1=args[0], *ip2=args[1], *ip3=args[2], *op=args[3] * for i in range(0, dimensions[0]): - * (op)[0] = (func)( # <<<<<<<<<<<<<< + * (op)[0] = (func)( # <<<<<<<<<<<<<< * (ip1)[0], (ip2)[0], (ip3)[0]) * ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] */ (((__pyx_t_double_complex *)__pyx_v_op)[0]) = ((__pyx_t_double_complex (*)(__pyx_t_double_complex, long, double))__pyx_v_func)((((__pyx_t_double_complex *)__pyx_v_ip1)[0]), (((long *)__pyx_v_ip2)[0]), (((double *)__pyx_v_ip3)[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":174 - * (op)[0] = (func)( + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":173 + * (op)[0] = (func)( * (ip1)[0], (ip2)[0], (ip3)[0]) * ip1 += steps[0]; ip2 += steps[1]; ip3 += steps[2]; op += steps[3] # <<<<<<<<<<<<<< * @@ -1284,10 +1279,9 @@ __pyx_v_op += (__pyx_v_steps[3]); } - __Pyx_RefNannyFinishContext(); } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":194 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":193 * _inp_outp_types, 1, 3, 1, 0, "", "", 0) * * def lambertw(z, k=0, tol=1e-8): # <<<<<<<<<<<<<< @@ -1337,7 +1331,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lambertw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lambertw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_z = values[0]; __pyx_v_k = values[1]; @@ -1355,22 +1349,22 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lambertw", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("lambertw", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scipy.special.lambertw.lambertw"); return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":341 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":340 * * """ * return _lambertw(z, k, tol) # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___lambertw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___lambertw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_z); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_z); @@ -1381,7 +1375,7 @@ __Pyx_INCREF(__pyx_v_tol); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_tol); __Pyx_GIVEREF(__pyx_v_tol); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -1442,7 +1436,7 @@ {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -1519,19 +1513,19 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":23 - * # at `-1/e` and make sure that the proper branch is chosen there + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":24 * + * import cython * import warnings # <<<<<<<<<<<<<< * * cdef extern from "math.h": */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__warnings), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__warnings, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":177 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":176 * * cdef PyUFuncGenericFunction _loop_funcs[1] * _loop_funcs[0] = _apply_func_to_1d_vec # <<<<<<<<<<<<<< @@ -1540,7 +1534,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__loop_funcs[0]) = __pyx_f_5scipy_7special_8lambertw__apply_func_to_1d_vec; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":180 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":179 * * cdef char _inp_outp_types[4] * _inp_outp_types[0] = NPY_CDOUBLE # <<<<<<<<<<<<<< @@ -1549,7 +1543,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[0]) = NPY_CDOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":181 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":180 * cdef char _inp_outp_types[4] * _inp_outp_types[0] = NPY_CDOUBLE * _inp_outp_types[1] = NPY_LONG # <<<<<<<<<<<<<< @@ -1558,7 +1552,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[1]) = NPY_LONG; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":182 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":181 * _inp_outp_types[0] = NPY_CDOUBLE * _inp_outp_types[1] = NPY_LONG * _inp_outp_types[2] = NPY_DOUBLE # <<<<<<<<<<<<<< @@ -1567,7 +1561,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[2]) = NPY_DOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":183 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":182 * _inp_outp_types[1] = NPY_LONG * _inp_outp_types[2] = NPY_DOUBLE * _inp_outp_types[3] = NPY_CDOUBLE # <<<<<<<<<<<<<< @@ -1576,7 +1570,7 @@ */ (__pyx_v_5scipy_7special_8lambertw__inp_outp_types[3]) = NPY_CDOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":185 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":184 * _inp_outp_types[3] = NPY_CDOUBLE * * import_array() # <<<<<<<<<<<<<< @@ -1585,7 +1579,7 @@ */ import_array(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":186 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":185 * * import_array() * import_ufunc() # <<<<<<<<<<<<<< @@ -1594,7 +1588,7 @@ */ import_ufunc(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":190 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":189 * # The actual ufunc declaration: * cdef void *the_func_to_apply[1] * the_func_to_apply[0] = lambertw_scalar # <<<<<<<<<<<<<< @@ -1603,32 +1597,32 @@ */ (__pyx_v_5scipy_7special_8lambertw_the_func_to_apply[0]) = ((void *)__pyx_f_5scipy_7special_8lambertw_lambertw_scalar); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":192 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":191 * the_func_to_apply[0] = lambertw_scalar * _lambertw = PyUFunc_FromFuncAndData(_loop_funcs, the_func_to_apply, * _inp_outp_types, 1, 3, 1, 0, "", "", 0) # <<<<<<<<<<<<<< * * def lambertw(z, k=0, tol=1e-8): */ - __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_8lambertw__loop_funcs, __pyx_v_5scipy_7special_8lambertw_the_func_to_apply, __pyx_v_5scipy_7special_8lambertw__inp_outp_types, 1, 3, 1, 0, __pyx_k_3, __pyx_k_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_8lambertw__loop_funcs, __pyx_v_5scipy_7special_8lambertw_the_func_to_apply, __pyx_v_5scipy_7special_8lambertw__inp_outp_types, 1, 3, 1, 0, __pyx_k_3, __pyx_k_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___lambertw, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___lambertw, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":194 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":193 * _inp_outp_types, 1, 3, 1, 0, "", "", 0) * * def lambertw(z, k=0, tol=1e-8): # <<<<<<<<<<<<<< * r""" * lambertw(z, k=0, tol=1e-8) */ - __pyx_t_1 = PyFloat_FromDouble(1e-08); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1e-08); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_k_2 = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/lambertw.pyx":1 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/lambertw.pyx":1 * # Implementation of the Lambert W function [1]. Based on the MPMath # <<<<<<<<<<<<<< * # implementation [2], and documentaion [3]. * # @@ -1798,70 +1792,70 @@ #if CYTHON_CCOMPLEX #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if HAVE_HYPOT return hypot(z.real, z.imag); #else @@ -1912,7 +1906,7 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) < sizeof(long)) { @@ -1930,7 +1924,7 @@ } } -static INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { +static CYTHON_INLINE npy_intp __Pyx_PyInt_from_py_npy_intp(PyObject* x) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) == sizeof(char)) { @@ -1971,7 +1965,7 @@ return (npy_intp)-1; } -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { @@ -1990,7 +1984,7 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { @@ -2009,7 +2003,7 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { @@ -2028,7 +2022,7 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { @@ -2047,7 +2041,7 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { @@ -2066,7 +2060,7 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { @@ -2085,7 +2079,7 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { @@ -2104,7 +2098,7 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { @@ -2123,7 +2117,7 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { @@ -2142,7 +2136,7 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2177,7 +2171,7 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2212,7 +2206,7 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2247,7 +2241,7 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2282,7 +2276,7 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2317,7 +2311,7 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -2352,7 +2346,7 @@ } } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -2367,7 +2361,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -2499,13 +2493,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -2551,7 +2545,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -2560,7 +2554,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -2574,7 +2568,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: branches/0.8.x/scipy/special/orthogonal_eval.c =================================================================== --- branches/0.8.x/scipy/special/orthogonal_eval.c 2010-05-31 08:45:53 UTC (rev 6453) +++ branches/0.8.x/scipy/special/orthogonal_eval.c 2010-05-31 08:46:01 UTC (rev 6454) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12 on Wed Mar 31 17:45:34 2010 */ +/* Generated by Cython 0.12.1 on Mon May 31 10:17:30 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -36,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -60,18 +64,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type @@ -80,6 +88,7 @@ #define PyBytes_Type PyString_Type #define PyBytes_CheckExact PyString_CheckExact #endif + #if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) @@ -99,10 +108,13 @@ #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -116,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -125,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -143,12 +157,14 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -170,8 +186,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -235,9 +251,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -323,9 +339,9 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ @@ -334,42 +350,42 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static void __Pyx_AddTraceback(const char *funcname); /*proto*/ @@ -511,9 +527,9 @@ static PyObject *__pyx_int_neg_1; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":24 - * double sqrt(double x) + * double sqrt(double x) nogil * - * cdef double eval_poly_chebyt(long k, double x): # <<<<<<<<<<<<<< + * cdef double eval_poly_chebyt(long k, double x) nogil: # <<<<<<<<<<<<<< * # Use Chebyshev T recurrence directly, see [MH] * cdef long m */ @@ -525,7 +541,7 @@ double __pyx_v_b0; double __pyx_r; long __pyx_t_1; - __Pyx_RefNannySetupContext("eval_poly_chebyt"); + long __pyx_t_2; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":29 * cdef double b2, b1, b0 @@ -550,7 +566,7 @@ * b1 = -1 * b0 = 0 # <<<<<<<<<<<<<< * x = 2*x - * for m in range(k+1, 0, -1): + * for m in range(k+1): */ __pyx_v_b0 = 0; @@ -558,7 +574,7 @@ * b1 = -1 * b0 = 0 * x = 2*x # <<<<<<<<<<<<<< - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 */ __pyx_v_x = (2 * __pyx_v_x); @@ -566,16 +582,17 @@ /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":33 * b0 = 0 * x = 2*x - * for m in range(k+1, 0, -1): # <<<<<<<<<<<<<< + * for m in range(k+1): # <<<<<<<<<<<<<< * b2 = b1 * b1 = b0 */ - for (__pyx_t_1 = (__pyx_v_k + 1); __pyx_t_1 > 0; __pyx_t_1-=1) { - __pyx_v_m = __pyx_t_1; + __pyx_t_1 = (__pyx_v_k + 1); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_m = __pyx_t_2; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":34 * x = 2*x - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 # <<<<<<<<<<<<<< * b1 = b0 * b0 = x*b1 - b2 @@ -583,7 +600,7 @@ __pyx_v_b2 = __pyx_v_b1; /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":35 - * for m in range(k+1, 0, -1): + * for m in range(k+1): * b2 = b1 * b1 = b0 # <<<<<<<<<<<<<< * b0 = x*b1 - b2 @@ -613,7 +630,6 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -621,7 +637,7 @@ * int identity, char* name, char* doc, int c) * * cdef void _loop_id_d(char **args, npy_intp *dimensions, npy_intp *steps, # <<<<<<<<<<<<<< - * void *func): + * void *func) nogil: * cdef int i */ @@ -632,14 +648,13 @@ char *__pyx_v_op; npy_intp __pyx_t_1; int __pyx_t_2; - __Pyx_RefNannySetupContext("_loop_id_d"); /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":61 * cdef int i * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] # <<<<<<<<<<<<<< * for i in range(0, dimensions[0]): - * (op)[0] = (func)( + * (op)[0] = (func)( */ __pyx_v_ip1 = (__pyx_v_args[0]); __pyx_v_ip2 = (__pyx_v_args[1]); @@ -649,7 +664,7 @@ * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): # <<<<<<<<<<<<<< - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0]) */ __pyx_t_1 = (__pyx_v_dimensions[0]); @@ -659,14 +674,14 @@ /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":63 * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): - * (op)[0] = (func)( # <<<<<<<<<<<<<< + * (op)[0] = (func)( # <<<<<<<<<<<<<< * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] */ (((double *)__pyx_v_op)[0]) = ((double (*)(long, double))__pyx_v_func)((((long *)__pyx_v_ip1)[0]), (((double *)__pyx_v_ip2)[0])); /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":65 - * (op)[0] = (func)( + * (op)[0] = (func)( * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] # <<<<<<<<<<<<<< * @@ -677,7 +692,6 @@ __pyx_v_op += (__pyx_v_steps[2]); } - __Pyx_RefNannyFinishContext(); } /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":96 @@ -4376,7 +4390,7 @@ return -1; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, @@ -4386,7 +4400,7 @@ (index == 1) ? "" : "s"); } -static INLINE void __Pyx_RaiseTooManyValuesError(void) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } @@ -4454,7 +4468,7 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { const npy_intp neg_one = (npy_intp)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(npy_intp) < sizeof(long)) { @@ -4472,7 +4486,7 @@ } } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -4487,7 +4501,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -4609,7 +4623,7 @@ } #endif -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { @@ -4628,7 +4642,7 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { @@ -4647,7 +4661,7 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { @@ -4666,7 +4680,7 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { @@ -4685,7 +4699,7 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { @@ -4704,7 +4718,7 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { @@ -4723,7 +4737,7 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { @@ -4742,7 +4756,7 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { @@ -4761,7 +4775,7 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { @@ -4780,7 +4794,7 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4815,7 +4829,7 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4850,7 +4864,7 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4885,7 +4899,7 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4920,7 +4934,7 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -4955,7 +4969,7 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 @@ -5092,13 +5106,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -5144,7 +5158,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -5153,7 +5167,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -5167,7 +5181,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; From scipy-svn at scipy.org Mon May 31 09:08:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 08:08:07 -0500 (CDT) Subject: [Scipy-svn] r6455 - branches/0.8.x Message-ID: <20100531130807.5F93539CAEA@scipy.org> Author: rgommers Date: 2010-05-31 08:08:07 -0500 (Mon, 31 May 2010) New Revision: 6455 Modified: branches/0.8.x/pavement.py Log: REL: Update Paver script, build against NumPy 1.4.1. Modified: branches/0.8.x/pavement.py =================================================================== --- branches/0.8.x/pavement.py 2010-05-31 08:46:01 UTC (rev 6454) +++ branches/0.8.x/pavement.py 2010-05-31 13:08:07 UTC (rev 6455) @@ -70,7 +70,7 @@ sys.path.pop(0) # Default python version -PYVER="2.5" +PYVER="2.6" DMG_DIR = "dmg-source" # Wine config for win32 builds @@ -443,10 +443,8 @@ def _build_mpkg(pyver): numver = parse_numpy_version(MPKG_PYTHON[pyver]) numverstr = ".".join(["%i" % i for i in numver]) - if pyver == "2.5" and not numver[:2] == (1, 2): - raise ValueError("Scipy 0.7.x should be built against numpy 1.2.x for python 2.5 (detected %s)" % numverstr) - elif pyver == "2.6" and not numver[:2] == (1, 3): - raise ValueError("Scipy 0.7.x should be built against numpy 1.3.x for python 2.6 (detected %s)" % numverstr) + if not numver == (1, 4, 1): + raise ValueError("Scipy 0.8.x should be built against numpy 1.4.1, (detected %s)" % numverstr) prepare_static_gfortran_runtime("build") ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch ppc -Wl,-search_paths_first" From scipy-svn at scipy.org Mon May 31 09:08:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 08:08:23 -0500 (CDT) Subject: [Scipy-svn] r6456 - branches/0.8.x Message-ID: <20100531130823.22F3B39CAEA@scipy.org> Author: rgommers Date: 2010-05-31 08:08:23 -0500 (Mon, 31 May 2010) New Revision: 6456 Modified: branches/0.8.x/setup.py Log: REL: add 'b1' to version string for first beta. Modified: branches/0.8.x/setup.py =================================================================== --- branches/0.8.x/setup.py 2010-05-31 13:08:07 UTC (rev 6455) +++ branches/0.8.x/setup.py 2010-05-31 13:08:23 UTC (rev 6456) @@ -43,8 +43,8 @@ MAJOR = 0 MINOR = 8 MICRO = 0 -ISRELEASED = False -VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) +ISRELEASED = True +VERSION = '%d.%d.%db1' % (MAJOR, MINOR, MICRO) # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. From scipy-svn at scipy.org Mon May 31 09:08:35 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 08:08:35 -0500 (CDT) Subject: [Scipy-svn] r6457 - branches/0.8.x Message-ID: <20100531130835.6F33239CAEA@scipy.org> Author: rgommers Date: 2010-05-31 08:08:35 -0500 (Mon, 31 May 2010) New Revision: 6457 Modified: branches/0.8.x/pavement.py Log: BUG: Add missing argument in paver dmg task. Modified: branches/0.8.x/pavement.py =================================================================== --- branches/0.8.x/pavement.py 2010-05-31 13:08:23 UTC (rev 6456) +++ branches/0.8.x/pavement.py 2010-05-31 13:08:35 UTC (rev 6457) @@ -456,7 +456,7 @@ def dmg(): pyver = ".".join([str(i) for i in sys.version_info[:2]]) - dmg_n = dmg_name() + dmg_n = dmg_name(pyver) dmg = paver.path.path('scipy-macosx-installer') / dmg_n if dmg.exists(): dmg.remove() From scipy-svn at scipy.org Mon May 31 19:40:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 18:40:00 -0500 (CDT) Subject: [Scipy-svn] r6458 - branches/0.8.x/scipy/stats Message-ID: <20100531234000.BA53039CAEA@scipy.org> Author: oliphant Date: 2010-05-31 18:40:00 -0500 (Mon, 31 May 2010) New Revision: 6458 Modified: branches/0.8.x/scipy/stats/distributions.py Log: Fix invalid syntax for Python < 2.6 Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-05-31 13:08:35 UTC (rev 6457) +++ branches/0.8.x/scipy/stats/distributions.py 2010-05-31 23:40:00 UTC (rev 6458) @@ -1505,7 +1505,7 @@ """ Estimate loc and scale parameters from data using 1st and 2nd moments """ - mu, mu2 = self.stats(*args,moments='mv') + mu, mu2 = self.stats(*args,**{'moments':'mv'}) muhat = arr(data).mean() mu2hat = arr(data).var() Shat = sqrt(mu2hat / mu2) From scipy-svn at scipy.org Mon May 31 19:48:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 18:48:25 -0500 (CDT) Subject: [Scipy-svn] r6459 - trunk/scipy/stats Message-ID: <20100531234825.5AB6839CAEA@scipy.org> Author: oliphant Date: 2010-05-31 18:48:25 -0500 (Mon, 31 May 2010) New Revision: 6459 Modified: trunk/scipy/stats/distributions.py Log: Only compute the moments actually requested in _stats. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-31 23:40:00 UTC (rev 6458) +++ trunk/scipy/stats/distributions.py 2010-05-31 23:48:25 UTC (rev 6459) @@ -1267,8 +1267,7 @@ signature = inspect.getargspec(self._stats.im_func) if (signature[2] is not None) or ('moments' in signature[0]): - #this did not fetch mv, adjust to also get mv - mu, mu2, g1, g2 = self._stats(*args,**{'moments':moments+'mv'}) + mu, mu2, g1, g2 = self._stats(*args,**{'moments':moments}) else: mu, mu2, g1, g2 = self._stats(*args) if g1 is None: From scipy-svn at scipy.org Mon May 31 19:49:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 18:49:25 -0500 (CDT) Subject: [Scipy-svn] r6460 - trunk/scipy/stats Message-ID: <20100531234925.85C0939CAEA@scipy.org> Author: oliphant Date: 2010-05-31 18:49:24 -0500 (Mon, 31 May 2010) New Revision: 6460 Modified: trunk/scipy/stats/distributions.py Log: Fix syntax for Python < 2.6 Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-05-31 23:48:25 UTC (rev 6459) +++ trunk/scipy/stats/distributions.py 2010-05-31 23:49:24 UTC (rev 6460) @@ -1504,7 +1504,7 @@ """ Estimate loc and scale parameters from data using 1st and 2nd moments """ - mu, mu2 = self.stats(*args,moments='mv') + mu, mu2 = self.stats(*args,**{'moments':'mv'}) muhat = arr(data).mean() mu2hat = arr(data).var() Shat = sqrt(mu2hat / mu2) From scipy-svn at scipy.org Mon May 31 19:51:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 18:51:47 -0500 (CDT) Subject: [Scipy-svn] r6461 - branches/0.8.x/scipy/stats Message-ID: <20100531235147.1143839CAEA@scipy.org> Author: oliphant Date: 2010-05-31 18:51:46 -0500 (Mon, 31 May 2010) New Revision: 6461 Modified: branches/0.8.x/scipy/stats/distributions.py Log: Fix syntax for Python < 2.6 Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-05-31 23:49:24 UTC (rev 6460) +++ branches/0.8.x/scipy/stats/distributions.py 2010-05-31 23:51:46 UTC (rev 6461) @@ -5024,7 +5024,7 @@ signature = inspect.getargspec(self._stats.im_func) if (signature[2] is not None) or ('moments' in signature[0]): - mu, mu2, g1, g2 = self._stats(*args,moments=moments) + mu, mu2, g1, g2 = self._stats(*args,**{'moments':moments}) else: mu, mu2, g1, g2 = self._stats(*args) if g1 is None: