Taiga commited on
Commit
ef8e4bf
·
unverified ·
2 Parent(s): 93fa10e16cc068

Merge pull request #31 from moriyalab/fix_bug

Browse files
Files changed (1) hide show
  1. lab_tools/spectrogram.py +12 -12
lab_tools/spectrogram.py CHANGED
@@ -216,24 +216,24 @@ def save_all_data_to_csv(
216
  integration_method (str): 数値積分の手法 ("trapz" または "simps")
217
  """
218
  # 各帯域の強度を計算
219
- gamma_raw, gamma_smothed = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (30, 36), method=method, integration_method=integration_method)
220
- beta_raw, beta_smothed = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (15, 30), method=method, integration_method=integration_method)
221
- alpha_raw, alpha_smothed = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (8, 12), method=method, integration_method=integration_method)
222
- theta_raw, theta_smothed = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (4, 8), method=method, integration_method=integration_method)
223
- delta_raw, delta_smothed = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (0, 4), method=method, integration_method=integration_method)
224
 
225
  # 全体の積分値を計算
226
- total_intensity = gamma_smothed + beta_smothed + alpha_smothed + theta_smothed + delta_smothed
227
 
228
  # 各帯域を正規化
229
- gamma_normalized = gamma_smothed / total_intensity
230
- beta_normalized = beta_smothed / total_intensity
231
- alpha_normalized = alpha_smothed / total_intensity
232
- theta_normalized = theta_smothed / total_intensity
233
- delta_normalized = delta_smothed / total_intensity
234
 
235
  # pandas DataFrameにまとめる
236
- trimmed_time_array = time_array[:len(gamma_smothed)]
237
  data1 = {
238
  "Time [sec]": trimmed_time_array,
239
  "Gamma Normalized [30-36 Hz]": gamma_normalized,
 
216
  integration_method (str): 数値積分の手法 ("trapz" または "simps")
217
  """
218
  # 各帯域の強度を計算
219
+ gamma_raw, _ = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (30, 36), method=method, integration_method=integration_method)
220
+ beta_raw, _ = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (15, 30), method=method, integration_method=integration_method)
221
+ alpha_raw, _ = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (8, 12), method=method, integration_method=integration_method)
222
+ theta_raw, _ = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (4, 8), method=method, integration_method=integration_method)
223
+ delta_raw, _ = calculate_frequency_band_intensity(frequency_array, analysis_matrix, (0, 4), method=method, integration_method=integration_method)
224
 
225
  # 全体の積分値を計算
226
+ total_intensity = gamma_raw + beta_raw + alpha_raw + theta_raw + delta_raw
227
 
228
  # 各帯域を正規化
229
+ gamma_normalized = gamma_raw / total_intensity
230
+ beta_normalized = beta_raw / total_intensity
231
+ alpha_normalized = alpha_raw / total_intensity
232
+ theta_normalized = theta_raw / total_intensity
233
+ delta_normalized = delta_raw / total_intensity
234
 
235
  # pandas DataFrameにまとめる
236
+ trimmed_time_array = time_array[:len(gamma_raw)]
237
  data1 = {
238
  "Time [sec]": trimmed_time_array,
239
  "Gamma Normalized [30-36 Hz]": gamma_normalized,