Changed wrapper method calculate_feature to its newest version (for TEMP and ACC).

sociality-task
Primoz 2022-05-11 14:21:21 +00:00
parent 31e36e7400
commit c1564f0cae
3 changed files with 47 additions and 18 deletions

View File

@ -477,7 +477,7 @@ EMPATICA_ACCELEROMETER:
CONTAINER: ACC
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxmagnitude", "minmagnitude", "avgmagnitude", "medianmagnitude", "stdmagnitude"]
SRC_SCRIPT: src/features/empatica_accelerometer/dbdp/main.py
CR:
@ -502,7 +502,7 @@ EMPATICA_HEARTRATE:
CONTAINER: HR
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxhr", "minhr", "avghr", "medianhr", "modehr", "stdhr", "diffmaxmodehr", "diffminmodehr", "entropyhr"]
SRC_SCRIPT: src/features/empatica_heartrate/dbdp/main.py
@ -511,7 +511,7 @@ EMPATICA_TEMPERATURE:
CONTAINER: TEMP
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxtemp", "mintemp", "avgtemp", "mediantemp", "modetemp", "stdtemp", "diffmaxmodetemp", "diffminmodetemp", "entropytemp"]
SRC_SCRIPT: src/features/empatica_temperature/dbdp/main.py
CR:
@ -532,18 +532,18 @@ EMPATICA_ELECTRODERMAL_ACTIVITY:
CONTAINER: EDA
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxeda", "mineda", "avgeda", "medianeda", "modeeda", "stdeda", "diffmaxmodeeda", "diffminmodeeda", "entropyeda"]
SRC_SCRIPT: src/features/empatica_electrodermal_activity/dbdp/main.py
CR:
COMPUTE: True
COMPUTE: False
FEATURES: ['mean', 'std', 'q25', 'q75', 'qd', 'deriv', 'power', 'numPeaks', 'ratePeaks', 'powerPeaks', 'sumPosDeriv', 'propPosDeriv', 'derivTonic',
'sigTonicDifference', 'freqFeats','maxPeakAmplitudeChangeBefore', 'maxPeakAmplitudeChangeAfter', 'avgPeakAmplitudeChangeBefore',
'avgPeakAmplitudeChangeAfter', 'avgPeakChangeRatio', 'maxPeakIncreaseTime', 'maxPeakDecreaseTime', 'maxPeakDuration', 'maxPeakChangeRatio',
'avgPeakIncreaseTime', 'avgPeakDecreaseTime', 'avgPeakDuration', 'maxPeakResponseSlopeBefore', 'maxPeakResponseSlopeAfter',
'signalOverallChange', 'changeDuration', 'changeRate', 'significantIncrease', 'significantDecrease']
WINDOWS:
COMPUTE: True
COMPUTE: False
WINDOW_LENGTH: 300 # specify window length in seconds
SECOND_ORDER_FEATURES: ['mean', 'median', 'sd', 'max', 'min']
SRC_SCRIPT: src/features/empatica_electrodermal_activity/cr/main.py
@ -553,11 +553,11 @@ EMPATICA_BLOOD_VOLUME_PULSE:
CONTAINER: BVP
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxbvp", "minbvp", "avgbvp", "medianbvp", "modebvp", "stdbvp", "diffmaxmodebvp", "diffminmodebvp", "entropybvp"]
SRC_SCRIPT: src/features/empatica_blood_volume_pulse/dbdp/main.py
CR:
COMPUTE: True
COMPUTE: False
FEATURES: ['meanHr', 'ibi', 'sdnn', 'sdsd', 'rmssd', 'pnn20', 'pnn50', 'sd', 'sd2', 'sd1/sd2', 'numRR', # Time features
'VLF', 'LF', 'LFnorm', 'HF', 'HFnorm', 'LF/HF', 'fullIntegral'] # Freq features
WINDOWS:
@ -571,11 +571,11 @@ EMPATICA_INTER_BEAT_INTERVAL:
CONTAINER: IBI
PROVIDERS:
DBDP:
COMPUTE: True
COMPUTE: False
FEATURES: ["maxibi", "minibi", "avgibi", "medianibi", "modeibi", "stdibi", "diffmaxmodeibi", "diffminmodeibi", "entropyibi"]
SRC_SCRIPT: src/features/empatica_inter_beat_interval/dbdp/main.py
CR:
COMPUTE: True
COMPUTE: False
FEATURES: ['meanHr', 'ibi', 'sdnn', 'sdsd', 'rmssd', 'pnn20', 'pnn50', 'sd', 'sd2', 'sd1/sd2', 'numRR', # Time features
'VLF', 'LF', 'LFnorm', 'HF', 'HFnorm', 'LF/HF', 'fullIntegral'] # Freq features
WINDOWS:

View File

@ -3,6 +3,7 @@ from scipy.stats import entropy
from cr_features.helper_functions import convert_to2d, accelerometer_features, frequency_features
from cr_features.calculate_features_old import calculateFeatures
from cr_features.calculate_features import calculate_features
from cr_features_helper_methods import extract_second_order_features
import sys
@ -19,21 +20,37 @@ def extract_acc_features_from_intraday_data(acc_intraday_data, features, window_
acc_intraday_features = pd.DataFrame()
# # apply methods from calculate features module
# if window_length is None:
# acc_intraday_features = \
# acc_intraday_data.groupby('local_segment').apply(lambda x: calculateFeatures( \
# convert_to2d(x['double_values_0'], x.shape[0]), \
# convert_to2d(x['double_values_1'], x.shape[0]), \
# convert_to2d(x['double_values_2'], x.shape[0]), \
# fs=sample_rate, featureNames=features))
# else:
# acc_intraday_features = \
# acc_intraday_data.groupby('local_segment').apply(lambda x: calculateFeatures( \
# convert_to2d(x['double_values_0'], window_length*sample_rate), \
# convert_to2d(x['double_values_1'], window_length*sample_rate), \
# convert_to2d(x['double_values_2'], window_length*sample_rate), \
# fs=sample_rate, featureNames=features))
# apply methods from calculate features module
if window_length is None:
acc_intraday_features = \
acc_intraday_data.groupby('local_segment').apply(lambda x: calculateFeatures( \
acc_intraday_data.groupby('local_segment').apply(lambda x: calculate_features( \
convert_to2d(x['double_values_0'], x.shape[0]), \
convert_to2d(x['double_values_1'], x.shape[0]), \
convert_to2d(x['double_values_2'], x.shape[0]), \
fs=sample_rate, featureNames=features))
fs=sample_rate, feature_names=features))
else:
acc_intraday_features = \
acc_intraday_data.groupby('local_segment').apply(lambda x: calculateFeatures( \
acc_intraday_data.groupby('local_segment').apply(lambda x: calculate_features( \
convert_to2d(x['double_values_0'], window_length*sample_rate), \
convert_to2d(x['double_values_1'], window_length*sample_rate), \
convert_to2d(x['double_values_2'], window_length*sample_rate), \
fs=sample_rate, featureNames=features))
fs=sample_rate, feature_names=features))
acc_intraday_features.reset_index(inplace=True)

View File

@ -3,6 +3,7 @@ from scipy.stats import entropy
from cr_features.helper_functions import convert_to2d, generic_features
from cr_features.calculate_features_old import calculateFeatures
from cr_features.calculate_features import calculate_features
from cr_features_helper_methods import extract_second_order_features
import sys
@ -19,15 +20,26 @@ def extract_temp_features_from_intraday_data(temperature_intraday_data, features
temperature_intraday_features = pd.DataFrame()
# apply methods from calculate features module
# if window_length is None:
# temperature_intraday_features = \
# temperature_intraday_data.groupby('local_segment').apply(\
# lambda x: calculateFeatures(convert_to2d(x['temperature'], x.shape[0]), fs=sample_rate, featureNames=features))
# else:
# temperature_intraday_features = \
# temperature_intraday_data.groupby('local_segment').apply(\
# lambda x: calculateFeatures(convert_to2d(x['temperature'], window_length*sample_rate), fs=sample_rate, featureNames=features))
# apply methods from calculate features module
if window_length is None:
temperature_intraday_features = \
temperature_intraday_data.groupby('local_segment').apply(\
lambda x: calculateFeatures(convert_to2d(x['temperature'], x.shape[0]), fs=sample_rate, featureNames=features))
lambda x: calculate_features(convert_to2d(x['temperature'], x.shape[0]), fs=sample_rate, feature_names=features))
else:
temperature_intraday_features = \
temperature_intraday_data.groupby('local_segment').apply(\
lambda x: calculateFeatures(convert_to2d(x['temperature'], window_length*sample_rate), fs=sample_rate, featureNames=features))
lambda x: calculate_features(convert_to2d(x['temperature'], window_length*sample_rate), fs=sample_rate, feature_names=features))
temperature_intraday_features.reset_index(inplace=True)