Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/storage.py @ 1187:25c85a7ecf09
merged
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Tue, 21 Jun 2022 17:06:21 -0400 |
| parents | 0e5d37b0b9ff |
| children | ccab20f85710 |
comparison
equal
deleted
inserted
replaced
| 1186:7117a31555c1 | 1187:25c85a7ecf09 |
|---|---|
| 324 cursor.execute(queryStatement) | 324 cursor.execute(queryStatement) |
| 325 obj.features = loadTrajectoriesFromSqlite(filename, 'feature', [row[0] for i,row in enumerate(cursor) if i<nLongestFeaturesPerObject], timeStep = timeStep) | 325 obj.features = loadTrajectoriesFromSqlite(filename, 'feature', [row[0] for i,row in enumerate(cursor) if i<nLongestFeaturesPerObject], timeStep = timeStep) |
| 326 | 326 |
| 327 except sqlite3.OperationalError as error: | 327 except sqlite3.OperationalError as error: |
| 328 printDBError(error) | 328 printDBError(error) |
| 329 else: | |
| 330 print('Impossible to load from non-existing file '+filename) | |
| 329 return objects | 331 return objects |
| 330 | 332 |
| 331 def loadObjectFeatureFrameNumbers(filename, objectNumbers = None): | 333 def loadObjectFeatureFrameNumbers(filename, objectNumbers = None): |
| 332 'Loads the feature frame numbers for each object' | 334 'Loads the feature frame numbers for each object' |
| 333 with sqlite3.connect(filename) as connection: | 335 with sqlite3.connect(filename) as connection: |
| 538 interactions[-1].indicators = {} | 540 interactions[-1].indicators = {} |
| 539 if indicatorTypeNum != row[5] or row[0] != interactionNum: | 541 if indicatorTypeNum != row[5] or row[0] != interactionNum: |
| 540 indicatorTypeNum = row[5] | 542 indicatorTypeNum = row[5] |
| 541 indicatorName = events.Interaction.indicatorNames[indicatorTypeNum] | 543 indicatorName = events.Interaction.indicatorNames[indicatorTypeNum] |
| 542 indicatorValues = {row[6]:row[7]} | 544 indicatorValues = {row[6]:row[7]} |
| 543 interactions[-1].indicators[indicatorName] = indicators.SeverityIndicator(indicatorName, indicatorValues, mostSevereIsMax = not indicatorName in events.Interaction.timeIndicators) | 545 interactions[-1].indicators[indicatorName] = indicators.SeverityIndicator(indicatorName, indicatorValues, mostSevereIsMax = not indicatorName in events.Interaction.mostSevereIsMinIndicators) |
| 544 else: | 546 else: |
| 545 indicatorValues[row[6]] = row[7] | 547 indicatorValues[row[6]] = row[7] |
| 546 interactions[-1].indicators[indicatorName].timeInterval.last = row[6] | 548 interactions[-1].indicators[indicatorName].timeInterval.last = row[6] |
| 547 except sqlite3.OperationalError as error: | 549 except sqlite3.OperationalError as error: |
| 548 printDBError(error) | 550 printDBError(error) |
