Obspy: Trace remove_response() method raises exception when used with numpy 1.17.0

Created on 3 Aug 2019  路  6Comments  路  Source: obspy/obspy

numpy version 1.17 has replaced the internal fftpack module with pocketfft (see release notes here: https://github.com/numpy/numpy/blob/master/doc/release/1.17.0-notes.rst)

This causes an exception to be raised in the following line of code:

https://github.com/obspy/obspy/blob/e97fe91ae99df0154664933102f03405940b86d6/obspy/core/util/misc.py#L614

which has the effect of breaking the remove_response() method of the Trace object, as demonstrated in the test script I've attached (renamed to .txt to make github happy).

The error is:

AttributeError: module 'numpy.fft' has no attribute 'fftpack'

testresp.txt

OS Version: OSX 10.13.6
Python: 3.6.7
numpy: 1.17.0
obspy: 1.1.1

I created a test environment with conda:
conda create -n testfft python=3.6 obspy

The workaround, I suppose is to not use numpy 1.17 or higher until this is patched in obspy.

bug high

All 6 comments

It is surprising to me that numpy removed fftpack without a deprecation cycle. It will certainly break mores codes than just obspy.

@mhearne-usgs conda-forge repository is updated, so this should not hit people anymore installing new environments or updating theirs.. at least when obspy 1.1.1 is selected, i.e. when people don't force numpy >= 1.17 or some other dependencies to high version that pull in numpy 1.17, conda will pull older obspy packages unfortunately, nothing we can do.

Thanks for reporting this, this should help minimize people getting affected by a lot.

Is the fix for this as simple as wrapping the limit_numpy_fft_cache() in a version check?

if np.__version__ < '1.17.0':
    limit_numpy_fft_cache()

https://github.com/obspy/obspy/blob/0c214da22eed6bd587a317eaa9aaa305373512aa/obspy/core/trace.py#L2745

Or is there a reason this would be a bit of a hacked solution? I didn't see an equivalent to fft_cache_() in pocketfft.

Can't say @aringler-usgs, didn't have time to look into it yet..

Yes.

I actually contributed this fix to numpy a while ago so it should not be necessary anymore. But now with fftpack gone it is fully obsolete.

Am 6. Aug. 2019, 19:15, um 19:15, aringler-usgs notifications@github.com schrieb:

Is the fix for this as simple as wrapping the limit_numpy_fft_cache()
in a version check?

if np.__version__ < '1.17.0':
   limit_numpy_fft_cache()

https://github.com/obspy/obspy/blob/0c214da22eed6bd587a317eaa9aaa305373512aa/obspy/core/trace.py#L2745

Or is there a reason this would be a bit of a hacked solution? I
didn't see an equivalent to fft_cache_() in pocketfft.

--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/obspy/obspy/issues/2434#issuecomment-518739630

So I guess the answer would be yes @aringler-usgs, I think that's what we should do.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThomasLecocq picture ThomasLecocq  路  5Comments

JackWalpole picture JackWalpole  路  11Comments

Earthscience picture Earthscience  路  8Comments

comoglu picture comoglu  路  9Comments

mp-v2 picture mp-v2  路  6Comments