Пример #1
0
    def goodtest(self):
        """This Test should NOT raise Errors"""
        testcount = 0
        errorcount = 0

        # Some value table tests    
        for n in [2,12]:
            testcount += 1
            try: 
                e = ExperimentFile(self.dbdestination,n)

                values = []
                for i in range(2):
                    values += [[i] + [0] * n]
                e.store_values(0, values)
                e.store_values(1, values)
                     
                result = e.load_values(0)
                if result != [(0.0,) + n * (0.0,),
                              (1.0,) + n * (0.0,)]:
                    if self.debug: 
                            print "res: %s" % result
                            print "res: %s" % [(0.0,) + n * (0.0,), (1.0,) + n * (0.0,)]
                    raise Exception("library malfunction 0")
                allresults = e.load_values(0)
                allresults += e.load_values(1)
                testresults = [(0.0,) + n * (0.0,),
                               (1.0,) + n * (0.0,),
                               (0.0,) + n * (0.0,),
                               (1.0,) + n * (0.0,)]
                if self.debug: print "testresults: %s" % testresults
                if allresults != testresults:
                    if self.debug: print "allresults:  %s" % allresults
                    raise Exception("library malfunction 1")
                e.close()

            except Exception, e: 
                errorcount += 1
                if self.debug: self.errbuffer += str(e) + "\n"

            if self.dbdestination != ":memory:": os.unlink(self.dbdestination)
Пример #2
0
vn = 3 # Number of y-values (e.g. v1, v2, v3 -> vn = 3)

# create an instance of an experiment or a series of experiments
e = ExperimentFile(dbdestination,vn) 

print "\nValues: "

# store your values here: Must look like this:
# [[ t, v1 , v2, v3 ]] or [( t, v1 , v2, v3 )]
# [[type(double), type(double), ...., ....]]
# or [(type(double), type(double), ...., ....)]
values = [[0.0, 23.0, 42.0, 13.37], [0.0, 42.1, 23.01, 73.31]]

# store your values of experiment 1
e.store_values(1, values)

# store your values of experiment 2
e.store_values(2, values)

# get only results from experiment 1
result = e.load_values(1)

print "\nresult exp1:\n" + str(result)

# get results from all experiment series
allresults = e.load_values()

print "\nall results:\n" + str(allresults)

Пример #3
0
import os
import utils
from data_import import CSVImporter
from data_access import ExperimentFile
    
path = 'examples' + os.sep
#filename = 'Abklingkonstante.csv'       
filename = 'Motorkalibrierung.csv'     
#filename = 'Eigenfrequenz (Chaos2).csv' 

uri = path + filename
data = CSVImporter(uri)

e = ExperimentFile(':memory:', data.rowsize - 1)
#e = ExperimentFile('abklingkonstante.sqlite')
#e = ExperimentFile('motorkalibrierung.sqlite',2)
#e = ExperimentFile('eigenfrequenz_chaos2.sqlite')
e.store_values(1, data.values)
e.store_metadata(data.metadata)

print "imported vals:"
print data.values
print "imported meta:"
print data.metadata
print "stored vals:"
print e.load_values()
print "stored meta:"
print e.load_metadata()

e.close()