from xdapy import Mapper, Connection, Entity connection = Connection.profile("demo") connection.create_tables() m = Mapper(connection) from objects import Experiment, Observer, Trial, Session m.register(Experiment, Observer, Trial, Session) o1 = Observer(name="A") o2 = Observer(name="B") e1 = Experiment(project="E1", experimenter="X1") e2 = Experiment(project="E2", experimenter="X1") e3 = Experiment(project="E3") t1 = Trial(count=1) t2 = Trial(count=2) t3 = Trial(count=3) t4 = Trial(count=4) s1_1 = Session(count=1) s1_2 = Session(count=1) s2_1 = Session(count=1) s2_2 = Session(count=1) s3_1 = Session(count=1) s4_1 = Session(count=1) m.save(o1, o2, e1, e2, e3, t1, t2, t3, t4, s1_1, s1_2, s2_1, s2_2, s3_1, s4_1)
# -*- coding: utf-8 -*- from xml.etree import ElementTree as ET from xdapy.utils.decorators import autoappend from xdapy.io import XmlIO from xdapy import Connection, Mapper, Entity connection = Connection.profile("demo") # use standard profile # connection = Connection(dbname="xdapy") # drop the old database structure connection.create_tables() m = Mapper(connection) objects = [] @autoappend(objects) class Trial(Entity): declared_params = { "count": "string", "phase_of_signal_in_first_interval": "string", "reaction_time": "string", "noise_seed": "string", "phase_of_signal_in_second_interval": "string", "signal_interval": "string", "note": "string", "start": "string",
from xdapy import Mapper, Connection, Entity class E(Entity): declared_params = {} connection = Connection.profile("demo")#, echo=True) # use standard profile connection.create_tables()#overwrite=True) m = Mapper(connection) m.register(E) f = open("10M.dat") #f = open("100M.dat") #f = open("1G.dat") e = E() m.save(e) import pdb e.data["100M"].mimetype = "a" e.data["100M"].put("f") print e.data["100M"].get_string() #e.data["100M"].put(f) print e.data["100M"].mimetype print "CHUNKS" print e.data["100M"].chunks() print e.data["100M"].chunk_ids()