Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
arosics
Commits
89a37b1d
Commit
89a37b1d
authored
Jan 28, 2022
by
Daniel Scheffler
Browse files
Merge branch 'bugfix/workaround_pyfftw_bug' into 'master'
Bugfix/workaround pyfftw bug Closes
#71
See merge request
!25
parents
4094e1ac
e2bd1722
Pipeline
#37935
passed with stages
in 10 minutes and 4 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
HISTORY.rst
View file @
89a37b1d
...
...
@@ -2,6 +2,13 @@
History
=======
1.7.5 (2021-01-28)
------------------
* Implemented a workaround for #71 (pyFFTW RuntimeError: Undefined plan with nthreads. This is a bug).
Pin pyFFTW to <0.13.0. (!25)
1.7.4 (2021-12-15)
------------------
...
...
@@ -653,7 +660,7 @@ History
0.8.3 (2018-03-07)
------------------
* Fixed ValueError as reported in https://git
ext
.gfz-potsdam.de/EnMAP/sicor/issues/22.
* Fixed ValueError as reported in https://git.gfz-potsdam.de/EnMAP/sicor/issues/22.
0.8.2 (2018-01-23)
...
...
arosics/CoReg.py
View file @
89a37b1d
...
...
@@ -1141,23 +1141,28 @@ class COREG(object):
PLT
.
subplot_imshow
([
np
.
real
(
in_arr0
).
astype
(
np
.
float32
),
np
.
real
(
in_arr1
).
astype
(
np
.
float32
)],
[
'FFTin '
+
self
.
ref
.
title
,
'FFTin '
+
self
.
shift
.
title
],
grid
=
True
)
fft_arr0
,
fft_arr1
=
None
,
None
if
pyfftw
and
self
.
fftw_works
is
not
False
:
# if module is installed and working
fft_arr0
=
pyfftw
.
FFTW
(
in_arr0
,
np
.
empty_like
(
in_arr0
),
axes
=
(
0
,
1
))()
fft_arr1
=
pyfftw
.
FFTW
(
in_arr1
,
np
.
empty_like
(
in_arr1
),
axes
=
(
0
,
1
))()
try
:
fft_arr0
=
pyfftw
.
FFTW
(
in_arr0
,
np
.
empty_like
(
in_arr0
),
axes
=
(
0
,
1
))()
fft_arr1
=
pyfftw
.
FFTW
(
in_arr1
,
np
.
empty_like
(
in_arr1
),
axes
=
(
0
,
1
))()
# catch empty output arrays (for some reason this happens sometimes..) -> use numpy fft
# => this is caused by the call of pyfftw.FFTW. Exactly in that moment the input array in_arr0 is
# overwritten with zeros (maybe this is a bug in pyFFTW?)
if
self
.
fftw_works
in
[
None
,
True
]
and
(
np
.
std
(
fft_arr0
)
==
0
or
np
.
std
(
fft_arr1
)
==
0
):
# catch empty output arrays (for some reason this happens sometimes..) -> use numpy fft
# => this is caused by the call of pyfftw.FFTW. Exactly in that moment the input array
# in_arr0 is overwritten with zeros (maybe this is a bug in pyFFTW?)
if
np
.
std
(
fft_arr0
)
==
0
or
np
.
std
(
fft_arr1
)
==
0
:
raise
RuntimeError
(
'FFTW result is unexpectedly empty.'
)
self
.
fftw_works
=
True
except
RuntimeError
:
self
.
fftw_works
=
False
# recreate input arrays and use numpy fft as fallback
in_arr0
=
im0
[
ymin
:
ymax
,
xmin
:
xmax
].
astype
(
precision
)
in_arr1
=
im1
[
ymin
:
ymax
,
xmin
:
xmax
].
astype
(
precision
)
fft_arr0
=
np
.
fft
.
fft2
(
in_arr0
)
fft_arr1
=
np
.
fft
.
fft2
(
in_arr1
)
else
:
self
.
fftw_works
=
True
else
:
if
self
.
fftw_works
is
False
or
fft_arr0
is
None
or
fft_arr1
is
None
:
fft_arr0
=
np
.
fft
.
fft2
(
in_arr0
)
fft_arr1
=
np
.
fft
.
fft2
(
in_arr1
)
...
...
docs/installation.rst
View file @
89a37b1d
...
...
@@ -40,7 +40,7 @@ to resolve the following dependencies before the pip installer is run:
* matplotlib
* numpy
* pandas
* pyfftw
* pyfftw
<0.13.0
* pykrige
* pyproj >2.2.0
* scikit-image >=0.16.0
...
...
requirements.txt
View file @
89a37b1d
...
...
@@ -10,7 +10,7 @@ matplotlib
numpy
pandas
plotly
pyfftw
pyfftw
<0.13.0
pykrige
pyproj
>2.2.0
py_tools_ds
>=0.18.0
...
...
setup.py
View file @
89a37b1d
...
...
@@ -52,7 +52,7 @@ req = [
'numpy'
,
'pandas'
,
'plotly'
,
'pyfftw
'
,
'pyfftw
<0.13.0'
,
# https://github.com/pyFFTW/pyFFTW/issues/294
'pykrige'
,
'pyproj>2.2.0'
,
'py_tools_ds>=0.18.0'
,
...
...
tests/CI_docker/context/environment_arosics.yml
View file @
89a37b1d
...
...
@@ -18,7 +18,7 @@ dependencies:
-
numpy
-
pandas
-
plotly
-
pyfftw
-
pyfftw
<0.13.0
-
pykrige
-
pyproj>2.2.0
-
py-tools-ds>=0.18.0
...
...
tests/test_COREG.py
View file @
89a37b1d
...
...
@@ -324,13 +324,17 @@ class CompleteWorkflow_INTER1_S2A_S2A(unittest.TestCase):
'ignore'
,
category
=
UserWarning
,
message
=
'Matplotlib is currently using agg, '
'which is a non-GUI backend, so cannot show the figure.'
)
CR
.
show_cross_power_spectrum
()
CR
.
show_cross_power_spectrum
(
interactive
=
True
)
CR
.
show_matchWin
(
interactive
=
False
,
after_correction
=
None
)
CR
.
show_matchWin
(
interactive
=
False
,
after_correction
=
True
)
CR
.
show_matchWin
(
interactive
=
False
,
after_correction
=
False
)
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
None
)
# only works if test is started with ipython
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
True
)
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
False
)
try
:
__IPYTHON__
# noqa
CR
.
show_cross_power_spectrum
(
interactive
=
True
)
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
None
)
# only works if test is started with ipython
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
True
)
CR
.
show_matchWin
(
interactive
=
True
,
after_correction
=
False
)
except
NameError
:
pass
CR
.
show_image_footprints
()
def
test_correct_shifts_without_resampling
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment