Exemplo n.º 1
0
import os
import json
from mypy.datautil import datadir

SUBJPATH = "%s/exp-mturk/predutil-v1" % datadir()

SUBJECTS = [0]

COSTOBS = 0.2
COSTERR = 0.4


def topairs(n, ncells):
    """Convert from linear index to coordinate"""
    a = int(n / int(ncells))
    b = n - a * ncells
    return (a, b)


def toindex(pair, ncells):
    (a, b) = pair
    return int((a % ncells) * ncells + b)


class Subject:
    def __init__(self, id):

        self.id = id
        self.datafile = "%s/%s.txt" % (SUBJPATH, id)

        if os.path.exists(self.datafile):
Exemplo n.º 2
0
Arquivo: v4.py Projeto: dmarkant/mypy
#!/usr/bin/python2.7
"""
Some general functions for loading data from Battleship experiment

September, 2011
"""
import os
from mypy.datautil import datadir
from numpy import *

BASEDIR = "%s/exp/battleship-v4" % datadir()

#------------------------------ 
# LOAD DATA
#------------------------------ 
def setdatadir(dir):
    global BASEDIR
    BASEDIR = dir

def loaddata(subj=None):
    p = "%s/%s.dat" % (BASEDIR, subj)
    if os.path.exists(p):
        print "loading data from", p
        fp = open(p, "r")
        data = fp.readlines()
        fp.close()
        return data
    else:
        print "no data file found"

# THIS IS NOT RIGHT #
Exemplo n.º 3
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from MTurk Battleship experiment

March, 2012
"""
import os
from mypy.datautil import datadir
from numpy import *

BASEDIR = "%s/exp-mturk/shift-prior-v1.2" % datadir()

N_BLOCKS = 2
N_GAMES_PER_BLOCK = 12
BIASTYPES = ["unbiased","long","thin","sameshape"]

BIASBLOCK = {
             641: [0, 3], # done
             642: [2, 0], # done
             644: [2, 0], # done
             648: [1, 0], # done
             649: [0, 1], # done
             651: [0, 1], # done
             652: [2, 0], # done
             655: [2, 0], # done
             657: [0, 2], # done
             662: [0, 3], # done
             663: [1, 0], # done
             664: [3, 0], # done
             665: [0, 2], # done
             666: [0, 3], # done
Exemplo n.º 4
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from MTurk Battleship experiment

October, 2012
"""
import os
from mypy.datautil import datadir
from numpy import *

BASEDIR = "%s/exp-mturk/sparsity-v1" % datadir()

SUBJECTS = [28, 30, 31, 32, 33, 34, 35, 36, 37, 38]

DATA = {}
GAMEDATA = {}

N_GAMES = 32
N_TRIALS_PER_GAME = 4
N_BLOCKS = 2

MAX_RADIUS = 200.

RADII = [0.414125584817,
         0.585662018574,
         0.754983443527,
         0.894427191]

#------------------------------ 
# LOAD DATA
#------------------------------ 
Exemplo n.º 5
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from MTurk Battleship experiment

March, 2012
"""
import os
from mypy.datautil import datadir
from numpy import *
from pandas import *

BASEDIR = "%s/exp-mturk/single-shape-quota-v0" % datadir()

HSPACE_NAMES = [ "A", "K", "N", "V", "U", "M", "C", "P" ];

HSPACE_CB = [[0,1],
             [1,0],
             [2,3],
             [3,2],
             [4,5],
             [5,4],
             [6,7],
             [7,6]
                 ];

def hspace_file(letter): return "../exp/templates/hspace_%s_9x9.csv" % letter

N_CELLS = 81
N_BLOCKS = 1
N_GAMES_PER_BLOCK = 40 
Exemplo n.º 6
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from Rocks experiment

September, 2011
"""
import os
from mypy.datautil import datadir
from numpy import *

BASEDIR = "%s/exp/rocks-v1" % datadir()

#------------------------------ 
# LOAD DATA
#------------------------------ 
def setdatadir(dir):
    global BASEDIR
    BASEDIR = dir

def loaddata(subj=None):
    p = "%s/%s.dat" % (BASEDIR, subj)
    if os.path.exists(p):
        print "loading data from", p
        fp = open(p, "r")
        data = fp.readlines()
        fp.close()
        return data
    else:
        print "no data file found"

def loadgameboard(subj=None, game=None):
Exemplo n.º 7
0
def setdatadir(expversion):
    global BASEDIR
    BASEDIR = "%s/exp/ternary-v%s" % (datadir(), expversion)
Exemplo n.º 8
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from Ternary Antenna Learning experiments

December, 2011
"""
from mypy.datautil import datadir

BASEDIR = "%s/exp/ternary-v5.1" % datadir()

def setdatadir(expversion):
    global BASEDIR
    BASEDIR = "%s/exp/ternary-v%s" % (datadir(), expversion)

def loadsamples(subj=None):
    if subj==None:
        return None
    else:
        fp = open("%s/%s.dat" % ( BASEDIR, subj ), "r")
        data = fp.readlines()
        fp.close()

        obs = []
        for line in data:
            l = line.split(' ')
            if l[0]==str(subj) and l[1]=='1':
                obs.append( map(int, [l[2], l[3], l[7]]) )

        return obs
Exemplo n.º 9
0
import os
import json
from mypy.datautil import datadir

SUBJPATH = '%s/exp-mturk/infounc-v2' % datadir()

SUBJECTS = [0, 1, 2, 3, 4]

COSTERR = 2

def topairs(n, ncells):
    """Convert from linear index to coordinate"""
    a = int(n/int(ncells))
    b = n - a*ncells
    return (a,b)

def toindex(pair, ncells):
    (a,b)=pair
    return int((a%ncells)*ncells + b)


class Subject:

    def __init__(self, id):

        self.id = id
        self.datafile = '%s/%s.json' % (SUBJPATH, id)

        if os.path.exists(self.datafile):
            with open(self.datafile,'r') as fp:
                self.data = json.load(fp)
Exemplo n.º 10
0
#!/usr/bin/python2.7
"""
Some general functions for loading data from MTurk Battleship experiment

March, 2012
"""
import os
from mypy.datautil import datadir
from numpy import *
from pandas import *

BASEDIR = "%s/exp-mturk/single-shape-v1" % datadir()

SUBJECTS = [55, 56, 57, 58, 59, 63, 64, 65, 68, 69, 71, 72, 75, 76]

HSPACE_NAMES = [ "A", "K", "N", "V", "U", "M", "C", "P" ];

def hspace_file(letter): return "../exp/templates/hspace_%s_9x9.csv" % letter

N_CELLS = 81
N_BLOCKS = 1
N_GAMES_PER_BLOCK = 40 

#------------------------------ 
# LOAD DATA
#------------------------------ 
def setdatadir(dir):
    global BASEDIR
    BASEDIR = dir

def loaddata(subj=None):