Mercurial > hg > nsaunier > traffic-intelligence
comparison scripts/process.py @ 1062:a2e20aba0740
bug correctiong
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 12 Jul 2018 00:22:16 -0400 |
| parents | 671426ce0f3e |
| children | 3c37d8d20e97 |
comparison
equal
deleted
inserted
replaced
| 1061:671426ce0f3e | 1062:a2e20aba0740 |
|---|---|
| 212 if args.analyze == 'object': | 212 if args.analyze == 'object': |
| 213 # user speeds, accelerations | 213 # user speeds, accelerations |
| 214 # aggregation per site | 214 # aggregation per site |
| 215 data = [] # list of observation per site-user with time | 215 data = [] # list of observation per site-user with time |
| 216 headers = ['site', 'date', 'time', 'user_type'] | 216 headers = ['site', 'date', 'time', 'user_type'] |
| 217 aggFunctions, tmpheaders = utils.aggregationMethods(arg.aggMethods, args.aggCentiles) | 217 aggFunctions, tmpheaders = utils.aggregationMethods(args.aggMethods, args.aggCentiles) |
| 218 headers.extend(tmpheaders) | 218 headers.extend(tmpheaders) |
| 219 for vs in videoSequences: | 219 for vs in videoSequences: |
| 220 d = vs.startTime.date() | 220 d = vs.startTime.date() |
| 221 t1 = vs.startTime.time() | 221 t1 = vs.startTime.time() |
| 222 minUserDuration = args.minUserDuration*vs.cameraView.cameraType.frameRate | 222 minUserDuration = args.minUserDuration*vs.cameraView.cameraType.frameRate |
| 274 plt.boxplot(tmp, labels = [session.query(Site).get(siteId).name for siteId in indicators]) | 274 plt.boxplot(tmp, labels = [session.query(Site).get(siteId).name for siteId in indicators]) |
| 275 plt.ylabel(events.Interaction.indicatorNames[i]+' ('+events.Interaction.indicatorUnits[i]+')') | 275 plt.ylabel(events.Interaction.indicatorNames[i]+' ('+events.Interaction.indicatorUnits[i]+')') |
| 276 plt.savefig(events.Interaction.indicatorNames[i]+'.png', dpi=150) | 276 plt.savefig(events.Interaction.indicatorNames[i]+'.png', dpi=150) |
| 277 plt.close() | 277 plt.close() |
| 278 | 278 |
| 279 if args.analyze == 'event': # aggregate event data by 15 min interval (arg.intervalDuration), count events with thresholds | 279 if args.analyze == 'event': # aggregate event data by 15 min interval (args.intervalDuration), count events with thresholds |
| 280 data = pd.read_csv(args.eventFilename, parse_dates = [2]) | 280 data = pd.read_csv(args.eventFilename, parse_dates = [2]) |
| 281 #data = pd.read_csv('./speeds.csv', converters = {'time': lambda s: datetime.datetime.strptime(s, "%H:%M:%S").time()}, nrows = 5000) | 281 #data = pd.read_csv('./speeds.csv', converters = {'time': lambda s: datetime.datetime.strptime(s, "%H:%M:%S").time()}, nrows = 5000) |
| 282 # create time for end of each 15 min, then group by, using the agg method for each data column | 282 # create time for end of each 15 min, then group by, using the agg method for each data column |
| 283 headers = ['site', 'date', 'intervalend15', 'duration', 'count'] | 283 headers = ['site', 'date', 'intervalend15', 'duration', 'count'] |
| 284 aggFunctions, tmpheaders = utils.aggregationMethods(args.aggMethods, args.aggCentiles) | 284 aggFunctions, tmpheaders = utils.aggregationMethods(args.aggMethods, args.aggCentiles) |
