/usr/share/pyshared/pypsignifit/__init__.py is in python-pypsignifit 3.0~beta.20120611.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
######################################################################
#
# See COPYING file distributed along with the psignifit package for
# the copyright and license terms
#
######################################################################
""" Psychometric analysis of psychophysics data in Python.
Full documentation available at: http://psignifit.sourceforge.net/
Getting Help
------------
All main classes are documented using docstrings. In ipython you can acces them
using the '?' operator:
>>> import pypsignifit as psi
>>> psi.BayesInference?
[...]
>>> psi.BootstrapInference?
[...]
Inference Classes
-----------------
* ASIRInference
* BayesInference
* BootstrapInference
Diagnostic Classes
------------------
* ConvergenceMCMC
* GoodnessOfFit
* ParameterPlot
* ThresholdPlot
Subpackages
-----------
* psignidata
* psignierrors
* psigniplot
* psignipriors
"""
__docformat__ = "restructuredtext"
import sys
import subprocess
# This is the interface to psi++
import swignifit as interface
# This is "real" psignifit
from psignidata import *
from psigniplot import *
# Methods to set default priors
import psignipriors
# This is to enable display of graphics
from pylab import show
try:
from __version__ import version
except ImportError:
__version__ = 'Fatal: no version found!'
interface.set_seed( 0 )
def set_seed(value):
interface.set_seed(value)
def dump_info():
"""
Print some basic system info.
NOTE: This will be extended to a more sophisticated scheme.
"""
print("psignifit version: \t" + version)
print("python version: \t" + sys.version)
def __test__ ( ):
"If we call the file directly, we perform a test run"
import numpy as N
import pylab as p
import sys
if len(sys.argv) == 1 or sys.argv[1] == "bootstrap":
bootstrap = True
elif sys.argv[1] == "bayes":
bootstrap = False
x = [float(2*k) for k in xrange(6)]
k = [34,32,40,48,50,48]
n = [50]*6
d = [[xx,kk,nn] for xx,kk,nn in zip(x,k,n)]
d = N.array(zip(x,k,n))
priors = ("flat","flat","Uniform(0,0.1)")
if bootstrap:
b = BootstrapInference ( d, sample=2000, priors=priors )
GoodnessOfFit(b)
ParameterPlot(b)
else:
priors = ("Gauss(0,4)","Gamma(1,3)","Beta(2,30)")
mcmc = BayesInference ( d, sigmoid="cauchy", priors=priors )
mcmc.sample(start=(6,4,.3))
mcmc.sample(start=(1,1,.1))
print "Posterior Intervals",mcmc.getCI()
print "Model Evidence", mcmc.evidence
print "Rhat (m):",mcmc.Rhat ()
print "Nsamples:",mcmc.nsamples
print "DIC:",mcmc.DIC
print "pD:", mcmc.pD
GoodnessOfFit(mcmc)
for prm in xrange(3):
ConvergenceMCMC ( mcmc, parameter=prm )
print mcmc
p.show()
if __name__ == "__main__":
__test__()
|