Mercurial > hg > nsaunier > traffic-intelligence
diff trafficintelligence/storage.py @ 1287:76f5693b530c
updated tests for numpy 2
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sat, 20 Jul 2024 20:35:21 -0400 |
| parents | 9562f5e8edf8 |
| children | 46a30ce1a2e4 |
line wrap: on
line diff
--- a/trafficintelligence/storage.py Wed Jul 17 12:28:01 2024 -0400 +++ b/trafficintelligence/storage.py Sat Jul 20 20:35:21 2024 -0400 @@ -7,7 +7,7 @@ from copy import copy import sqlite3, logging -from numpy import log, min as npmin, max as npmax, round as npround, array, sum as npsum, loadtxt, floor as npfloor, ceil as npceil, linalg, int32, int64, reshape, dot, vstack, transpose, ones, zeros_like, pi, NaN +from numpy import log, min as npmin, max as npmax, round as npround, array, sum as npsum, loadtxt, floor as npfloor, ceil as npceil, linalg, int32, int64, reshape, dot, vstack, transpose, ones, zeros_like, pi, nan from pandas import read_csv, merge, concat, DataFrame from trafficintelligence import utils, moving, events, indicators @@ -1359,7 +1359,7 @@ if len(tmp) != interval.length(): #interpolate print(objNum, len(tmp), interval.length()) instants = set(interval).difference(tmp.frame) - missing = concat([tmp[['frame']+header[10:]], DataFrame([[t]+[NaN]*(len(header)-10) for t in instants], columns = ['frame']+header[10:])], ignore_index=True).sort_values('frame') + missing = concat([tmp[['frame']+header[10:]], DataFrame([[t]+[nan]*(len(header)-10) for t in instants], columns = ['frame']+header[10:])], ignore_index=True).sort_values('frame') tmp = missing.interpolate() featureTrajectories = [moving.Trajectory() for i in range(4)] for i, r in tmp.iterrows(): @@ -1501,7 +1501,7 @@ if len(tmp) != interval.length(): #interpolate print(objNum, len(tmp), interval.length()) instants = set(interval).difference(tmp.frame) - missing = concat([tmp[['frame', 'x', 'y']], DataFrame([[t, NaN, NaN] for t in instants], columns = ['frame', 'x', 'y'])], ignore_index=True).sort_values('frame') + missing = concat([tmp[['frame', 'x', 'y']], DataFrame([[t, nan, nan] for t in instants], columns = ['frame', 'x', 'y'])], ignore_index=True).sort_values('frame') tmp = missing.interpolate() #print(tmp.info()) if interval.length()>1:
