diff --git a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/NIRS_filtering.py b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/NIRS_filtering.py index 8aa2fb7c9..cf343b2af 100644 --- a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/NIRS_filtering.py +++ b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/NIRS_filtering.py @@ -79,7 +79,7 @@ def check_cv( list(zip(channels, cv_vals, channel_good_or_bad)), columns=["Channels", "coeff_of_var", "status"], ) - df.to_csv(new_csv_file_path + "/" + "NIRS_channel_quality.csv", index=False) + df.to_csv(new_csv_file_path + "/" + "NIRS_channel_quality.csv", sep=";",index=False) def filter_NIRS(data): diff --git a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_time_distribution.py b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_time_distribution.py index 33bf201f6..9cf43a7ff 100644 --- a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_time_distribution.py +++ b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_time_distribution.py @@ -22,7 +22,7 @@ def utc_time_ns(seconds): def create_time_distribution(data): - time_distribution_unix_list.append(temp) + # time_distribution_unix_list.append(temp) time_distribution_unix_list = data["time_stamps"] ctime_list = [] diff --git a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_write_csv_file.py b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_write_csv_file.py index 3c3056560..b0943c1d8 100644 --- a/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_write_csv_file.py +++ b/human_experiments/lab_software/tomcat-physio-data-extraction/utils/create_write_csv_file.py @@ -21,7 +21,8 @@ def get_timestamps_from_dict( state_end = df_temp.index[ iloc_idx_end ] # reduce index by 1 as the index sometimes overflows - range_ = list(range(state_start, state_end)) + state_start, state_end = state_start-1, state_end+2 # Increase start and stop state by 1 to avoid NaNs for data extrapolation script. + range_ = list(range(state_start, state_end)) state = [state] * len(range_) state = {i: x for i, x in enumerate(state, state_start)} @@ -542,7 +543,7 @@ def dataframe_to_csv( # Save as CSV file if extract_csv == True: - df_original.to_csv(new_csv_file_path + ".csv", sep="\t", encoding="utf-8") + df_original.to_csv(new_csv_file_path + ".csv", sep=";", encoding="utf-8") print( colored("[INFO]", "green", attrs=["bold"]), colored("Sucessfully generated csv file at", "green", attrs=["bold"]), @@ -552,7 +553,7 @@ def dataframe_to_csv( if bool(filter) == True and stream_type == "NIRS": df_final_filtered = filter_NIRS(df_final) df_final_filtered.to_csv( - new_csv_file_path + "_filtered" + ".csv", sep="\t", encoding="utf-8" + new_csv_file_path + "_filtered" + ".csv", sep=";", encoding="utf-8" ) print( colored("[INFO]", "green", attrs=["bold"]), @@ -567,7 +568,7 @@ def dataframe_to_csv( if bool(filter) == True and stream_type == "EEG": df_final_filtered = filter_EEG(df_final) df_final_filtered.to_csv( - new_csv_file_path + "_filtered" + ".csv", sep="\t", encoding="utf-8" + new_csv_file_path + "_filtered" + ".csv", sep=";", encoding="utf-8" ) print( colored("[INFO]", "green", attrs=["bold"]), diff --git a/human_experiments/lab_software/tomcat-physio-data-extraction_v2/utils/label_data.py b/human_experiments/lab_software/tomcat-physio-data-extraction_v2/utils/label_data.py index 2f4bb57e4..997adee13 100644 --- a/human_experiments/lab_software/tomcat-physio-data-extraction_v2/utils/label_data.py +++ b/human_experiments/lab_software/tomcat-physio-data-extraction_v2/utils/label_data.py @@ -2,6 +2,7 @@ def update_state(block, state, start_time, end_time): try: start_index = block["unix_time"].searchsorted(start_time) end_index = block["unix_time"].searchsorted(end_time) + start_index, end_index = start_index-2, end_index+2 block.loc[start_index:end_index, "event_type"] = state except KeyError as e: print(f"KeyError: {e} in update_state function")