Fourier icon indicating copy to clipboard operation
Fourier copied to clipboard

ZeroDivisionError: division by zero when running demo

Open jvence opened this issue 2 years ago • 1 comments

On Mac OS with python 3.7:

rohart.jpg path: /Users/me/tmp/Fourier/FourierImages/rohart.jpg [Application of the Fourier Transform.] Window has been created. Traceback (most recent call last): File "main.py", line 37, in fourier() File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 156, in call self.events() File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 170, in events self.setMode((self.mode + 1) % 3) File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 319, in setMode self.setConstructionMode() File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 334, in setConstructionMode self.coefficients = Fourier.transform(self.sample, self.coefficients_number) File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 34, in transform cn /= npts ZeroDivisionError: division by zero

jvence avatar Mar 07 '23 16:03 jvence

Yes it can happen when no points has been selected in the construction mode. You have to select some points on your image by clicking on it. I could add a little warning but i just forgot to treat this case. I might fix it in future versions.

MarcPartensky avatar Apr 18 '23 21:04 MarcPartensky