Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

Commit 17ca35b1 authored by Ed Rogers's avatar Ed Rogers
Browse files

Add retest possibility

parent d3bfe5ae
......@@ -17,6 +17,7 @@ class HearingTest:
lower_lim = 0
n_blocks = 20
max_response_time = 1 # in seconds
untested_prob = 0.15
@staticmethod
def block_size():
......@@ -46,13 +47,21 @@ class HearingTest:
return
def play_next_sound(self):
# TODO allow tone outside lims with low prob?
choices = []
for i, freq in enumerate(self.freqs):
choices.extend([(freq, v) for v in
np.arange(self.lower_bounds[i]+self.block_size(),
self.upper_bounds[i],
self.block_size())])
if random.random() < self.untested_prob:
# completely random - allows a little retesting
for freq in self.freqs:
choices.extend([(freq, v) for v in
np.arange(self.lower_lim,
self.upper_lim,
self.block_size())])
else:
# only allow choices from untested parts
for i, freq in enumerate(self.freqs):
choices.extend([(freq, v) for v in
np.arange(self.lower_bounds[i]+self.block_size(),
self.upper_bounds[i],
self.block_size())])
freq, volume = random.choice(choices)
self.library.play(freq, volume)
played_time = time.time()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment