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

Problems with ReedSolomonError Exception handling #25

Open
dchutchings opened this issue Jun 9, 2020 · 2 comments
Open

Problems with ReedSolomonError Exception handling #25

dchutchings opened this issue Jun 9, 2020 · 2 comments

Comments

@dchutchings
Copy link

dchutchings commented Jun 9, 2020

here's the relevant snippets of my code, which works fine with errors not exceeding RS capability

N, K = 255, 223
rsc = RSCodec(N-K, nsize=N)

for i in range(0,Npixels*N//K,N):
    try:
        rx_byte = np.append(rx_byte,np.uint8(rsc.decode(rx_enc[i:i+N])[0]))
    except ReedSolomonError:
        rx_byte = np.append(rx_byte,rx_enc[i:i+K])

I get

Traceback (most recent call last):

  File "  ", line 36, in <module>
    rx_byte = np.append(rx_byte,np.uint8(rsc.decode((rx_enc[i:i+N]))[0]))

  File "C:\ProgramData\Anaconda3\lib\site-packages\reedsolo.py", line 924, in decode
    rmes, recc, errata_pos = rs_correct_msg(chunk, nsym, fcr=self.fcr, generator=self.generator, erase_pos=e_pos, only_erasures=only_erasures)

  File "C:\ProgramData\Anaconda3\lib\site-packages\reedsolo.py", line 747, in rs_correct_msg
    err_pos = rs_find_errors(err_loc[::-1], len(msg_out), generator)

  File "C:\ProgramData\Anaconda3\lib\site-packages\reedsolo.py", line 693, in rs_find_errors
    raise ReedSolomonError("Too many (or few) errors found by Chien Search for the errata locator polynomial!")

ReedSolomonError: Too many (or few) errors found by Chien Search for the errata locator polynomial!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "  ", line 37, in <module>
    except ReedSolomonError:

NameError: name 'ReedSolomonError' is not defined
@lrq3000
Copy link
Collaborator

lrq3000 commented Jun 9, 2020

Hello, thank you for reporting the 2 bugs.

It's a bit difficult for me to debug with this few information. Could you please write the corrupted message raising this error, and the original uncorrupted message?

@lrq3000
Copy link
Collaborator

lrq3000 commented Jun 9, 2020

About your second error (ReedSolomonError is not defined), you first need to import the custom exception class with:

from reedsolo import ReedSolomonError

I have now added this info in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants