diff --git a/calculatingfeatures/cf_tests/calculate_ACC_features_test.py b/calculatingfeatures/cf_tests/calculate_ACC_features_test.py new file mode 100644 index 00000000..fcd62181 --- /dev/null +++ b/calculatingfeatures/cf_tests/calculate_ACC_features_test.py @@ -0,0 +1,32 @@ +import sys +sys.path.append("..") +from CalculatingFeatures.helper_functions import convert1DEmpaticaToArray, convertInputInto2d, accelerometerFeatureNames, frequencyFeatureNames +from CalculatingFeatures.helper_functions import convert3DEmpaticaToArray +from CalculatingFeatures.calculate_features import calculateFeatures + +import pandas as pd + +pathToAccCsv = "../example_data/S2_E4_Data_shortened/ACC.csv" +windowLength = 500 + +#np.seterr(all='raise') + +# get an array of values from ACC empatica file +acc_data, startTimeStamp, sampleRate = convert3DEmpaticaToArray(pathToAccCsv) +acc_data = acc_data[:, :int(300000//sampleRate)] + +# Convert the ACC data into 2D array +x_2D = convertInputInto2d(acc_data[0], windowLength) +y_2D = convertInputInto2d(acc_data[1], windowLength) +z_2D = convertInputInto2d(acc_data[2], windowLength) + +# Create a list with feature names +featureNames = [] +featureNames.extend(accelerometerFeatureNames) +featureNames.extend(frequencyFeatureNames) + +pd.set_option('display.max_columns', None) + +# Calculate features +calculatedFeatures = calculateFeatures(x_2D, y_2D, z_2D, fs=int(sampleRate), featureNames=featureNames) +print(calculatedFeatures) \ No newline at end of file diff --git a/calculatingfeatures/cf_tests/calculate_EDA_features_test.py b/calculatingfeatures/cf_tests/calculate_EDA_features_test.py index 1ad52838..7a1ba32c 100644 --- a/calculatingfeatures/cf_tests/calculate_EDA_features_test.py +++ b/calculatingfeatures/cf_tests/calculate_EDA_features_test.py @@ -57,7 +57,7 @@ plt.savefig('output_images/EDA_exa2.png') print(df_EDA.loc[no_interest, df_EDA.columns.str.contains('Peak')]) -# calculatedFeatures_EDA = calculateFeatures(eda_data_2D, fs=int(sampleRate_EDA), featureNames=gsrFeatureNames) -# print(calculatedFeatures_EDA) +calculatedFeatures_EDA = calculateFeatures(eda_data_2D, fs=int(sampleRate_EDA), featureNames=gsrFeatureNames) +print(calculatedFeatures_EDA) diff --git a/calculatingfeatures/cf_tests/calculate_HR_features_test.py b/calculatingfeatures/cf_tests/calculate_HR_features_test.py index 17ac815c..2b4b5134 100644 --- a/calculatingfeatures/cf_tests/calculate_HR_features_test.py +++ b/calculatingfeatures/cf_tests/calculate_HR_features_test.py @@ -11,6 +11,7 @@ windowLength = 500 # get an array of values from HRV empatica file hrv_data, startTimeStamp, sampleRate = convert1DEmpaticaToArray(pathToHrvCsv) +hrv_data = hrv_data[:int(300000//sampleRate)] # Convert the HRV data into 2D array hrv_data_2D = convertInputInto2d(hrv_data, windowLength) diff --git a/calculatingfeatures/cf_tests/calculate_TEMP_features_test.py b/calculatingfeatures/cf_tests/calculate_TEMP_features_test.py new file mode 100644 index 00000000..3fc1378e --- /dev/null +++ b/calculatingfeatures/cf_tests/calculate_TEMP_features_test.py @@ -0,0 +1 @@ +# Temparature features do not exist - should be used from the RAPIDS defaults?