The read_ka9q_power_log function keeps the trailing newline character on each line it reads. Because ka9q-radio's "powers" utility ends lines with a trailing comma (proposed fix: https://github.com/ka9q/ka9q-radio/pull/65), np.fromstring interprets the trailing newline character as an invalid value and replaces it with -1. As a result, the list of bin powers is one too long, which causes the frequency range generated by np.linspace to be incorrect.
Here I've corrected the problem by removing the trailing newline with rstrip(). It is idiomatic to do this when reading lines from a file in Python. After this change, np.fromstring ignores powers' trailing comma.
The
read_ka9q_power_log
function keeps the trailing newline character on each line it reads. Because ka9q-radio's "powers" utility ends lines with a trailing comma (proposed fix: https://github.com/ka9q/ka9q-radio/pull/65),np.fromstring
interprets the trailing newline character as an invalid value and replaces it with -1. As a result, the list of bin powers is one too long, which causes the frequency range generated bynp.linspace
to be incorrect.Here I've corrected the problem by removing the trailing newline with
rstrip()
. It is idiomatic to do this when reading lines from a file in Python. After this change,np.fromstring
ignores powers' trailing comma.I verified that this change works correctly with or without https://github.com/ka9q/ka9q-radio/pull/65.