added txt, data and scripts

This commit is contained in:
Fiedler
2025-09-24 14:28:18 +02:00
parent a169c66e2b
commit f1a812b800
5 changed files with 296 additions and 0 deletions

View File

@ -0,0 +1,38 @@
import sys
import csv
from pathlib import Path
def fix_decimal_csv(input_path, output_path):
with open(input_path, 'r', newline='', encoding='utf-8') as infile, \
open(output_path, 'w', newline='', encoding='utf-8') as outfile:
reader = csv.reader(infile)
writer = csv.writer(outfile)
# Write the first line (scene name) as is
scene_line = next(reader)
writer.writerow(scene_line)
# Write the header as is (if present)
header = next(reader)
writer.writerow(header)
for row in reader:
# Keep first two columns as is
fixed_row = row[:2]
# Join every pair of columns from the third onward
for i in range(2, len(row), 2):
if i+1 < len(row):
fixed_val = f'{row[i]}.{row[i+1]}'
fixed_row.append(fixed_val)
writer.writerow(fixed_row)
if __name__ == '__main__':
# Find all matching CSVs recursively
root = Path('.')
out_root = root / 'Recordings'
out_root.mkdir(exist_ok=True)
csv_files = list(root.rglob('P*_PositionData*.csv'))
for csv_file in csv_files:
# Compute output path in Recordings dir, preserving subdirs
rel_path = csv_file.relative_to(root)
out_path = out_root / rel_path
out_path.parent.mkdir(parents=True, exist_ok=True)
fix_decimal_csv(csv_file, out_path)
print(f'Corrected file written to: {out_path}')