[FEAT] Feat Include Undamaged Node Classification #98
@@ -25,9 +25,9 @@ def create_ready_data(
|
||||
"""
|
||||
ready_data = []
|
||||
for file in os.listdir(stft_data_path):
|
||||
ready_data.append(pd.read_csv(os.path.join(stft_data_path, file)))
|
||||
ready_data.append(pd.read_csv(os.path.join(stft_data_path, file), skiprows=1))
|
||||
|
||||
y_data = [i for i in range(len(ready_data))]
|
||||
y_data = [i for i in range(len(ready_data))] # TODO: Should be replaced with actual desired labels
|
||||
|
||||
# Combine all dataframes in ready_data into a single dataframe
|
||||
if ready_data: # Check if the list is not empty
|
||||
|
||||
@@ -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