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

Remove trailing newline to ensure correct parsing #940

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

argilo
Copy link
Contributor

@argilo argilo commented Nov 15, 2024

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: ka9q/ka9q-radio#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.

I verified that this change works correctly with or without ka9q/ka9q-radio#65.

@darksidelemm darksidelemm merged commit 5d7c3b1 into projecthorus:testing Nov 15, 2024
5 checks passed
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.

2 participants