Catch another possible exception.

update_libs
junos 2023-04-12 16:37:25 +02:00
parent 1d903f3629
commit a36da99ccb
1 changed files with 2 additions and 1 deletions

View File

@ -136,8 +136,9 @@ def patch_ibi_with_bvp(ibi_data, bvp_data):
# Begin with the cr-features part # Begin with the cr-features part
try: try:
ibi_data, ibi_start_timestamp = empatica2d_to_array(ibi_data_file) ibi_data, ibi_start_timestamp = empatica2d_to_array(ibi_data_file)
except IndexError as e: except (IndexError, KeyError) as e:
# Checks whether IBI.csv is empty # Checks whether IBI.csv is empty
# It may raise a KeyError if df is empty here: startTimeStamp = df.time[0]
df_test = pd.read_csv(ibi_data_file, names=['timings', 'inter_beat_interval'], header=None) df_test = pd.read_csv(ibi_data_file, names=['timings', 'inter_beat_interval'], header=None)
if df_test.empty: if df_test.empty:
df_test['timestamp'] = df_test['timings'] df_test['timestamp'] = df_test['timings']