From ff5578652f368d099bd6c8e27cd6a4f56da594b5 Mon Sep 17 00:00:00 2001 From: nuluh Date: Tue, 3 Sep 2024 12:08:53 +0700 Subject: [PATCH] fix(script): Fix bugs taking incorrect column by changing `columns` and `sensor_end_map` index number to take the loop of enumeration. --- data/QUGS/convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/QUGS/convert.py b/data/QUGS/convert.py index 93f5a9c..865b633 100644 --- a/data/QUGS/convert.py +++ b/data/QUGS/convert.py @@ -28,7 +28,7 @@ def create_damage_files(base_path, output_base): file_path = os.path.join(base_path, f'zzzAD{file_index}.TXT') df = pd.read_csv(file_path, sep='\t', skiprows=10) # Read with explicit column names - top_sensor = columns[damage-1] + top_sensor = columns[i-1] print(top_sensor, type(top_sensor)) output_file_1 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage:0{damage_pad}}_TEST{i:0{test_pad}}_01.csv') print(f"Creating {output_file_1} from taking zzzAD{file_index}.TXT") @@ -37,7 +37,7 @@ def create_damage_files(base_path, output_base): df[['Time', top_sensor]].to_csv(output_file_1, index=False) print(Fore.GREEN + "Done") - bottom_sensor = sensor_end_map[damage] + bottom_sensor = sensor_end_map[i] output_file_2 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage}_TEST{i}_02.csv') print(f"Creating {output_file_2} from taking zzzAD{file_index}.TXT") print("Taking datetime column on index 0...")