Added text output to calibration patch

This commit is contained in:
2019-01-14 11:05:15 +00:00
parent 20aab6a38e
commit 9468c48215
5 changed files with 423 additions and 9 deletions
+418 -4
View File
@@ -8,7 +8,7 @@
"architecture" : "x86"
}
,
"rect" : [ 0.0, 44.0, 1366.0, 678.0 ],
"rect" : [ 0.0, 44.0, 1012.0, 678.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -28,6 +28,178 @@
"digest" : "",
"tags" : "",
"boxes" : [ {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-112",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 99.0, 623.0, 99.0, 18.0 ],
"text" : "write cal_vals.txt"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-110",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "bang", "" ],
"patching_rect" : [ 276.5, 662.0, 33.0, 20.0 ],
"text" : "t b s"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-109",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 276.5, 700.0, 32.5, 18.0 ],
"text" : "cr"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-103",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "bang", "dump", "clear" ],
"patching_rect" : [ 99.0, 553.0, 118.0, 20.0 ],
"text" : "t b dump clear"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-97",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 3,
"outlettype" : [ "", "bang", "int" ],
"patching_rect" : [ 231.75, 734.0, 93.0, 20.0 ],
"text" : "text cal_vals.txt"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-91",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "bang", "bang" ],
"patching_rect" : [ 511.25, 127.0, 34.0, 20.0 ],
"text" : "t b b"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-90",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 889.0, 509.0, 57.0, 18.0 ],
"presentation_rect" : [ 903.0, 453.0, 0.0, 0.0 ],
"text" : "4 mat $1"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-89",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 636.0, 509.0, 63.0, 18.0 ],
"presentation_rect" : [ 634.25, 442.0, 0.0, 0.0 ],
"text" : "3 story $1"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-88",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 380.25, 509.0, 51.0, 18.0 ],
"presentation_rect" : [ 374.0, 441.0, 0.0, 0.0 ],
"text" : "2 da $1"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-85",
"maxclass" : "message",
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 250.0, 509.0, 61.0, 18.0 ],
"text" : "1 click $1"
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
"id" : "obj-83",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 4,
"outlettype" : [ "", "", "", "" ],
"patching_rect" : [ 250.0, 622.0, 59.5, 20.0 ],
"saved_object_attributes" : {
"embed" : 0
}
,
"text" : "coll"
}
}
, {
"box" : {
"id" : "obj-82",
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 511.25, 88.0, 20.0, 20.0 ]
}
}
, {
"box" : {
"fontname" : "Arial",
"fontsize" : 12.0,
@@ -154,7 +326,7 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "bang" ],
"patching_rect" : [ 192.25, 74.0, 60.0, 20.0 ],
"patching_rect" : [ 192.25, 15.0, 60.0, 20.0 ],
"presentation_rect" : [ 125.0, 267.0, 0.0, 0.0 ],
"text" : "loadbang"
}
@@ -519,7 +691,7 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 104.25, 584.0, 552.0, 20.0 ],
"patching_rect" : [ 104.25, 780.0, 552.0, 20.0 ],
"text" : "loadmess append OSX:/Users/samuelperry/Work/SOTON/Initial_work/BPLabs/calibration/out/stimulus"
}
@@ -533,7 +705,7 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 104.25, 613.0, 49.0, 20.0 ],
"patching_rect" : [ 104.25, 809.0, 49.0, 20.0 ],
"text" : "filepath"
}
@@ -550,6 +722,74 @@
}
],
"lines" : [ {
"patchline" : {
"destination" : [ "obj-112", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-103", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-83", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 158.0, 597.0, 259.5, 597.0 ],
"source" : [ "obj-103", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-97", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 207.5, 646.0, 241.25, 646.0 ],
"source" : [ "obj-103", 2 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-97", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 286.0, 725.5, 241.25, 725.5 ],
"source" : [ "obj-109", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-109", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-110", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-97", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 300.0, 691.5, 241.25, 691.5 ],
"source" : [ "obj-110", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-97", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 108.5, 680.0, 241.25, 680.0 ],
"source" : [ "obj-112", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-2", 0 ],
"disabled" : 0,
@@ -608,6 +848,7 @@
"destination" : [ "obj-52", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 113.75, 358.5, 215.25, 358.5 ],
"source" : [ "obj-51", 0 ]
}
@@ -617,6 +858,7 @@
"destination" : [ "obj-53", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 113.75, 358.5, 249.25, 358.5 ],
"source" : [ "obj-51", 0 ]
}
@@ -630,12 +872,23 @@
"source" : [ "obj-51", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-85", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 113.75, 362.0, 72.0, 362.0, 72.0, 495.0, 259.5, 495.0 ],
"source" : [ "obj-51", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-6", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 201.75, 423.5, 520.75, 423.5 ],
"source" : [ "obj-52", 0 ]
}
@@ -645,6 +898,7 @@
"destination" : [ "obj-6", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 235.75, 423.5, 546.75, 423.5 ],
"source" : [ "obj-53", 0 ]
}
@@ -681,6 +935,7 @@
"destination" : [ "obj-57", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 389.75, 358.5, 491.25, 358.5 ],
"source" : [ "obj-56", 0 ]
}
@@ -690,6 +945,7 @@
"destination" : [ "obj-58", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 389.75, 358.5, 525.25, 358.5 ],
"source" : [ "obj-56", 0 ]
}
@@ -702,12 +958,23 @@
"source" : [ "obj-56", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-88", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 389.75, 351.0, 349.0, 351.0, 349.0, 495.0, 389.75, 495.0 ],
"source" : [ "obj-56", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-6", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 477.75, 423.5, 520.75, 423.5 ],
"source" : [ "obj-57", 0 ]
}
@@ -717,6 +984,7 @@
"destination" : [ "obj-6", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 511.75, 423.5, 546.75, 423.5 ],
"source" : [ "obj-58", 0 ]
}
@@ -762,6 +1030,7 @@
"destination" : [ "obj-63", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 645.5, 358.5, 747.0, 358.5 ],
"source" : [ "obj-62", 0 ]
}
@@ -771,6 +1040,7 @@
"destination" : [ "obj-64", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 645.5, 358.5, 781.0, 358.5 ],
"source" : [ "obj-62", 0 ]
}
@@ -783,12 +1053,23 @@
"source" : [ "obj-62", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-89", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 645.5, 351.0, 602.0, 351.0, 602.0, 495.0, 645.5, 495.0 ],
"source" : [ "obj-62", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-6", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 733.5, 423.5, 520.75, 423.5 ],
"source" : [ "obj-63", 0 ]
}
@@ -798,6 +1079,7 @@
"destination" : [ "obj-6", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 767.5, 423.5, 546.75, 423.5 ],
"source" : [ "obj-64", 0 ]
}
@@ -843,6 +1125,7 @@
"destination" : [ "obj-69", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 898.5, 358.5, 1000.0, 358.5 ],
"source" : [ "obj-68", 0 ]
}
@@ -852,6 +1135,7 @@
"destination" : [ "obj-70", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 898.5, 358.5, 1034.0, 358.5 ],
"source" : [ "obj-68", 0 ]
}
@@ -864,12 +1148,23 @@
"source" : [ "obj-68", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-90", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 898.5, 351.0, 850.0, 351.0, 850.0, 495.0, 898.5, 495.0 ],
"source" : [ "obj-68", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-6", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 986.5, 423.5, 520.75, 423.5 ],
"source" : [ "obj-69", 0 ]
}
@@ -879,6 +1174,7 @@
"destination" : [ "obj-6", 1 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 1020.5, 423.5, 546.75, 423.5 ],
"source" : [ "obj-70", 0 ]
}
@@ -922,6 +1218,16 @@
"source" : [ "obj-71", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-82", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 201.75, 70.0, 520.75, 70.0 ],
"source" : [ "obj-71", 0 ]
}
}
, {
"patchline" : {
@@ -998,6 +1304,114 @@
"source" : [ "obj-80", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-91", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-82", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-110", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 259.5, 651.5, 286.0, 651.5 ],
"source" : [ "obj-83", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-83", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-85", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-83", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 389.75, 537.5, 259.5, 537.5 ],
"source" : [ "obj-88", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-83", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 645.5, 537.5, 259.5, 537.5 ],
"source" : [ "obj-89", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-83", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 898.5, 537.5, 259.5, 537.5 ],
"source" : [ "obj-90", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-103", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 520.75, 159.0, 342.0, 159.0, 342.0, 451.0, 108.5, 451.0 ],
"source" : [ "obj-91", 0 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-51", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 535.75, 159.0, 135.0, 159.0, 135.0, 321.0, 113.75, 321.0 ],
"source" : [ "obj-91", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-56", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 535.75, 252.0, 411.0, 252.0, 411.0, 321.0, 389.75, 321.0 ],
"source" : [ "obj-91", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-62", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 535.75, 252.0, 621.0, 252.0, 621.0, 324.0, 645.5, 324.0 ],
"source" : [ "obj-91", 1 ]
}
}
, {
"patchline" : {
"destination" : [ "obj-68", 0 ],
"disabled" : 0,
"hidden" : 0,
"midpoints" : [ 535.75, 159.0, 876.0, 159.0, 876.0, 324.0, 898.5, 324.0 ],
"source" : [ "obj-91", 1 ]
}
}
],
"dependency_cache" : [ ]
+1 -1
View File
@@ -42,7 +42,7 @@ class DaTestThread(BaseThread):
stimFolder='./da_stim/',
noiseFilepath="./matrix_test/behavioural_stim/stimulus/wav/noise/noise.wav",
noiseRMSFilepath="./matrix_test/behavioural_stim/stimulus/rms/noise_rms.npy",
red_coef="./matrix_test/short_concat_stim/out/reduction_coef.npy",
red_coef="./calibration/out/reduction_coefficients/da_red_coef.npy",
nTrials=2, socketio=None, participant=None, srt_50=None,
s_50=None):
+1 -1
View File
@@ -53,7 +53,7 @@ class EEGMatTrainThread(BaseThread):
stimFolder="./matrix_test/long_concat_stim/out/stim",
noiseFilepath="./matrix_test/behavioural_stim/stimulus/wav/noise/noise.wav",
noiseRMSFilepath="./matrix_test/behavioural_stim/stimulus/rms/noise_rms.npy",
red_coef="./matrix_test/short_concat_stim/out/reduction_coef.npy",
red_coef="./calibration/out/reduction_coefficients/mat_red_coef.npy",
socketio=None, participant=None, srt_50=None, s_50=None):
self.noise_path = noiseFilepath
self.noise_rms = np.load(noiseRMSFilepath)
+2 -2
View File
@@ -49,6 +49,7 @@ class EEGTestThread(BaseThread):
def __init__(self, sessionFilepath=None,
listFolder="./matrix_test/short_concat_stim/out",
noiseFilepath="./matrix_test/behavioural_stim/stimulus/wav/noise/noise.wav",
red_coef="./calibration/out/reduction_coefficients/mat_red_coef.npy",
socketio=None, participant=None, srt_50=None, s_50=None):
self.noise_path = noiseFilepath
self.listDir = listFolder
@@ -195,7 +196,6 @@ class EEGTestThread(BaseThread):
"running this test.")
# Estimate speech intelligibility thresholds using predicted
# psychometric function
reduction_coef = float(np.load(os.path.join(self.listDir, 'reduction_coef.npy')))
s_50 *= 0.01
x = logit(self.si * 0.01)
snrs = (x/(4*s_50))+srt_50
@@ -241,7 +241,7 @@ class EEGTestThread(BaseThread):
out_meta_path = os.path.join(save_dir, "Stim_{0}_{1}.npy".format(ind, ind2))
with np.errstate(divide='raise'):
try:
out_wav = (speech+(np.stack([noise, noise], axis=1)*snr_fs))*reduction_coef
out_wav = (speech+(np.stack([noise, noise], axis=1)*snr_fs))*self.reduction_coef
except:
set_trace()
#out_wav = np.concatenate([out_wav, triggers[:, np.newaxis]], axis=1)
+1 -1
View File
@@ -64,7 +64,7 @@ class MatTestThread(BaseThread):
noiseFilepath="./matrix_test/behavioural_stim/stimulus/wav/noise/noise.wav",
noiseRMSFilepath="./matrix_test/behavioural_stim/stimulus/rms/noise_rms.npy",
listFolder="./matrix_test/behavioural_stim/stimulus/wav/sentence-lists/",
red_coef="./matrix_test/short_concat_stim/out/reduction_coef.npy",
red_coef="./calibration/out/reduction_coefficients/mat_red_coef.npy",
socketio=None, participant=None):
self.listDir = listFolder