|
25 | 25 | import pandas as pd
|
26 | 26 | import scipy as sp
|
27 | 27 | import scipy.signal as ss
|
28 |
| -if sp.__version__ < "1.4.0": |
29 |
| - import scipy.fftpack as sf |
30 |
| - from scipy.fftpack.helper import next_fast_len |
31 |
| - import scipy.fftpack._fftpack as sff |
32 |
| -else: |
33 |
| - import scipy.fft as sf |
34 |
| - from scipy.fft import next_fast_len |
| 28 | + |
| 29 | +import scipy.fft as sf |
| 30 | +from scipy.fft import next_fast_len |
35 | 31 |
|
36 | 32 |
|
37 | 33 | import scipy.optimize
|
@@ -1659,7 +1655,7 @@ def check_and_phase_shift(trace, taper_length=20.0):
|
1659 | 1655 | FFTdata = FFTdata * np.exp(1j * 2. * np.pi * fftfreq * dt)
|
1660 | 1656 | FFTdata = FFTdata.astype(np.complex64)
|
1661 | 1657 | sf.ifft(FFTdata, n=n, overwrite_x=True)
|
1662 |
| - trace.data = np.real(FFTdata[:len(trace.data)]).astype(np.float) |
| 1658 | + trace.data = np.real(FFTdata[:len(trace.data)]).astype(float) |
1663 | 1659 | trace.stats.starttime += dt
|
1664 | 1660 | del FFTdata, fftfreq
|
1665 | 1661 | clean_scipy_cache()
|
@@ -1768,25 +1764,26 @@ def make_same_length(st):
|
1768 | 1764 | def clean_scipy_cache():
|
1769 | 1765 | """This functions wraps all destroy scipy cache at once. It is a workaround
|
1770 | 1766 | to the memory leak induced by the "caching" functions in scipy fft."""
|
1771 |
| - if scipy.__version__ >= "1.4.0": |
1772 |
| - return |
1773 |
| - sff.destroy_zfft_cache() |
1774 |
| - sff.destroy_zfftnd_cache() |
1775 |
| - sff.destroy_drfft_cache() |
1776 |
| - sff.destroy_cfft_cache() |
1777 |
| - sff.destroy_cfftnd_cache() |
1778 |
| - sff.destroy_rfft_cache() |
1779 |
| - sff.destroy_ddct2_cache() |
1780 |
| - sff.destroy_ddct1_cache() |
1781 |
| - # sff.destroy_ddct4_cache() |
1782 |
| - sff.destroy_dct2_cache() |
1783 |
| - sff.destroy_dct1_cache() |
1784 |
| - # sff.destroy_dct4_cache() |
1785 |
| - sff.destroy_ddst2_cache() |
1786 |
| - sff.destroy_ddst1_cache() |
1787 |
| - sff.destroy_dst2_cache() |
1788 |
| - sff.destroy_dst1_cache() |
1789 |
| - sf.convolve.destroy_convolve_cache() |
| 1767 | + return |
| 1768 | + # if scipy.__version__ >= "1.4.0": |
| 1769 | + # return |
| 1770 | + # sff.destroy_zfft_cache() |
| 1771 | + # sff.destroy_zfftnd_cache() |
| 1772 | + # sff.destroy_drfft_cache() |
| 1773 | + # sff.destroy_cfft_cache() |
| 1774 | + # sff.destroy_cfftnd_cache() |
| 1775 | + # sff.destroy_rfft_cache() |
| 1776 | + # sff.destroy_ddct2_cache() |
| 1777 | + # sff.destroy_ddct1_cache() |
| 1778 | + # # sff.destroy_ddct4_cache() |
| 1779 | + # sff.destroy_dct2_cache() |
| 1780 | + # sff.destroy_dct1_cache() |
| 1781 | + # # sff.destroy_dct4_cache() |
| 1782 | + # sff.destroy_ddst2_cache() |
| 1783 | + # sff.destroy_ddst1_cache() |
| 1784 | + # sff.destroy_dst2_cache() |
| 1785 | + # sff.destroy_dst1_cache() |
| 1786 | + # sf.convolve.destroy_convolve_cache() |
1790 | 1787 |
|
1791 | 1788 |
|
1792 | 1789 | def preload_instrument_responses(session):
|
|
0 commit comments