Skip to content

Commit a519f9e

Browse files
authored
Merge pull request #491 from int-brain-lab/hotfix/2.13.5
Hotfix/2.13.5
2 parents aa5bec6 + 296753e commit a519f9e

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

brainbox/task/closed_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def generate_pseudo_stimuli(n_trials, contrast_set=[0, 0.06, 0.12, 0.25, 1], fir
388388
return p_left, contrast_left, contrast_right
389389

390390

391-
def generate_pseudo_session(trials, generate_choices=True):
391+
def generate_pseudo_session(trials, generate_choices=True, contrast_distribution='biased'):
392392
"""
393393
Generate a complete pseudo session with biased blocks, all stimulus contrasts, choices and
394394
rewards and omissions. Biased blocks and stimulus contrasts are generated using the same
@@ -426,7 +426,7 @@ def generate_pseudo_session(trials, generate_choices=True):
426426

427427
# Draw position and contrast for this trial
428428
position = _draw_position([-1, 1], pseudo_trials['probabilityLeft'][i])
429-
contrast = _draw_contrast(contrast_set, 'uniform')
429+
contrast = _draw_contrast(contrast_set, prob_type=contrast_distribution, idx=np.where(contrast_set == 0)[0][0])
430430
signed_stim = contrast * np.sign(position)
431431

432432
if generate_choices:

brainbox/tests/test_task.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,19 @@ def test_generate_pseudo_stimuli(self):
105105

106106
def test_generate_pseudo_session(self):
107107
test_trials = self.test_trials
108-
pseudo_trials = task.generate_pseudo_session(test_trials)
109-
self.assertTrue(pseudo_trials.shape[0] == test_trials.shape[0])
108+
c = np.zeros(9)
109+
np.random.seed(456)
110+
for m in np.arange(10):
111+
pseudo_trials = task.generate_pseudo_session(test_trials, generate_choices=False, contrast_distribution='biased')
112+
c += pseudo_trials.groupby("signed_contrast")['signed_contrast'].count().values / pseudo_trials.shape[0]
113+
self.assertTrue(np.all(np.round(c * 2) / 2 == 1))
114+
c = np.zeros(9)
115+
np.random.seed(456)
116+
for m in np.arange(10):
117+
pseudo_trials = task.generate_pseudo_session(test_trials, generate_choices=False,
118+
contrast_distribution='uniform')
119+
c += pseudo_trials.groupby("signed_contrast")['signed_contrast'].count().values / pseudo_trials.shape[0]
120+
self.assertTrue(np.all(np.round(c * 2) / 2 == np.array([1., 1., 1., 1., 2., 1., 1., 1., 1.])))
110121

111122
def test_get_impostor_target(self):
112123
# labels between 3 and 14

ibllib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.13.4"
1+
__version__ = "2.13.5"
22
import warnings
33

44
from ibllib.misc import logger_config

release_notes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Release Notes 2.13
2+
## Release Notes 2.13.4 2022-07-27
3+
- Hotfix: pseudo session biased generation contrast distribution
4+
25
## Release Notes 2.13.4 2022-07-22
36
- Hotfix: Density displays had unexisting colormaps in snapshots QC tasks
47
- Generate extra training plots based on psychometric curves

0 commit comments

Comments
 (0)