fontspecs = {"horizontalalignment": "center", "verticalalignment": "center"} fig.text(.05, .47, r"logistic", rotation=90, **fontspecs) fig.text(.1, .47, r"$f(x)=\frac{1}{1+\exp(-x)}$", rotation=90, **fontspecs) fig.text(.05, .2, r"exponential", rotation=90, **fontspecs) fig.text(.1, .2, r"$f(x)=1-\exp(-x)$", rotation=90, **fontspecs) fig.text(.6, .95, r"ab", **fontspecs) fig.text(.6, .9, r"$g(x,a,b)=\frac{x-a}{b}$", **fontspecs) fig.text(.85, .95, r"poly", **fontspecs) fig.text(.85, .9, r"$g(x,a,b)=(\frac{x}{a})^b$", **fontspecs) axes_ab = [ax_ab, ax_logist, ax_logistab, ax_lgumbel, ax_gumbelab] axes_wei = [ax_weibull, ax_logistweib, ax_gumbelweib] abcore = sft.abCore() weicore = sft.polyCore(sft.PsiData([1, 2, 3], [2, 2, 2], [2, 2, 2], 2)) logistic = sft.PsiLogistic() gumbel = sft.PsiExponential() x = p.mgrid[-7:7:1000j] ax_logist.plot(x, [logistic.f(xx) for xx in x], color="k") ax_lgumbel.plot(x, [gumbel.f(xx) for xx in x], color="k") prm = [(1, 2, .02), (2, 2, .02), (1, 1, .02), (2, 1, .02)] col = ['b', 'r', 'g', 'c'] for pr, c in zip(prm, col): dab = [abcore.g(xx, pr) for xx in x] ax_ab.plot(x, dab, color=c)
def test_memory_management(self): core = sfr.abCore() sigmoid = sfr.PsiLogistic() psi = sfr.PsiPsychometric(2,core,sigmoid)
def generate_test_model(): # IMPORTANT: here we can use the fact that PsiPsychometic manages its # own memory, and we don't need to hang on to th sigmoid, core, and # prior. return sfr.PsiPsychometric(2, sfr.abCore(), sfr.PsiLogistic())
fontspecs = {"horizontalalignment": "center", "verticalalignment": "center"} fig.text ( .05, .47, r"logistic", rotation=90, **fontspecs) fig.text ( .1, .47, r"$f(x)=\frac{1}{1+\exp(-x)}$", rotation=90, **fontspecs ) fig.text ( .05, .2, r"exponential", rotation=90, **fontspecs) fig.text ( .1, .2, r"$f(x)=1-\exp(-x)$", rotation=90, **fontspecs ) fig.text ( .6, .95, r"ab", **fontspecs ) fig.text ( .6, .9, r"$g(x,a,b)=\frac{x-a}{b}$", **fontspecs ) fig.text ( .85, .95, r"poly", **fontspecs ) fig.text ( .85, .9, r"$g(x,a,b)=(\frac{x}{a})^b$", **fontspecs ) axes_ab = [ax_ab,ax_logist,ax_logistab,ax_lgumbel,ax_gumbelab] axes_wei = [ax_weibull,ax_logistweib,ax_gumbelweib] abcore = sft.abCore ( ) weicore = sft.polyCore ( sft.PsiData ( [1,2,3],[2,2,2],[2,2,2],2) ) logistic = sft.PsiLogistic () gumbel = sft.PsiExponential () x = p.mgrid[-7:7:1000j] ax_logist.plot ( x, [logistic.f(xx) for xx in x] , color="k") ax_lgumbel.plot ( x, [gumbel.f(xx) for xx in x] , color="k") prm = [(1,2,.02),(2,2,.02),(1,1,.02),(2,1,.02)] col = ['b','r','g','c'] for pr,c in zip(prm,col): dab = [abcore.g ( xx, pr ) for xx in x] ax_ab.plot ( x, dab, color=c )