Skip to content

Commit

Permalink
Clarify which gamma values correspond to which lapse
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Jul 2, 2024
1 parent fb8fe34 commit 7335497
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@
"# actual parameters of the observer\n",
"bias = -10.\n",
"threshold = 20.\n",
"gamma1 = .2\n",
"gamma2 = 0.\n",
"gamma1 = .2 # lapse rate at low (-ve) stimulus values\n",
"gamma2 = 0. # lapse rate at high (+ve) stimulus values\n",
"\n",
"# fake experimental data given those parameters\n",
"pp = psy.erf_psycho_2gammas((bias, threshold, gamma1, gamma2), xx)\n",
Expand All @@ -216,7 +216,7 @@
"}\n",
"\n",
"# data: \n",
"# 3 x n matrix where first row corrsponds to stim levels (% contrast), \n",
"# 3 x n matrix where first row corresponds to stim levels (% contrast), \n",
"# the second to number of trials for each stim level (int),\n",
"# the third to proportion rightward (float between 0 and 1)\n",
"data = np.vstack((xx, ntrials * np.ones((nxx,)), np.mean(dd, axis=0)))\n",
Expand Down
7 changes: 5 additions & 2 deletions psychofit.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def neg_likelihood(pars, data, P_model='weibull', parmin=None, parmax=None):
Args:
pars: Model parameters [threshold, slope, gamma], or if
using the 'erf_psycho_2gammas' model append a second gamma value.
using the 'erf_psycho_2gammas' model append a second gamma value (i.e. lapse high).
data: 3 x n matrix where first row corresponds to stim levels,
the second to number of trials for each stim level (int),
the third to proportion correct / proportion rightward (float between 0 and 1)
Expand Down Expand Up @@ -292,8 +292,11 @@ def erf_psycho_2gammas(pars, xx):
"""
erf function from 0 to 1, with two lapse rates.
gamma1 cooresponds to 'lapse low', i.e. the lapse rate at low (-ve) stimulus values;
gamma2 cooresponds to 'lapse high'.
Args:
pars: Model parameters [bias, slope, gamma].
pars: Model parameters [bias, slope, gamma1, gamma2].
xx: vector of stim levels (%)
Returns:
Expand Down

0 comments on commit 7335497

Please sign in to comment.