fix(data): Fix pool mapping to include undamaged case and add csv header separator line for Excel compatibility
This commit is contained in:
@@ -6,7 +6,7 @@ import glob
|
||||
import multiprocessing # Added import for multiprocessing
|
||||
|
||||
# Define the base directory where DAMAGE_X folders are located
|
||||
damage_base_path = 'D:/thesis/data/converted/raw'
|
||||
damage_base_path = 'D:/thesis/data/converted/raw_B'
|
||||
|
||||
# Define output directories for each sensor
|
||||
output_dirs = {
|
||||
@@ -105,11 +105,13 @@ def process_damage_case(damage_num):
|
||||
)
|
||||
|
||||
# Save the aggregated STFT to CSV
|
||||
df_aggregated.to_csv(output_file, index=False)
|
||||
with open(output_file, 'w') as file:
|
||||
file.write('sep=,\n')
|
||||
df_aggregated.to_csv(output_file, index=False)
|
||||
print(f"Saved aggregated STFT for Sensor {sensor_num}, Damage {damage_num} to {output_file}")
|
||||
else:
|
||||
print(f"No STFT data aggregated for Sensor {sensor_num}, Damage {damage_num}.")
|
||||
|
||||
if __name__ == "__main__": # Added main guard for multiprocessing
|
||||
with multiprocessing.Pool() as pool:
|
||||
pool.map(process_damage_case, range(1, num_damage_cases + 1))
|
||||
pool.map(process_damage_case, range(0, num_damage_cases + 1))
|
||||
|
||||
Reference in New Issue
Block a user