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

Make wspr.py compatible with Python 3 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kholia
Copy link

@kholia kholia commented Feb 4, 2023

Before this change:

wspr.py:373: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
  zz = numpy.fromstring(z, numpy.int16)
Traceback (most recent call last):
  File "/home/user/weakmon/./wspr.py", line 1641, in <module>
    main()
  File "/home/user/weakmon/./wspr.py", line 1620, in main
    r.gowav(filename, 0)
  File "/home/user/weakmon/./wspr.py", line 394, in gowav
    self.process(samples, 0)
  File "/home/user/weakmon/./wspr.py", line 563, in process
    dec = self.process1(samples_minute, ss[0:162], hza, noise)
  File "/home/user/weakmon/./wspr.py", line 1219, in process1
    [ msgbits, metric ] = nfano_decode(sym0, sym1)
  File "/home/user/weakmon/./wspr.py", line 139, in nfano_decode
    out_array_type = c_ubyte * (len(in0) / 2)
TypeError: can't multiply sequence by non-int of type 'float'

After this change:

$ python3 ./wspr.py -file ~/Downloads/150426_0918.wav  
1487.2 1.6 0.1 -7 WD4LHT EL89 30
1584.7 1.8 -0.0 -11  W3HH  EL89 30
1444.4 2.1 0.0 -9 ND6P   DM04 30
1515.3 1.4 -0.0 -21 KI7CI  DM09 37
1458.3 1.1 -0.0 -16  W5BIT EL09 17
1527.5 -1.0 0.0 -20 DJ6OL  JO52 37
1500.7 0.3 -0.0 -5 NM7J   DM26 30
1502.1 2.4 -1.0 -14 N2Q/U32ODA 10

The WSPR decoder seems to be functional with Python 3 after this change.

These changes were tested on Ubuntu 22.04 LTS 64-bit OS.

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

Successfully merging this pull request may close these issues.

1 participant