tvaLib
Public Member Functions | Public Attributes | List of all members
lib.vis.SpeedHistograms Class Reference
Inheritance diagram for lib.vis.SpeedHistograms:
lib.vis.basicPlot

Public Member Functions

def __init__ (self, alpha=1, kwargs)
 
def addHistogram (self, objects, fps)
 
def setAxes (self)
 
def get (self)
 
- Public Member Functions inherited from lib.vis.basicPlot
def __init__ (self, fig_rows=1, fig_columns=1, local=None, sharex=False, sharey=False, fig_name='Basic Figure', verbose=0, figsize=[15.0, kwargs)
 
def setAxes (self, x_lavbel=['x'], y_lavbel=['y'])
 
def compileFigure (self)
 
def get (self)
 

Public Attributes

 alpha
 
- Public Attributes inherited from lib.vis.basicPlot
 local
 
 verbose
 
 axes
 

Detailed Description

Definition at line 1427 of file vis.py.

Constructor & Destructor Documentation

◆ __init__()

def lib.vis.SpeedHistograms.__init__ (   self,
  alpha = 1,
  kwargs 
)

Definition at line 1428 of file vis.py.

1428  def __init__(self, alpha=1, **kwargs):
1429  basicPlot.__init__(self, **kwargs)
1430  self.alpha = alpha
1431 

Member Function Documentation

◆ addHistogram()

def lib.vis.SpeedHistograms.addHistogram (   self,
  objects,
  fps 
)
TODO: 

Definition at line 1432 of file vis.py.

1432  def addHistogram(self, objects, fps):
1433  ''' TODO: '''
1434  if(objects):
1435  for object_ in objects:
1436  point_list = userPair.getPointList()
1437  if(point_list):
1438  point_list = sorted(point_list, key=lambda x: x[4])
1439  # Select offset style
1440  #ti = 0 # first indicator
1441  min_ttc = min([x[0] for x in point_list])
1442  ti = [x for x,y in zip(range(len(point_list)),point_list) if y[0] == min_ttc][0]# minimum TTC
1443  # ti +TTC_ti -intercept
1444  offset = point_list[ti][4]/float(fps)+point_list[ti][0]/float(fps)-self.expectationIntercept
1445  for t,ttc in zip([x[4]/float(fps)-offset for x in point_list], [x[0]/float(fps) for x in point_list]):
1446  t = round(t, 1)
1447  try: self.avgVal[t] += ttc
1448  except: self.avgVal[t] = ttc
1449  try: self.avgValWeight[t] += 1
1450  except: self.avgValWeight[t] = 1
1451  self.axes.plot([x[4]/float(fps)-offset for x in point_list], [x[0]/float(fps) for x in point_list], color='b', alpha=self.alpha)
1452 
1453 

◆ get()

def lib.vis.SpeedHistograms.get (   self)

Definition at line 1460 of file vis.py.

1460  def get(self):
1461  self.axes.legend()
1462  return basicPlot.get(self)
1463 

◆ setAxes()

def lib.vis.SpeedHistograms.setAxes (   self)

Definition at line 1454 of file vis.py.

1454  def setAxes(self):
1455  self.axes.set_xlabel(self.local['vis_timeseries_x'])
1456  self.axes.set_ylabel(self.local['vis_cp_hist_x_v2'])
1457  self.axes.set_xlim(0, self.expectationIntercept*1.3)
1458  self.axes.set_ylim(0, self.expectationIntercept*1.3)
1459 

Member Data Documentation

◆ alpha

lib.vis.SpeedHistograms.alpha

Definition at line 1430 of file vis.py.


The documentation for this class was generated from the following file: