tvaLib
Functions | Variables
analysis Namespace Reference

Functions

def main ()
 main() More...
 

Variables

string version = 'R2.3.0 u. 2017-03-22'
 
 aIx = analyses.interpret(commands.analysis)[0]
 Start parsing cached data. More...
 
 s_analysis
 
 analysisFolder
 
list alignments = []
 Metrics engine. More...
 
list mhcs = []
 
list masks = []
 
list masks2 = []
 
list zones = []
 
list loops = []
 
list bounds = []
 
list homoCompletion = []
 
list trackCompletion = []
 
list trackOldestAge = []
 
list annotCompletion = []
 
list gtCompletion = []
 
list clCompletion = []
 
list serObjCompletion = []
 
list objMinversions = []
 
list objMaxversions = []
 
list listOfExistingUserTypes = [None]+[x for x in range(len(local['userTypeNames']))]
 
 meanSpeeds = tvaAnalysis.Measures(tvaAnalysis.MeanSpeed())
 General Metrics. More...
 
 inFlowPLPH = tvaAnalysis.Measures(tvaAnalysis.FlowRatePerLanePerHour())
 
 hourly_flows = tvaAnalysis.Measures(tvaAnalysis.MeasureByHour())
 
 hourly_speed = tvaAnalysis.Measures(tvaAnalysis.MeanSpeedByHour())
 
 vehKmTraveled = tvaAnalysis.Measures(tvaAnalysis.VehKmTraveled())
 
 predictionMethods = deepcopy(predictionMethods_master)
 Safety Metrics. More...
 
 agregationMethods = deepcopy(agregationMethods_master)
 
 thresholds = tvaLib.drange(0.25,2.0,0.25)
 
 completionBySeq
 For each prediction method... More...
 
 completion
 
 minVersion
 
 maxVersion
 
 userPairsPH
 
 userPairsWIndPH
 
 userPairsBH
 
 userPairsWIndBH
 
 interactionsPH
 
 meanTTC
 
 freqTTC
 
 countTTCThresh
 
 ttcExportFile = open(os.path.join(sites.getBaseDirectory(), config.output_folder, analysisFolder, 'TTC_export.csv'), 'wb')
 Prepare possible data export files. More...
 
 writer = csv_writer(ttcExportFile, delimiter=',', quotechar='"', quoting=csv_QUOTE_MINIMAL)
 Export data to CSV. More...
 
list headers = ['DBID', 'SITE_ID', 'CAM_ID', 'CAM_IX', 'ANALYSIS_IX', 'HOUR', 'TTC_VAL', 'TTC_PROB', 'MEAN_SPEED_PH', 'INFLOW_PH', 'INFLOW_PHPL', 'INTERINST_ANGLE', 'INTERINST_CLASS', 'PRED_METHOD','AGG_METHOD', 'OBJ1_NUM', 'OBJ2_NUM', 'OBJ1_TYPE', 'OBJ2_TYPE', 'MEAN_SPEED_OBJ1', 'MEAN_SPEED_OBJ2', 'INS_SPEED_OBJ1', 'INS_SPEED_OBJ2', 'FIVE_MINUTE_EXPOSURE', 'TWO_MINUTE_EXPOSURE', 'ONE_MINUTE_EXPOSURE', 'FIFTEEN_SECOND_EXPOSURE']
 Header. More...
 
 upsExportFile = open(os.path.join(sites.getBaseDirectory(), config.output_folder, analysisFolder, 'UPS_export.csv'), 'wb')
 Prepare UPS export. More...
 
dictionary runtime_figures = {}
 Generate runtime figures. More...
 
 None
 
 alpha
 
 local
 
 fig_name
 
 figsize
 
 verbose
 Error and exit handling. More...
 
 saIxs = site_analyses.interpret(commands.s_analysis)
 Search through data. More...
 
 prog
 
 siteIxs = tvaRuntime.targetSiteIxs(commands, sites, site_analyses[saIx])
 Check metadata completion. More...
 
 camIxs = tvaRuntime.targetCameraIxs(commands, sites[siteIx], site_analyses[saIx])
 Loop through cameras. More...
 
 fileIxs = tvaRuntime.targetSequenceIxs(commands, sites[siteIx][camIx], site_analyses[saIx])
 Loop through sequences. More...
 
 s_version = pickle.load(input_data)
 Look for object data. More...
 
 objects = pickle.load(input_data)
 Constrain trajectories to analysis zone. More...
 
 zone
 
 containment_threshold
 
 f_bb_containment_threshold
 
 max_outside_dist
 
 f_bb_max_outside_dist
 
 loopback_verification_frames
 
 f_bb_loopback_ver_frames
 
 indent
 Write user pair data. More...
 
 reportedAlignIdxs = tvaFilter.getReportedAlignIdxs(objects)
 
 speed_conv
 
 duration
 Attempt to repopulate objects, if necessary. More...
 
 location
 
 startTimes
 
 startTime
 
 framerate
 
string filename = predictionMethods[pmIx].label_short+'_'+sites[siteIx][camIx].name.replace('\\','').replace('/','')+'_'+sites[siteIx][camIx][fileIx].name+'.upairs'
 Look for interaction data. More...
 
 seq_userPairs = pickle.load(input_data)
 
 result = seq_userPairs.getPointList(userType1=utIx1, userType2=utIx2, ptype='CP', method=agregationMethod.method, percentile=agregationMethod.percentile, minimumProbability=config.col_probability_threshold, format='columns')
 Update meta data. More...
 
list writeData
 Write interaction data. More...
 
 obj1_index = tvaLib.Obj.num2ind(objects, point[5])
 Write user pair data. More...
 
 obj2_index = tvaLib.Obj.num2ind(objects, point[6])
 
 obj1_t_index = point[4]-objects[obj1_index].getFirstInstant()
 
 obj2_t_index = point[4]-objects[obj2_index].getFirstInstant()
 
 percentile
 Write exposure data. More...
 
 method = 1
 
list kstests = []
 Write. More...
 
int f = 0
 
dictionary kstests_ = {}
 
list ksVector = []
 
 ydata_ = None
 
 ydata = freqMeasure[obs2].getPDF()
 
list frequency = [x/float(sum(ydata_)) for x in ydata_]
 
list cdf = []
 
 label
 Print results. More...
 
 round_
 
 plotSettings = tvaVis.plotSettings(style=commands.fig_style, size=config.plot_text_size, family=config.font_family, verbose=commands.verbose)
 Visualisation. More...
 
 fig_lan_suffix
 
list figures = []
 Data sampling. More...
 
 fig_format
 Commit. More...
 
 fig_bg_colour
 
list figures_grid = []
 
dictionary labels = {}
 
list freqTTCdatas = []
 
list freqTTCklusters = []
 
 fig
 For each pair of existing userTypes... More...
 
 x_range
 
 mean
 
 freqTTCByAggMethod
 
 klusters
 
 dist_type
 
 distro_type
 
 timehorizon
 
 disp_timehorizon
 
 labelSampleSize
 
 labelTTCSampleSize
 
 results_TTC_X
 
int datasetIx = 0
 Data. More...
 
list data
 Start preparing stats for writing. More...
 
 exposure
 
 hli
 
 tvaHLI = importlib.import_module('hli.'+os.path.splitext(file_)[0])
 
 commands
 
 config
 
 site_analyses
 
 analyses
 
list kruskal_results = []
 Finish cluster loop EXACTLY here. More...
 
 kruskal_result = scipy_stats_kruskal(*[tvaLib.flatten_list(x[pmIx][amIx]) for x in cluster.results_sample_dump])
 
list kruskal_by_site = []
 
list cluster_lineStyles = ['-' for x in range(len(cluster))]
 Generate cluster figures. More...
 
list cluster_markers = ['' for x in range(len(cluster))]
 
list site_distros = []
 
 colours
 
list linestyles = [cluster_lineStyles[groupIx] for groupIx in range(len(cluster))]+tvaLib.flatten_list([[cluster_lineStyles[groupIx] for i in group] for groupIx,group in zip(range(len(cluster)),cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short])])
 
list markers = [cluster_markers[groupIx] for groupIx in range(len(cluster))]+tvaLib.flatten_list([[cluster_markers[groupIx] for i in group] for groupIx,group in zip(range(len(cluster)),cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short])])
 
list linewidths = [5 for groupIx in range(len(cluster))]+tvaLib.flatten_list([[1 for i in group] for group in cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short]])
 
list xs = [cluster.results_TTC_X for x in range(len(cluster)+len(site_distros))]
 
list ys = [[0 for z in range(len(xs))] if x==False else x for x in cluster.results_TTC_site_means[distro_type][agregationMethod.label_short][predictionMethod.label_short]+site_distros]
 
 debug
 
 e
 
 time
 
 logging
 
 force
 

Function Documentation

◆ main()

def analysis.main ( )

main()

Definition at line 14 of file analysis.py.

14 def main():
15  try:
16 
17 
18 
22  import sys, os, time, logging
23  from csv import writer as csv_writer
24  from csv import QUOTE_MINIMAL as csv_QUOTE_MINIMAL
25  from collections import OrderedDict
26  from site import addsitedir
27  from copy import deepcopy
28  from datetime import datetime
29  import cPickle as pickle
30  from warnings import filterwarnings
31  filterwarnings('ignore')
32 
33  #Add parent library
34  if(os.path.isfile(os.path.join(os.getcwd(), os.pardir, 'main.py'))):
35  addsitedir(os.path.join(os.getcwd(), os.pardir))
36  os.chdir(os.path.join(os.getcwd(), os.pardir))
37 
38  import include.config as tvaConfig
39  import include.local as tvaLocal
40 
41 
44  commands = tvaConfig.commands()
45  config = tvaConfig.Config(readonly=commands.configreadonly)
46 
47 
50  try: #Colorama, optional, required for Windows if coloured text is desired
51  from colorama import init as colorama_init
52  colorama_init(strip=False)
53  from colorama import Fore, Back, Style
54  except ImportError:
55  Fore = tvaConfig.Fore()
56  Back = tvaConfig.Back()
57  Style = tvaConfig.Style()
58  if(commands.logging or config.disable_colour):
59  config.disable_colour = True
60  Fore = tvaConfig.Fore(forceOff=True)
61  Back = tvaConfig.Back(forceOff=True)
62  Style = tvaConfig.Style(forceOff=True)
63 
64 
67  import include.runtime as tvaRuntime
68 
69 
72  if(not config.advanced_runtime): tvaRuntime.checkDependancies()
73 
74 
78  import matplotlib as mpl; mpl.use('Agg')
79  from scipy.stats import kruskal as scipy_stats_kruskal
80 
81 
86  if(not config.debug): oldstdout = sys.stdout;sys.stdout = tvaConfig.NullWriter()
87  try:
88  import lib.analysis as tvaAnalysis
89  import lib.filt as tvaFilter
90  import lib.scene as tvaScene
91  import lib.tools as tvaLib
92  import lib.vis as tvaVis
93  finally:
94  if(not config.debug): sys.stdout = oldstdout #Re-enable output
95 
96 
99  if(config.debug): logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-10s) %(message)s')
100 
101 
102 
105  if(commands.dir): config.dir = commands.dir
106  if(commands.dbn): config.dbn = commands.dbn
107  if(commands.language): config.language = commands.language
108  local = tvaLocal.Local(commands.language)
109  if(not commands.analysis): commands.analysis = 1
110  #Override module colour options
111  tvaLib.Fore = Fore;tvaLib.Back = Back;tvaLib.Style = Style
112  tvaRuntime.Fore = Fore;tvaRuntime.Back = Back;tvaRuntime.Style = Style
113 
114  sites = tvaScene.Sites(config)
115  site_analyses = tvaScene.SiteAnalyses(config, sites=sites)
116  analyses = tvaScene.Analyses(config)
117  cluster_specs = tvaScene.Clusters(config)
118 
119  if(commands.analysis): aIx = analyses.interpret(commands.analysis)[0]
120  else: aIx = 0
121  summaryFolderPrefix = 'SUMMARY'
122  clusterFolderPrefix = 'CLUSTER'
123  siteSummaryPrefix = 'site_summaries'
124  indDistPrefix = 'indicator_distributions'
125  minimumVersion = 'R2.2.0'
126  minimumVersionDepth = 3
127  freq_binsize = 0.25
128  labelTTCSampleSize = True
129  nklusters = 1 # no more than 6
130  per_site_sampling_size = 10000 # kruskal
131  intInsClassMethods_master = tvaConfig.InteractionClassificationMethods()
132  tvaVis.plotSettings(style=commands.fig_style, size=config.plot_text_size, family=config.font_family, verbose=commands.verbose)
133  config.version = tvaLib.Parse.versionFromHgCommit(version)
134  if(commands.depth >= 2):
135  distributionTypes = ['pdf','cdf']
136  predictionMethods_master = tvaConfig.PredictionMethods(verbose=commands.verbose, version=config.version)
137  agregationMethods_master = tvaConfig.AggMethods()
138  print('Running meta analysis version '+config.version+'.')
139 
140 
141 
144  if(commands.cluster):
145  if(commands.interactive): commands = tvaRuntime.interactiveClusterSelection(commands, config, cluster_specs, local)
146  csIxs = cluster_specs.interpret(commands.cluster)
147  else:
148  if(commands.interactive):
149  commands = tvaRuntime.interactiveAnalysisSelection(commands, config, analyses, local)
150  aIx = analyses.interpret(commands.analysis)[0]
151  csIxs = [None]
152  for csIx in csIxs:
153  #Cluster data containers
154  if(csIx is not None):
155  cluster = cluster_specs[csIx]
156  if(commands.depth >= 2):
157  cluster.results_sample_dump = [] #for kruskal
158  cluster.results_TTC_X = []
159  cluster.results_TTC_site_means = dict((distType, dict((agMethod.label_short, dict((pmMethod.label_short, []) for pmMethod in predictionMethods_master)) for agMethod in agregationMethods_master)) for distType in distributionTypes)
160  cluster.results_TTC_site = dict((distType, dict((agMethod.label_short, dict((pmMethod.label_short, []) for pmMethod in predictionMethods_master)) for agMethod in agregationMethods_master)) for distType in distributionTypes)
161  else: cluster = [None]
162 
163 
164 
167  for cIx in range(len(cluster)):
168  if(cluster[cIx] is None): print('Processing analysis '+analyses[aIx].name+' ...')
169  else:
170  if(not cluster.labels[cIx]): cluster.labels[cIx] = 'cl_'+str(cIx+1)
171  commands.analysis = str(cluster.analyses[cIx])
172  if(cluster.xref_dbname[cIx]):
173  sites = tvaScene.Sites(config, filename_overide=cluster.xref_dbname[cIx])
174  site_analyses = tvaScene.SiteAnalyses(config, filename_overide=cluster.xref_dbname[cIx], sites=sites)
175  analyses = tvaScene.Analyses(config, filename_overide=cluster.xref_dbname[cIx])
176  else:
177  sites = tvaScene.Sites(config)
178  site_analyses = tvaScene.SiteAnalyses(config, sites=sites)
179  analyses = tvaScene.Analyses(config)
180  print('Processing analysis cases for cluster '+str(cIx+1)+' using the cluster specification "'+cluster.name+'"...')
181  clusterFolder = clusterFolderPrefix+'_'+cluster.name
182  if(not os.path.isdir(os.path.join(sites.getBaseDirectory(), config.output_folder, clusterFolder))): os.makedirs(os.path.join(config.dir, config.output_folder, clusterFolder))
183 
def main()
main()
Definition: vis.py:1
Definition: filt.py:1

Variable Documentation

◆ agregationMethods

analysis.agregationMethods = deepcopy(agregationMethods_master)

Definition at line 235 of file analysis.py.

◆ aIx

analysis.aIx = analyses.interpret(commands.analysis)[0]

Start parsing cached data.

Setup

Definition at line 195 of file analysis.py.

◆ alignments

list analysis.alignments = []

Metrics engine.

Completion Metrics

Definition at line 205 of file analysis.py.

◆ alpha

analysis.alpha

Definition at line 277 of file analysis.py.

◆ analyses

analysis.analyses

Definition at line 1060 of file analysis.py.

◆ analysisFolder

analysis.analysisFolder

Definition at line 197 of file analysis.py.

◆ annotCompletion

list analysis.annotCompletion = []

Definition at line 215 of file analysis.py.

◆ bounds

list analysis.bounds = []

Definition at line 211 of file analysis.py.

◆ camIxs

analysis.camIxs = tvaRuntime.targetCameraIxs(commands, sites[siteIx], site_analyses[saIx])

Loop through cameras.

Definition at line 369 of file analysis.py.

◆ cdf

list analysis.cdf = []

Definition at line 656 of file analysis.py.

◆ clCompletion

list analysis.clCompletion = []

Definition at line 217 of file analysis.py.

◆ cluster_lineStyles

list analysis.cluster_lineStyles = ['-' for x in range(len(cluster))]

Generate cluster figures.

Definition at line 1113 of file analysis.py.

◆ cluster_markers

list analysis.cluster_markers = ['' for x in range(len(cluster))]

Definition at line 1114 of file analysis.py.

◆ colours

analysis.colours

Definition at line 1126 of file analysis.py.

◆ commands

analysis.commands

Definition at line 1060 of file analysis.py.

◆ completion

analysis.completion

Definition at line 241 of file analysis.py.

◆ completionBySeq

analysis.completionBySeq

For each prediction method...

Definition at line 240 of file analysis.py.

◆ config

analysis.config

Definition at line 1060 of file analysis.py.

◆ containment_threshold

analysis.containment_threshold

Definition at line 391 of file analysis.py.

◆ countTTCThresh

analysis.countTTCThresh

Definition at line 251 of file analysis.py.

◆ data

list analysis.data
Initial value:
1 = [site_analyses[saIx].name,
2  saIx+1,
3  site_analyses[saIx].site.description,
4  site_analyses[saIx].getSequenceCount(),
5  site_analyses[saIx].getStartTime(),
6  site_analyses[saIx].getDuration(),
7  int(alignments[datasetIx]),
8  int(mhcs[datasetIx]),
9  int(masks[datasetIx]),
10  int(masks2[datasetIx]),
11  int(zones[datasetIx]),
12  homoCompletion[datasetIx],
13  int(loops[datasetIx]),
14  int(bounds[datasetIx]),
15  round(trackCompletion[datasetIx], 2),
16  trackOldestAge[datasetIx].strftime('%Y-%m-%d %H:%M:%S') if trackOldestAge[datasetIx] is not None else '',
17  round(annotCompletion[datasetIx], 2),
18  round(gtCompletion[datasetIx], 2),
19  round(clCompletion[datasetIx], 2),
20  round(serObjCompletion[datasetIx], 2)]

Start preparing stats for writing.

Definition at line 852 of file analysis.py.

◆ datasetIx

int analysis.datasetIx = 0

Data.

Definition at line 849 of file analysis.py.

◆ debug

analysis.debug

Definition at line 1157 of file analysis.py.

◆ disp_timehorizon

analysis.disp_timehorizon

Definition at line 786 of file analysis.py.

◆ dist_type

analysis.dist_type

Definition at line 786 of file analysis.py.

◆ distro_type

analysis.distro_type

Definition at line 786 of file analysis.py.

◆ duration

analysis.duration

Attempt to repopulate objects, if necessary.

Update version ranges Safety Metrics

Definition at line 410 of file analysis.py.

◆ e

analysis.e

Definition at line 1160 of file analysis.py.

◆ exposure

analysis.exposure

Definition at line 879 of file analysis.py.

◆ f

int analysis.f = 0

Definition at line 635 of file analysis.py.

◆ f_bb_containment_threshold

analysis.f_bb_containment_threshold

Definition at line 391 of file analysis.py.

◆ f_bb_loopback_ver_frames

analysis.f_bb_loopback_ver_frames

Definition at line 391 of file analysis.py.

◆ f_bb_max_outside_dist

analysis.f_bb_max_outside_dist

Definition at line 391 of file analysis.py.

◆ fig

analysis.fig

For each pair of existing userTypes...

Generate human-readable label type For each prediction method... For each type of distribution... For each aggregation method...

Definition at line 786 of file analysis.py.

◆ fig_bg_colour

analysis.fig_bg_colour

Definition at line 730 of file analysis.py.

◆ fig_format

analysis.fig_format

Commit.

Compile grid view of CVL/NAD/CMP plots for comparison.

Commit

Definition at line 730 of file analysis.py.

◆ fig_lan_suffix

analysis.fig_lan_suffix

Definition at line 716 of file analysis.py.

◆ fig_name

analysis.fig_name

Definition at line 277 of file analysis.py.

◆ figsize

analysis.figsize

Definition at line 277 of file analysis.py.

◆ figures

list analysis.figures = []

Data sampling.

Indicator results.

Site summaries.

Definition at line 726 of file analysis.py.

◆ figures_grid

list analysis.figures_grid = []

Definition at line 754 of file analysis.py.

◆ fileIxs

analysis.fileIxs = tvaRuntime.targetSequenceIxs(commands, sites[siteIx][camIx], site_analyses[saIx])

Loop through sequences.

Definition at line 372 of file analysis.py.

◆ filename

string analysis.filename = predictionMethods[pmIx].label_short+'_'+sites[siteIx][camIx].name.replace('\\','').replace('/','')+'_'+sites[siteIx][camIx][fileIx].name+'.upairs'

Look for interaction data.

Definition at line 422 of file analysis.py.

◆ force

analysis.force

Definition at line 1160 of file analysis.py.

◆ framerate

analysis.framerate

Definition at line 411 of file analysis.py.

◆ freqTTC

analysis.freqTTC

Definition at line 250 of file analysis.py.

◆ freqTTCByAggMethod

analysis.freqTTCByAggMethod

Definition at line 786 of file analysis.py.

◆ freqTTCdatas

list analysis.freqTTCdatas = []

Definition at line 756 of file analysis.py.

◆ freqTTCklusters

list analysis.freqTTCklusters = []

Definition at line 757 of file analysis.py.

◆ frequency

list analysis.frequency = [x/float(sum(ydata_)) for x in ydata_]

Definition at line 655 of file analysis.py.

◆ gtCompletion

list analysis.gtCompletion = []

Definition at line 216 of file analysis.py.

◆ headers

list analysis.headers = ['DBID', 'SITE_ID', 'CAM_ID', 'CAM_IX', 'ANALYSIS_IX', 'HOUR', 'TTC_VAL', 'TTC_PROB', 'MEAN_SPEED_PH', 'INFLOW_PH', 'INFLOW_PHPL', 'INTERINST_ANGLE', 'INTERINST_CLASS', 'PRED_METHOD','AGG_METHOD', 'OBJ1_NUM', 'OBJ2_NUM', 'OBJ1_TYPE', 'OBJ2_TYPE', 'MEAN_SPEED_OBJ1', 'MEAN_SPEED_OBJ2', 'INS_SPEED_OBJ1', 'INS_SPEED_OBJ2', 'FIVE_MINUTE_EXPOSURE', 'TWO_MINUTE_EXPOSURE', 'ONE_MINUTE_EXPOSURE', 'FIFTEEN_SECOND_EXPOSURE']

Header.

Definition at line 263 of file analysis.py.

◆ hli

analysis.hli

Definition at line 1051 of file analysis.py.

◆ homoCompletion

list analysis.homoCompletion = []

Definition at line 212 of file analysis.py.

◆ hourly_flows

analysis.hourly_flows = tvaAnalysis.Measures(tvaAnalysis.MeasureByHour())

Definition at line 227 of file analysis.py.

◆ hourly_speed

analysis.hourly_speed = tvaAnalysis.Measures(tvaAnalysis.MeanSpeedByHour())

Definition at line 228 of file analysis.py.

◆ indent

analysis.indent

Write user pair data.

Definition at line 391 of file analysis.py.

◆ inFlowPLPH

analysis.inFlowPLPH = tvaAnalysis.Measures(tvaAnalysis.FlowRatePerLanePerHour())

Definition at line 226 of file analysis.py.

◆ interactionsPH

analysis.interactionsPH

Definition at line 248 of file analysis.py.

◆ klusters

analysis.klusters

Definition at line 786 of file analysis.py.

◆ kruskal_by_site

list analysis.kruskal_by_site = []

Definition at line 1089 of file analysis.py.

◆ kruskal_result

analysis.kruskal_result = scipy_stats_kruskal(*[tvaLib.flatten_list(x[pmIx][amIx]) for x in cluster.results_sample_dump])

Definition at line 1088 of file analysis.py.

◆ kruskal_results

list analysis.kruskal_results = []

Finish cluster loop EXACTLY here.

Cluster Analysis Generate cluster statistics Kruskal-Wallis H-test

Definition at line 1083 of file analysis.py.

◆ kstests

list analysis.kstests = []

Write.

Update runtime figures Close up data export files if open Generate statistics KS Test

Definition at line 634 of file analysis.py.

◆ kstests_

dictionary analysis.kstests_ = {}

Definition at line 637 of file analysis.py.

◆ ksVector

list analysis.ksVector = []

Definition at line 639 of file analysis.py.

◆ label

analysis.label

Print results.

Safety Metrics.

General Metrics

Definition at line 687 of file analysis.py.

◆ labels

dictionary analysis.labels = {}

Definition at line 755 of file analysis.py.

◆ labelSampleSize

analysis.labelSampleSize

Definition at line 786 of file analysis.py.

◆ labelTTCSampleSize

analysis.labelTTCSampleSize

Definition at line 786 of file analysis.py.

◆ linestyles

list analysis.linestyles = [cluster_lineStyles[groupIx] for groupIx in range(len(cluster))]+tvaLib.flatten_list([[cluster_lineStyles[groupIx] for i in group] for groupIx,group in zip(range(len(cluster)),cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short])])

Definition at line 1128 of file analysis.py.

◆ linewidths

list analysis.linewidths = [5 for groupIx in range(len(cluster))]+tvaLib.flatten_list([[1 for i in group] for group in cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short]])

Definition at line 1130 of file analysis.py.

◆ listOfExistingUserTypes

list analysis.listOfExistingUserTypes = [None]+[x for x in range(len(local['userTypeNames']))]

Definition at line 221 of file analysis.py.

◆ local

analysis.local

Definition at line 277 of file analysis.py.

◆ location

analysis.location

Definition at line 410 of file analysis.py.

◆ logging

analysis.logging

Definition at line 1160 of file analysis.py.

◆ loopback_verification_frames

analysis.loopback_verification_frames

Definition at line 391 of file analysis.py.

◆ loops

list analysis.loops = []

Definition at line 210 of file analysis.py.

◆ markers

list analysis.markers = [cluster_markers[groupIx] for groupIx in range(len(cluster))]+tvaLib.flatten_list([[cluster_markers[groupIx] for i in group] for groupIx,group in zip(range(len(cluster)),cluster.results_TTC_site[distro_type][agregationMethod.label_short][predictionMethod.label_short])])

Definition at line 1129 of file analysis.py.

◆ masks

list analysis.masks = []

Definition at line 207 of file analysis.py.

◆ masks2

list analysis.masks2 = []

Definition at line 208 of file analysis.py.

◆ max_outside_dist

analysis.max_outside_dist

Definition at line 391 of file analysis.py.

◆ maxVersion

analysis.maxVersion

Definition at line 243 of file analysis.py.

◆ mean

analysis.mean

Definition at line 786 of file analysis.py.

◆ meanSpeeds

analysis.meanSpeeds = tvaAnalysis.Measures(tvaAnalysis.MeanSpeed())

General Metrics.

Definition at line 225 of file analysis.py.

◆ meanTTC

analysis.meanTTC

Definition at line 249 of file analysis.py.

◆ method

int analysis.method = 1

Definition at line 590 of file analysis.py.

◆ mhcs

list analysis.mhcs = []

Definition at line 206 of file analysis.py.

◆ minVersion

analysis.minVersion

Definition at line 242 of file analysis.py.

◆ None

analysis.None

Definition at line 277 of file analysis.py.

◆ obj1_index

analysis.obj1_index = tvaLib.Obj.num2ind(objects, point[5])

Write user pair data.

Definition at line 530 of file analysis.py.

◆ obj1_t_index

analysis.obj1_t_index = point[4]-objects[obj1_index].getFirstInstant()

Definition at line 532 of file analysis.py.

◆ obj2_index

analysis.obj2_index = tvaLib.Obj.num2ind(objects, point[6])

Definition at line 531 of file analysis.py.

◆ obj2_t_index

analysis.obj2_t_index = point[4]-objects[obj2_index].getFirstInstant()

Definition at line 533 of file analysis.py.

◆ objects

analysis.objects = pickle.load(input_data)

Constrain trajectories to analysis zone.

Check that the data matches existing metadata records This won't guarantee that the data is up to date, it'll only prevent the program from crashing due to an alignment missmatch.

Update version ranges General Metrics

Definition at line 384 of file analysis.py.

◆ objMaxversions

list analysis.objMaxversions = []

Definition at line 220 of file analysis.py.

◆ objMinversions

list analysis.objMinversions = []

Definition at line 219 of file analysis.py.

◆ percentile

analysis.percentile

Write exposure data.

Write misc data

Definition at line 589 of file analysis.py.

◆ plotSettings

analysis.plotSettings = tvaVis.plotSettings(style=commands.fig_style, size=config.plot_text_size, family=config.font_family, verbose=commands.verbose)

Visualisation.

Note: this section is continued from runtime figure generation above Set plotting style

Definition at line 715 of file analysis.py.

◆ predictionMethods

analysis.predictionMethods = deepcopy(predictionMethods_master)

Safety Metrics.

Definition at line 234 of file analysis.py.

◆ prog

analysis.prog

Definition at line 289 of file analysis.py.

◆ reportedAlignIdxs

analysis.reportedAlignIdxs = tvaFilter.getReportedAlignIdxs(objects)

Definition at line 392 of file analysis.py.

◆ result

analysis.result = seq_userPairs.getPointList(userType1=utIx1, userType2=utIx2, ptype='CP', method=agregationMethod.method, percentile=agregationMethod.percentile, minimumProbability=config.col_probability_threshold, format='columns')

Update meta data.

Prepare measures for kruskal-wallis test.

Update TTC data

Definition at line 476 of file analysis.py.

◆ results_TTC_X

analysis.results_TTC_X

Definition at line 790 of file analysis.py.

◆ round_

analysis.round_

Definition at line 687 of file analysis.py.

◆ runtime_figures

dictionary analysis.runtime_figures = {}

Generate runtime figures.

Definition at line 275 of file analysis.py.

◆ s_analysis

analysis.s_analysis

Definition at line 196 of file analysis.py.

◆ s_version

analysis.s_version = pickle.load(input_data)

Look for object data.

Definition at line 381 of file analysis.py.

◆ saIxs

analysis.saIxs = site_analyses.interpret(commands.s_analysis)

Search through data.

Loop through site-analyses

Definition at line 288 of file analysis.py.

◆ seq_userPairs

analysis.seq_userPairs = pickle.load(input_data)

Definition at line 431 of file analysis.py.

◆ serObjCompletion

list analysis.serObjCompletion = []

Definition at line 218 of file analysis.py.

◆ site_analyses

analysis.site_analyses

Definition at line 1060 of file analysis.py.

◆ site_distros

list analysis.site_distros = []

Definition at line 1123 of file analysis.py.

◆ siteIxs

analysis.siteIxs = tvaRuntime.targetSiteIxs(commands, sites, site_analyses[saIx])

Check metadata completion.

Tracking completion Data Purge empty files created erroneosly General Metrics Safety Metrics Loop through sites

Definition at line 366 of file analysis.py.

◆ speed_conv

analysis.speed_conv

Definition at line 409 of file analysis.py.

◆ startTime

analysis.startTime

Definition at line 411 of file analysis.py.

◆ startTimes

analysis.startTimes

Definition at line 411 of file analysis.py.

◆ thresholds

analysis.thresholds = tvaLib.drange(0.25,2.0,0.25)

Definition at line 236 of file analysis.py.

◆ time

analysis.time

Definition at line 1160 of file analysis.py.

◆ timehorizon

analysis.timehorizon

Definition at line 786 of file analysis.py.

◆ trackCompletion

list analysis.trackCompletion = []

Definition at line 213 of file analysis.py.

◆ trackOldestAge

list analysis.trackOldestAge = []

Definition at line 214 of file analysis.py.

◆ ttcExportFile

analysis.ttcExportFile = open(os.path.join(sites.getBaseDirectory(), config.output_folder, analysisFolder, 'TTC_export.csv'), 'wb')

Prepare possible data export files.

Prepare TTC export

Definition at line 261 of file analysis.py.

◆ tvaHLI

analysis.tvaHLI = importlib.import_module('hli.'+os.path.splitext(file_)[0])

Definition at line 1058 of file analysis.py.

◆ upsExportFile

analysis.upsExportFile = open(os.path.join(sites.getBaseDirectory(), config.output_folder, analysisFolder, 'UPS_export.csv'), 'wb')

Prepare UPS export.

Definition at line 266 of file analysis.py.

◆ userPairsBH

analysis.userPairsBH

Definition at line 246 of file analysis.py.

◆ userPairsPH

analysis.userPairsPH

Definition at line 244 of file analysis.py.

◆ userPairsWIndBH

analysis.userPairsWIndBH

Definition at line 247 of file analysis.py.

◆ userPairsWIndPH

analysis.userPairsWIndPH

Definition at line 245 of file analysis.py.

◆ vehKmTraveled

analysis.vehKmTraveled = tvaAnalysis.Measures(tvaAnalysis.VehKmTraveled())

Definition at line 229 of file analysis.py.

◆ verbose

analysis.verbose

Error and exit handling.

User interruption Normal program exit Raised error handling or uncaught exception handling with PDB traceback

Definition at line 277 of file analysis.py.

◆ version

string analysis.version = 'R2.3.0 u. 2017-03-22'

Definition at line 5 of file analysis.py.

◆ writeData

list analysis.writeData
Initial value:
1 = [sites[siteIx].description, #DBID
2  sites[siteIx].idx, #SITE_ID
3  sites[siteIx][camIx].idx, #CAM_ID
4  camIx+1, #CAM_IX
5  saIx+1, #ANALYSIS_IX
6  sites[siteIx][camIx][fileIx].getHour(), #HOUR
7  point[0]/float(sites[siteIx][camIx].camera.frameRate), #TTC_VAL
8  point[3], #TTC_PROB
9  hourly_speed[-1].getCurve(type='mean')[sites[siteIx][camIx][fileIx].getHour()], #MEAN_SPEED_PH
10  hourly_flows[-1].getCurve()[sites[siteIx][camIx][fileIx].getHour()], #INFLOW_PH
11  hourly_flows[-1].getCurve(divideByValueVariety=True)[sites[siteIx][camIx][fileIx].getHour()]]

Write interaction data.

Definition at line 511 of file analysis.py.

◆ writer

analysis.writer = csv_writer(ttcExportFile, delimiter=',', quotechar='"', quoting=csv_QUOTE_MINIMAL)

Export data to CSV.

Generate Indicator Thresholds.

Generate Hourly Report.

Data Export (CSV)

Write exposure data.

Export TTC data 'DBID', 'SITE_ID', 'CAM_ID', 'CAM_IX', 'ANALYSIS_IX', 'HOUR', 'TTC_VAL', 'TTC_PROB', 'MEAN_SPEED_PH', 'INFLOW_PH', 'INFLOW_PHPL', 'INTERINST_ANGLE', 'INTERINST_CLASS', 'PRED_METHOD','AGG_METHOD', 'OBJ1_NUM', 'OBJ2_NUM', 'OBJ1_TYPE', 'OBJ2_TYPE', 'MEAN_SPEED_OBJ1', 'MEAN_SPEED_OBJ2', 'INS_SPEED_OBJ1', 'INS_SPEED_OBJ2', 'FIVE_MINUTE_EXPOSURE', 'TWO_MINUTE_EXPOSURE', 'ONE_MINUTE_EXPOSURE', 'FIFTEEN_SECOND_EXPOSURE'

Write Export UPS data 'DBID', 'SITE_ID', 'CAM_ID', 'CAM_IX', 'ANALYSIS_IX', 'HOUR', 'MEAN_SPEED_PH', 'INFLOW_PH', 'INFLOW_PHPL', 'PRED_METHOD', 'OBJ1_NUM', 'OBJ2_NUM', 'MEAN_SPEED_OBJ1', 'MEAN_SPEED_OBJ2', 'FIVE_MINUTE_EXPOSURE', 'TWO_MINUTE_EXPOSURE', 'ONE_MINUTE_EXPOSURE', 'FIFTEEN_SECOND_EXPOSURE', 'MEDIAN_INT_ANGLE', 'TTC_VAL_MEDIAN', 'TTC_PROB_MEDIAN'

Generate Report

Definition at line 262 of file analysis.py.

◆ x_range

analysis.x_range

Definition at line 786 of file analysis.py.

◆ xs

list analysis.xs = [cluster.results_TTC_X for x in range(len(cluster)+len(site_distros))]

Definition at line 1131 of file analysis.py.

◆ ydata

analysis.ydata = freqMeasure[obs2].getPDF()

Definition at line 645 of file analysis.py.

◆ ydata_

analysis.ydata_ = None

Definition at line 642 of file analysis.py.

◆ ys

list analysis.ys = [[0 for z in range(len(xs))] if x==False else x for x in cluster.results_TTC_site_means[distro_type][agregationMethod.label_short][predictionMethod.label_short]+site_distros]

Definition at line 1132 of file analysis.py.

◆ zone

analysis.zone

Definition at line 391 of file analysis.py.

◆ zones

list analysis.zones = []

Definition at line 209 of file analysis.py.