Fixed bug with EEG matrix training backup
This commit is contained in:
@@ -66,16 +66,18 @@ class ClickTestThread(BaseThread):
|
|||||||
self.waitForPageLoad()
|
self.waitForPageLoad()
|
||||||
self.socketio.emit('test_ready', namespace='/main')
|
self.socketio.emit('test_ready', namespace='/main')
|
||||||
for self.trial_ind in range(self.trial_ind, self.nTrials):
|
for self.trial_ind in range(self.trial_ind, self.nTrials):
|
||||||
|
self.saveState(out=self.backupFilepath)
|
||||||
self.displayInstructions()
|
self.displayInstructions()
|
||||||
self.waitForPartReady()
|
self.waitForPartReady()
|
||||||
if self._stopevent.isSet() or self.finishTest:
|
if self._stopevent.isSet() or self.finishTest:
|
||||||
break
|
break
|
||||||
# Play concatenated matrix sentences at set SNR
|
# Play concatenated matrix sentences at set SNR
|
||||||
self.playStimulusWav(self.wav_file)
|
self.playStimulusWav(self.wav_file)
|
||||||
self.saveState(out=self.backupFilepath)
|
self.saveState(out=self.backupFilepath)
|
||||||
if not self._stopevent.isSet():
|
if not self._stopevent.isSet():
|
||||||
self.unsetPageLoaded()
|
self.unsetPageLoaded()
|
||||||
self.socketio.emit('processing-complete', namespace='/main')
|
self.socketio.emit('processing-complete', namespace='/main')
|
||||||
|
self.waitForPageLoad()
|
||||||
self.waitForFinalise()
|
self.waitForFinalise()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-17
@@ -67,7 +67,7 @@ class DaTestThread(BaseThread):
|
|||||||
socketio=socketio,
|
socketio=socketio,
|
||||||
participant=participant)
|
participant=participant)
|
||||||
|
|
||||||
self.toSave = ['trial_ind', 'nTrials', 'wav_file', 'test_name', 'si']
|
self.toSave = ['stim_paths', 'trial_ind', 'nTrials', 'wav_file', 'test_name', 'si']
|
||||||
|
|
||||||
self.socketio.on_event('finalise_results', self.finaliseResults, namespace='/main')
|
self.socketio.on_event('finalise_results', self.finaliseResults, namespace='/main')
|
||||||
|
|
||||||
@@ -80,39 +80,28 @@ class DaTestThread(BaseThread):
|
|||||||
'''
|
'''
|
||||||
self.waitForPageLoad()
|
self.waitForPageLoad()
|
||||||
self.socketio.emit('test_ready', namespace='/main')
|
self.socketio.emit('test_ready', namespace='/main')
|
||||||
|
set_trace()
|
||||||
for wav in self.stim_paths[self.trial_ind:]:
|
for wav in self.stim_paths[self.trial_ind:]:
|
||||||
|
self.saveState(out=self.backupFilepath)
|
||||||
self.displayInstructions()
|
self.displayInstructions()
|
||||||
self.waitForPartReady()
|
self.waitForPartReady()
|
||||||
if self._stopevent.isSet() or self.finishTest:
|
if self._stopevent.isSet() or self.finishTest:
|
||||||
break
|
break
|
||||||
# Play concatenated matrix sentences at set SNR
|
# Play concatenated matrix sentences at set SNR
|
||||||
self.playStimulus(wav)
|
self.playStimulusWav(wav)
|
||||||
|
self.trial_ind += 1
|
||||||
self.saveState(out=self.backupFilepath)
|
self.saveState(out=self.backupFilepath)
|
||||||
if not self._stopevent.isSet():
|
if not self._stopevent.isSet():
|
||||||
self.unsetPageLoaded()
|
self.unsetPageLoaded()
|
||||||
self.socketio.emit('processing-complete', namespace='/main')
|
self.socketio.emit('processing-complete', namespace='/main')
|
||||||
self.waitForPageLoad()
|
self.waitForPageLoad()
|
||||||
|
self.waitForFinalise()
|
||||||
|
|
||||||
|
|
||||||
def displayInstructions(self):
|
def displayInstructions(self):
|
||||||
self.socketio.emit('display_instructions', namespace='/main')
|
self.socketio.emit('display_instructions', namespace='/main')
|
||||||
|
|
||||||
|
|
||||||
def playStimulus(self, wav_file, replay=False):
|
|
||||||
self.newResp = False
|
|
||||||
self.socketio.emit("stim_playing", namespace="/main")
|
|
||||||
# if not replay:
|
|
||||||
# self.y = self.generateTrial(self.snr)
|
|
||||||
# Play audio
|
|
||||||
# sd.play(self.y, self.fs, blocking=True)
|
|
||||||
if not self.dev_mode:
|
|
||||||
self.play_wav(wav_file, 'finish_test')
|
|
||||||
else:
|
|
||||||
self.play_wav('./test.wav', 'finish_test')
|
|
||||||
|
|
||||||
self.socketio.emit("stim_done", namespace="/main")
|
|
||||||
|
|
||||||
|
|
||||||
def loadStimulus(self):
|
def loadStimulus(self):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ class EEGMatTrainThread(BaseThread):
|
|||||||
)
|
)
|
||||||
# For each stimulus
|
# For each stimulus
|
||||||
trials = list(zip(self.stim_paths, self.question))[self.trial_ind:]
|
trials = list(zip(self.stim_paths, self.question))[self.trial_ind:]
|
||||||
set_trace()
|
|
||||||
for (wav, q) in trials:
|
for (wav, q) in trials:
|
||||||
|
self.saveState(out=self.backupFilepath)
|
||||||
self.displayInstructions()
|
self.displayInstructions()
|
||||||
self.waitForPartReady()
|
self.waitForPartReady()
|
||||||
if self._stopevent.isSet() or self.finishTest:
|
if self._stopevent.isSet() or self.finishTest:
|
||||||
@@ -174,12 +174,12 @@ class EEGMatTrainThread(BaseThread):
|
|||||||
self.playStimulus(wav)
|
self.playStimulus(wav)
|
||||||
self.setMatrix(q)
|
self.setMatrix(q)
|
||||||
self.saveState(out=self.backupFilepath)
|
self.saveState(out=self.backupFilepath)
|
||||||
self.finaliseResults()
|
|
||||||
if not self._stopevent.isSet():
|
if not self._stopevent.isSet():
|
||||||
self.unsetPageLoaded()
|
self.unsetPageLoaded()
|
||||||
self.socketio.emit('processing-complete', namespace='/main')
|
self.socketio.emit('processing-complete', namespace='/main')
|
||||||
self.waitForPageLoad()
|
self.waitForPageLoad()
|
||||||
self.fillTable()
|
self.fillTable()
|
||||||
|
self.waitForFinalise()
|
||||||
|
|
||||||
def displayInstructions(self):
|
def displayInstructions(self):
|
||||||
self.socketio.emit(
|
self.socketio.emit(
|
||||||
@@ -192,7 +192,7 @@ class EEGMatTrainThread(BaseThread):
|
|||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
symb = [[symb_dict[x], symb_dict[y]] for x, y in self.answers if not np.isnan([x, y]).any()]
|
symb = [[symb_dict[x], symb_dict[y]] for x, y in self.answers if not np.isnan([x, y]).any()]
|
||||||
self.socketio.emit('test_fill_table', {'data': symb}, namespace='/main')
|
self.socketio.emit('eeg_test_fill_table', {'data': symb}, namespace='/main')
|
||||||
|
|
||||||
|
|
||||||
def setMatrix(self, questions):
|
def setMatrix(self, questions):
|
||||||
|
|||||||
@@ -63,11 +63,11 @@
|
|||||||
waitingDialog.hide();
|
waitingDialog.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('stim_playing', function(msg) {
|
socket.on('da_test_stim_playing', function(msg) {
|
||||||
on()
|
on()
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('stim_done', function(msg) {
|
socket.on('da_test_stim_done', function(msg) {
|
||||||
off()
|
off()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
// Check if matrix stimulus is currently being processed
|
// Check if matrix stimulus is currently being processed
|
||||||
waitingDialog.show('Generating stimulus');
|
waitingDialog.show('Generating stimulus');
|
||||||
|
|
||||||
socket.on('test_fill_table', function(msg) {
|
socket.on('eeg_test_fill_table', function(msg) {
|
||||||
for(i = 0; i < msg['data'].length; i++) {
|
for(i = 0; i < msg['data'].length; i++) {
|
||||||
for(j = 0; j < msg['data'][i].length; j++) {
|
for(j = 0; j < msg['data'][i].length; j++) {
|
||||||
$(`#Q${j+1} > .T${i+1}`).text(String.fromCharCode(msg['data'][i][j]));
|
$(`#Q${j+1} > .T${i+1}`).text(String.fromCharCode(msg['data'][i][j]));
|
||||||
|
|||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends 'participant_index.html' %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h1>Test complete!</h1>
|
||||||
|
<p>Please wait for the experimenter to give further instructions...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends 'participant_index.html' %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h1>Test complete!</h1>
|
||||||
|
<p>Please wait for the experimenter to give further instructions...</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
{% extends 'index.html' %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="card">
|
||||||
|
<div id="main-div" class="card-body">
|
||||||
|
<h3>You will need:</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Hand gel</li>
|
||||||
|
<li>PTA form</li>
|
||||||
|
<li>Otoscope</li>
|
||||||
|
<li>Otoscope tips</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>Procedure:</h3>
|
||||||
|
<ol>
|
||||||
|
<li>Perform otoscopy, checking in particular for redness or bulging
|
||||||
|
tympanic membrane</li>
|
||||||
|
<li>Questions to ask:
|
||||||
|
<ul>
|
||||||
|
<li>Has the participant experienced discomfort, pain or discharge
|
||||||
|
in either ear?</li>
|
||||||
|
<li>Are they currently being
|
||||||
|
treated for any ear-related problems</li>
|
||||||
|
<li>Have they previously had surgery involving the ears</li>
|
||||||
|
<li>Have they been exposed to any loud noises in the last 24 hours?</li>
|
||||||
|
<li>Do they experience tinnitus?</li>
|
||||||
|
<li>Do they hear better from a particular ear? (start with that one)</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Explain and demonstrate procedure
|
||||||
|
<ul>
|
||||||
|
<li>"I will insert a probe into the opening of your ear
|
||||||
|
canal. The probe has a soft tip to seal the ear. You
|
||||||
|
will feel some pressure in your ear for a few seconds
|
||||||
|
while I measure the function of your middle ear. This
|
||||||
|
test is automatic and I do not require you to do
|
||||||
|
anything, but please avoid any unnecessary movement and
|
||||||
|
avoid speaking or swallowing after the probe has been
|
||||||
|
inserted. Should you find the procedure painful and
|
||||||
|
want me to stop, please indicate this by either saying
|
||||||
|
"stop" or by raising your hand."</li>
|
||||||
|
<li>Tones may be heard in either ear</li>
|
||||||
|
<li>Instruct participant to report any discomfort or
|
||||||
|
pain experienced during the examination</li>
|
||||||
|
<li>If needed the test can be stopped at any time</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Perform air coduction procedure
|
||||||
|
<ul>
|
||||||
|
<li>Freq. order: 1000, 2000, 4000, 8000, 500, 250, 1000 (again)</li>
|
||||||
|
<li>Decrease by 10dB until no response, increase by 5 dB until response</li>
|
||||||
|
<li>When subject responds to 2/3, 3/4 (>50%), take this as the threshold</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Perform bone coduction procedure
|
||||||
|
<ul>
|
||||||
|
<li>Place bone conductor over the worse ear (based on AC results)</li>
|
||||||
|
<li>Occlude test ear with headphones</li>
|
||||||
|
<li>Freq. order: 1000, 2000, 4000, 500</li>
|
||||||
|
<li>Decrease by 10dB until no response, increase by 5 dB until response</li>
|
||||||
|
<li>When subject responds to 2/3, 3/4 (>50%), take this as the threshold</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
<div>
|
||||||
|
<img src=""
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
{% extends 'index.html' %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="card">
|
||||||
|
<div id="main-div" class="card-body">
|
||||||
|
<h3>You will need:</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Hand gel</li>
|
||||||
|
<li>Typanometer</li>
|
||||||
|
<li>Otoscope</li>
|
||||||
|
<li>Otoscope tips</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3>Procedure:</h3>
|
||||||
|
<ol>
|
||||||
|
<li>Questions to ask:
|
||||||
|
<ul>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Explain and demonstrate procedure
|
||||||
|
<ul>
|
||||||
|
<li> "I am going to test your hearing by measuring the
|
||||||
|
quietest sounds that you can hear. As soon as you hear
|
||||||
|
a sound (tone), press the button. Keep it pressed for
|
||||||
|
as long as you hear the sound (tone), no matter which
|
||||||
|
ear you hear it in. Release the button as soon as you
|
||||||
|
no longer hear the sound (tone). Whatever the sound,
|
||||||
|
and no matter how faint the sound, press the button as
|
||||||
|
soon as you think you hear it, and release it as soon
|
||||||
|
as you think it stops."</li>
|
||||||
|
<li>Tones may be heard in either ear</li>
|
||||||
|
<li>Instruct participant to report any discomfort or
|
||||||
|
pain experienced during the examination</li>
|
||||||
|
<li>If needed the test can be stopped at any time</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Perform procedure
|
||||||
|
<ul>
|
||||||
|
<li>Freq. order: 1000, 2000, 4000, 8000, 500, 250, 1000 (again)</li>
|
||||||
|
<li>Decrease by 10dB until no response, increase by 5 dB until response</li>
|
||||||
|
<li>When subject responds to 2/3, 3/4 (>50%), take this as the threshold</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@@ -153,9 +153,6 @@ class BaseThread(Thread):
|
|||||||
Wait for results to be finalised by socketio handler
|
Wait for results to be finalised by socketio handler
|
||||||
'''
|
'''
|
||||||
while not self.finalised and not self._stopevent.isSet() and not self.finishTest:
|
while not self.finalised and not self._stopevent.isSet() and not self.finishTest:
|
||||||
print("self.finalised {}".format(self.finalised))
|
|
||||||
print("self.finishTest {}".format(self.finishTest))
|
|
||||||
print("self._stopevent {}".format(self._stopevent))
|
|
||||||
self._stopevent.wait(0.2)
|
self._stopevent.wait(0.2)
|
||||||
self.socketio.emit("test_finished", namespace='/main')
|
self.socketio.emit("test_finished", namespace='/main')
|
||||||
return
|
return
|
||||||
@@ -262,7 +259,6 @@ class BaseThread(Thread):
|
|||||||
previously generated pickle file
|
previously generated pickle file
|
||||||
'''
|
'''
|
||||||
filepath = msg['data']
|
filepath = msg['data']
|
||||||
set_trace()
|
|
||||||
self.loadState(filepath)
|
self.loadState(filepath)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user