fix(src): update damage base path and adjust STFT processing parameters

This commit is contained in:
nuluh
2025-10-16 12:16:38 +07:00
parent 511014d37d
commit e347b63e6e
2 changed files with 17 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ import multiprocessing # Added import for multiprocessing
from typing import Union, Tuple
# 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 = {
@@ -52,7 +52,7 @@ def compute_stft(vibration_data: np.ndarray, return_param: bool = False) -> Unio
hop_size = 512
window = hann(window_size)
Fs = 1024
frequencies, times, Zxx = stft(
vibration_data,
fs=Fs,
@@ -77,7 +77,7 @@ def process_damage_case(damage_num):
damage_folder = os.path.join(damage_base_path, f'DAMAGE_{damage_num}')
if damage_num == 0:
# Number of test runs per damage case
num_test_runs = 120
num_test_runs = 125
else:
num_test_runs = 5
# Check if the damage folder exists
@@ -122,12 +122,12 @@ def process_damage_case(damage_num):
# only inlcude 21 samples vector features for first 45 num_test_runs else include 22 samples vector features
if damage_num == 0:
print(f"Processing damage_num = 0, test_num = {test_num}")
if test_num <= 45:
df_stft = df_stft.iloc[:22, :]
print(f"Reduced df_stft shape (21 samples): {df_stft.shape}")
if test_num <= 60:
df_stft = df_stft.iloc[:20, :]
print(f"Reduced df_stft shape (20 samples): {df_stft.shape}")
else:
df_stft = df_stft.iloc[:21, :]
print(f"Reduced df_stft shape (22 samples): {df_stft.shape}")
print(f"Reduced df_stft shape (21 samples): {df_stft.shape}")
# Append to the aggregated list
aggregated_stft.append(df_stft)