-
Notifications
You must be signed in to change notification settings - Fork 744
Closed
Description
With link dataratelogging on we ca write a logfile to debug telementry link issues. However the values saved in the .csv differ from the loss precent shown in link.
Example: link reports 1.7% but the file has 177%
I belive the conversion in this line is wrong:
It should not be muliplied by 100.
In case you want to fix exsting datarate logs, i wrote this utility script:
import csv
import sys
from pathlib import Path
def fix_dataratelog(filepath):
# Create a backup of original file
filepath = Path(filepath)
backup_path = filepath.with_suffix('.csv.bak')
filepath.rename(backup_path)
# Read from backup, write to new file
with open(backup_path, 'r') as infile, open(filepath, 'w', newline='') as outfile:
reader = csv.reader(infile)
writer = csv.writer(outfile)
# Write header
header = next(reader)
writer.writerow(header)
# Process each row
for row in reader:
# Convert last column to float, divide by 100, convert back to string
row[-1] = str(float(row[-1]) / 100)
writer.writerow(row)
print(f"Fixed {filepath}")
print(f"Backup saved as {backup_path}")
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python fix_dataratelog.py path/to/dataratelog.csv")
sys.exit(1)
fix_dataratelog(sys.argv[1])
Metadata
Metadata
Assignees
Labels
No labels