Fixed RAPIDS bug: error when IBI.csv is empty.
parent
fbf6a77dfc
commit
d300f0f8f0
|
@ -114,7 +114,7 @@ sn_profile_*/
|
|||
settings.dcf
|
||||
tests/fakedata_generation/
|
||||
site/
|
||||
credentials.yaml
|
||||
!credentials.yaml
|
||||
|
||||
# Docker container and other files
|
||||
.devcontainer
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
########################################################################################################################
|
||||
|
||||
# See https://www.rapids.science/latest/setup/configuration/#participant-files
|
||||
PIDS: [p02, p03] #p01, p02, p03]
|
||||
PIDS: [p03] #p01, p02, p03]
|
||||
|
||||
# See https://www.rapids.science/latest/setup/configuration/#automatic-creation-of-participant-files
|
||||
CREATE_PARTICIPANT_FILES:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
PSQL_STRAW:
|
||||
database: staw
|
||||
user: staw_db
|
||||
password: kizi-x2yf-mate
|
||||
host: 212.235.208.113
|
||||
port: 5432
|
||||
|
|
@ -111,7 +111,7 @@ dependencies:
|
|||
- biosppy==0.8.0
|
||||
- cached-property==1.5.2
|
||||
- configargparse==0.15.1
|
||||
- cr-features==0.1.11
|
||||
- cr-features==0.1.13
|
||||
- cycler==0.11.0
|
||||
- decorator==4.4.2
|
||||
- fonttools==4.33.2
|
||||
|
|
|
@ -68,8 +68,11 @@ def extract_empatica_data(data, sensor):
|
|||
|
||||
elif sensor == 'EMPATICA_INTER_BEAT_INTERVAL':
|
||||
|
||||
df = pd.read_csv(sensor_data_file, names=['timestamp', column], header=None)
|
||||
df['timings'] = df['timestamp']
|
||||
df = pd.read_csv(sensor_data_file, names=['timings', column], header=None)
|
||||
df['timestamp'] = df['timings']
|
||||
if df.empty:
|
||||
df = df.set_index('timestamp')
|
||||
return df
|
||||
timestampstart = float(df['timestamp'][0])
|
||||
df['timestamp'] = (df['timestamp'][1:len(df)]).astype(float) + timestampstart
|
||||
df = df.drop([0])
|
||||
|
@ -126,7 +129,19 @@ def patch_ibi_with_bvp(ibi_data, bvp_data):
|
|||
ibi_data_file = BytesIO(ibi_data).getvalue().decode('utf-8')
|
||||
ibi_data_file = StringIO(ibi_data_file)
|
||||
|
||||
ibi_data, ibi_start_timestamp = empatica2d_to_array(ibi_data_file)
|
||||
|
||||
|
||||
# Begin with the cr-features part
|
||||
try:
|
||||
ibi_data, ibi_start_timestamp = empatica2d_to_array(ibi_data_file)
|
||||
except IndexError:
|
||||
# Checks whether IBI.csv is empty
|
||||
df_test = pd.read_csv(ibi_data_file, names=['timings', 'inter_beat_interval'], header=None)
|
||||
print(df_test)
|
||||
if df_test.empty:
|
||||
df_test['timestamp'] = df_test['timings']
|
||||
df_test = df_test.set_index('timestamp')
|
||||
return df_test
|
||||
|
||||
bvp_data_file = BytesIO(bvp_data).getvalue().decode('utf-8')
|
||||
bvp_data_file = StringIO(bvp_data_file)
|
||||
|
@ -139,7 +154,7 @@ def patch_ibi_with_bvp(ibi_data, bvp_data):
|
|||
winsorize_value=25, hampel_fiter=False, median_filter=False,
|
||||
mod_z_score_filter=True, sampling=64, feature_names=['meanHr'])
|
||||
|
||||
ibi_timings, ibi_rr = get_patched_ibi_with_bvp(ibi_data[0], ibi_data[1], bvp_timings, bvp_rr, min_length=10)
|
||||
ibi_timings, ibi_rr = get_patched_ibi_with_bvp(ibi_data[0], ibi_data[1], bvp_timings, bvp_rr, min_length=None)
|
||||
|
||||
df = \
|
||||
pd.DataFrame(np.array([ibi_timings, ibi_rr]).transpose(), columns=['timestamp', 'inter_beat_interval'])
|
||||
|
|
Loading…
Reference in New Issue