Skip to content

Commit

Permalink
Merge pull request #491 from int-brain-lab/hotfix/2.13.5
Browse files Browse the repository at this point in the history
Hotfix/2.13.5
  • Loading branch information
oliche authored Jul 28, 2022
2 parents aa5bec6 + 296753e commit a519f9e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions brainbox/task/closed_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def generate_pseudo_stimuli(n_trials, contrast_set=[0, 0.06, 0.12, 0.25, 1], fir
return p_left, contrast_left, contrast_right


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

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

if generate_choices:
Expand Down
15 changes: 13 additions & 2 deletions brainbox/tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,19 @@ def test_generate_pseudo_stimuli(self):

def test_generate_pseudo_session(self):
test_trials = self.test_trials
pseudo_trials = task.generate_pseudo_session(test_trials)
self.assertTrue(pseudo_trials.shape[0] == test_trials.shape[0])
c = np.zeros(9)
np.random.seed(456)
for m in np.arange(10):
pseudo_trials = task.generate_pseudo_session(test_trials, generate_choices=False, contrast_distribution='biased')
c += pseudo_trials.groupby("signed_contrast")['signed_contrast'].count().values / pseudo_trials.shape[0]
self.assertTrue(np.all(np.round(c * 2) / 2 == 1))
c = np.zeros(9)
np.random.seed(456)
for m in np.arange(10):
pseudo_trials = task.generate_pseudo_session(test_trials, generate_choices=False,
contrast_distribution='uniform')
c += pseudo_trials.groupby("signed_contrast")['signed_contrast'].count().values / pseudo_trials.shape[0]
self.assertTrue(np.all(np.round(c * 2) / 2 == np.array([1., 1., 1., 1., 2., 1., 1., 1., 1.])))

def test_get_impostor_target(self):
# labels between 3 and 14
Expand Down
2 changes: 1 addition & 1 deletion ibllib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.13.4"
__version__ = "2.13.5"
import warnings

from ibllib.misc import logger_config
Expand Down
3 changes: 3 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Release Notes 2.13
## Release Notes 2.13.4 2022-07-27
- Hotfix: pseudo session biased generation contrast distribution

## Release Notes 2.13.4 2022-07-22
- Hotfix: Density displays had unexisting colormaps in snapshots QC tasks
- Generate extra training plots based on psychometric curves
Expand Down

0 comments on commit a519f9e

Please sign in to comment.