obspy/obspy — pull request #924 by krischer (2014-12-10 05:23:43+00:00)
Title: Non-default integration methods do not work

All tests seem to use the default integration method (`'cumtrapz'`), so if you change, e.g., [this line](../blob/master/obspy/core/tests/test_trace.py#L1216) to some other method:
* `'trapz'`:
```
======================================================================
ERROR: test_integrate (obspy.core.tests.test_trace.TraceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/elliott/code/obspy/obspy/core/tests/test_trace.py", line 1216, in test_integrate
tr.integrate(type='trapz')
File "/home/elliott/code/obspy/obspy/core/util/decorator.py", line 257, in new_func
return func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 226, in new_func
result = func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 1778, in integrate
self.data = func(*args, **options)
File "/usr/lib64/python2.7/site-packages/numpy/lib/function_base.py", line 2930, in trapz
d = diff(x, axis=axis)
File "/usr/lib64/python2.7/site-packages/numpy/lib/function_base.py", line 991, in diff
slice1[axis] = slice(1, None)
IndexError: list assignment index out of range
```
* `'simps'`
```
======================================================================
ERROR: test_integrate (obspy.core.tests.test_trace.TraceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/elliott/code/obspy/obspy/core/tests/test_trace.py", line 1216, in test_integrate
tr.integrate(type='simps')
File "/home/elliott/code/obspy/obspy/core/util/decorator.py", line 257, in new_func
return func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 226, in new_func
result = func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 1778, in integrate
self.data = func(*args, **options)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 417, in __setattr__
_data_sanity_checks(value)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 2448, in _data_sanity_checks
raise ValueError(msg)
ValueError: Trace.data must be a NumPy array.
```
* `'romb'`
```
======================================================================
ERROR: test_integrate (obspy.core.tests.test_trace.TraceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/elliott/code/obspy/obspy/core/tests/test_trace.py", line 1216, in test_integrate
tr.integrate(type='romb')
File "/home/elliott/code/obspy/obspy/core/util/decorator.py", line 257, in new_func
return func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 226, in new_func
result = func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 1778, in integrate
self.data = func(*args, **options)
File "/usr/lib64/python2.7/site-packages/scipy/integrate/quadrature.py", line 432, in romb
raise ValueError("Number of samples must be one plus a "
ValueError: Number of samples must be one plus a non-negative power of 2.
```
(this one makes sense, so changing the length to `129` instead of `101`):
```
======================================================================
ERROR: test_integrate (obspy.core.tests.test_trace.TraceTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/elliott/code/obspy/obspy/core/tests/test_trace.py", line 1216, in test_integrate
tr.integrate(type='romb')
File "/home/elliott/code/obspy/obspy/core/util/decorator.py", line 257, in new_func
return func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 226, in new_func
result = func(*args, **kwargs)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 1778, in integrate
self.data = func(*args, **options)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 417, in __setattr__
_data_sanity_checks(value)
File "/home/elliott/code/obspy/obspy/core/trace.py", line 2448, in _data_sanity_checks
raise ValueError(msg)
ValueError: Trace.data must be a NumPy array.
```