Skip to content

Commit 10606d0

Browse files
author
LegrandNico
committed
HRD: Add reference tone function in parameters
1 parent 280ca67 commit 10606d0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cardioception/HRD/parameters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ def getParameters(
127127
Subject ID. Default is 'Participant'.
128128
path : str
129129
The task working directory.
130+
referenceTone : callable
131+
Function selecting the reference tones for the exteroceptive condition.
132+
The output should be a single float matching the name of the `.wav` files
133+
(ending with `.0` or `.5`). Default is uniform between 40.0 and 100.0 BPM
134+
(`np.random.choice(np.arange(40, 100, 0.5))`).
130135
serial : PySerial instance
131136
The serial port used to record the PPG activity.
132137
screenNb : int
@@ -175,6 +180,7 @@ def getParameters(
175180
parameters["nBreaking"] = nBreaking
176181
parameters["lambdaIntero"] = [] # Save the history of lambda values
177182
parameters["lambdaExtero"] = [] # Save the history of lambda values
183+
parameters["referenceTone"] = np.random.choice(np.arange(40, 100, 0.5))
178184

179185
parameters["signal_df"] = pd.DataFrame([]) # Physiological recording
180186
parameters["results_df"] = pd.DataFrame([]) # Behavioral results

cardioception/HRD/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def trial(
529529
startTrigger = time.time()
530530

531531
# Random selection of HR frequency
532-
listenBPM = np.random.choice(np.arange(40, 100, 0.5))
532+
listenBPM = parameters["referenceTone"]
533533

534534
# Play the corresponding beat file
535535
listenFile = pkg_resources.resource_filename(

0 commit comments

Comments
 (0)