Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError exception while open cfile #615

Closed
oripio opened this issue Feb 14, 2019 · 3 comments
Closed

ZeroDivisionError exception while open cfile #615

oripio opened this issue Feb 14, 2019 · 3 comments
Assignees
Labels

Comments

@oripio
Copy link

oripio commented Feb 14, 2019

Expected Behavior

While open cfile I'm getting error:

Error: float division by zero


Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/urh/controller/MainController.py", line 781, in show_open_dialog
self.add_files(file_names)
File "/usr/local/lib/python3.5/dist-packages/urh/controller/MainController.py", line 402, in add_files
self.add_signalfile(filename, group_id, enforce_sample_rate=enforce_sample_rate)
File "/usr/local/lib/python3.5/dist-packages/urh/controller/MainController.py", line 288, in add_signalfile
self.add_signal(signal, group_id)
File "/usr/local/lib/python3.5/dist-packages/urh/controller/MainController.py", line 302, in add_signal
signal.auto_detect(detect_modulation=True, detect_noise=False)
File "/usr/local/lib/python3.5/dist-packages/urh/signalprocessing/Signal.py", line 381, in auto_detect
estimated_params = AutoInterpretation.estimate(self.data, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/urh/ainterpretation/AutoInterpretation.py", line 378, in estimate
center = detect_center(msg_rect_data)
File "/usr/local/lib/python3.5/dist-packages/urh/ainterpretation/AutoInterpretation.py", line 207, in detect_center
y, x = np.histogram(rect, bins=np.arange(hist_min, hist_max + hist_step, hist_step))
ZeroDivisionError: float division by zero

Actual Behavior
Steps To Reproduce
  1. Go to 'File'
  2. Click on 'Open'
  3. Select any cfile
  4. Click on 'Open'
  5. Get an error
Screenshots
Platform Specifications
  • OS: Debian Linux (Linux Mint LMDE 3 Cindy)
  • URH version: 2.5.5
  • Python version: 3.5.3
  • Installed via pip
@jopohl
Copy link
Owner

jopohl commented Feb 14, 2019 via email

@jopohl
Copy link
Owner

jopohl commented Feb 14, 2019 via email

@oripio
Copy link
Author

oripio commented Feb 20, 2019

Can't fix this right now as I am on vacation but as a workaround you can use Edit menu and uncheck the auto detect newly loaded signals (exact caption may vary) checkbox. Am 14. Februar 2019 12:59:06 OEZ schrieb "0RÎᑭÎ0" [email protected]:

If I uncheck this - it opens fine but once I click to 'Autodetect parameters' - it crashes in the same way.

Here is the file which generates an exception: https://ufile.io/p4xih

jopohl added a commit that referenced this issue Feb 20, 2019
If a signal has segments with zero variance i.e. constant lines,
the center detection crashes because the histogram can not be created.
This fix catches the ZeroDivision error and returns None in that case.
@jopohl jopohl self-assigned this Feb 20, 2019
@jopohl jopohl added the bug label Feb 20, 2019
@jopohl jopohl closed this as completed in 8ea7feb Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants