comparison python/tests/storage.txt @ 927:c030f735c594

added assignment of trajectories to prototypes and cleanup of insert queries
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 11 Jul 2017 17:56:23 -0400
parents 3a06007a4bb7
children 933670761a57
comparison
equal deleted inserted replaced
926:dbd81710d515 927:c030f735c594
4 4
5 >>> f = openCheck('non_existant_file.txt') 5 >>> f = openCheck('non_existant_file.txt')
6 File non_existant_file.txt could not be opened. 6 File non_existant_file.txt could not be opened.
7 7
8 >>> nonexistentFilename = "nonexistent" 8 >>> nonexistentFilename = "nonexistent"
9 >>> loadPrototypeMatchIndexesFromSqlite(nonexistentFilename)
10 DB Error: no such table: prototypes
11 []
12 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature') 9 >>> loadTrajectoriesFromSqlite(nonexistentFilename, 'feature')
13 DB Error: no such table: positions 10 DB Error: no such table: positions
14 DB Error: no such table: velocities 11 DB Error: no such table: velocities
15 [] 12 []
16 >>> from os import remove 13 >>> from os import remove
120 >>> nPoints = 50 117 >>> nPoints = 50
121 >>> points = random_sample(nPoints*2).reshape(nPoints,2) 118 >>> points = random_sample(nPoints*2).reshape(nPoints,2)
122 >>> gmm = GaussianMixture(4, covariance_type = 'full') 119 >>> gmm = GaussianMixture(4, covariance_type = 'full')
123 >>> tmp = gmm.fit(points) 120 >>> tmp = gmm.fit(points)
124 >>> gmmId = 0 121 >>> gmmId = 0
125 >>> savePOIs('pois-tmp.sqlite', gmm, 'end', gmmId) 122 >>> savePOIsToSqlite('pois-tmp.sqlite', gmm, 'end', gmmId)
126 >>> reloadedGmm = loadPOIs('pois-tmp.sqlite') 123 >>> reloadedGmm = loadPOIsFromSqlite('pois-tmp.sqlite')
127 >>> sum(gmm.predict(points) == reloadedGmm[gmmId].predict(points)) == nPoints 124 >>> sum(gmm.predict(points) == reloadedGmm[gmmId].predict(points)) == nPoints
128 True 125 True
129 >>> reloadedGmm[gmmId].gmmTypes[0] == 'end' 126 >>> reloadedGmm[gmmId].gmmTypes[0] == 'end'
130 True 127 True
131 >>> remove('pois-tmp.sqlite') 128 >>> remove('pois-tmp.sqlite')