Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated python tools

  • Loading branch information...
commit fcb55aa70092516a3c9407564f4a3cc5a1e0a712 1 parent c7431b8
Marije Baalman authored
Showing with 130 additions and 1 deletion.
  1. +5 −1 tools/plotdata/plotloggvb.py
  2. +125 −0 tools/plotdata/testlimiter.py
View
6 tools/plotdata/plotloggvb.py
@@ -237,6 +237,7 @@ def openFile( filename ):
motions = []
mameans = []
precision = []
+ prePrecision = 1.0;
#mam = mplot[4][0]
mam = means[0][0]
avgspeed = []
@@ -256,7 +257,9 @@ def openFile( filename ):
calculate_speed( mam, mplot[13][i], 5 )
#calculate_speed( mam, mplot[13][i], 5 )
##calculate_speed( means[1][i], deltatimes[i] )
- precision.append( numpy.exp( - stds[0][i] * math.pi/2.0 ) )
+ prePrecision = numpy.exp( (- stds[0][i] ) * math.pi/3.0 )
+ #numpy.exp( -x*math.pi/3. )
+ precision.append( prePrecision )
#precision.append( numpy.exp( -max( mplot[5][i], 0. )*math.pi/2.0 ))
speeds.append( speed )
offsets.append( offset )
@@ -321,6 +324,7 @@ def openFile( filename ):
ContainerHor4(plot4,plot14,plotC3,plot26).configure_traits()
ContainerHor4(plotC3,plot24,plot21,plot25).configure_traits()
+ ContainerHor4(plotC3,plot23,plot21,plot4).configure_traits()
ContainerHor4(plot14,plotC3,plot3,plot4).configure_traits()
ContainerHor4(plot14,plotC3,plot21,plot4).configure_traits()
View
125 tools/plotdata/testlimiter.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import optparse
+# from Python v2.7 on should become argparse
+
+#from numpy import *
+from enthought.chaco.shell import *
+
+from enthought.traits.api import HasTraits, Instance
+from enthought.traits.ui.api import View, Item
+from enthought.chaco.api import GridPlotContainer, VPlotContainer, Plot, ArrayPlotData
+from enthought.enable.component_editor import ComponentEditor
+#from numpy import linspace, sin
+
+import numpy
+import math
+import csv
+
+class ContainerHor(HasTraits):
+
+ plot = Instance(VPlotContainer)
+
+ traits_view = View(Item('plot', editor=ComponentEditor(), show_label=False),
+ width=1000, height=600, resizable=True, title="Chaco Plot")
+
+ def __init__(self, plot1,plot2,plot3):
+ super(ContainerHor, self).__init__()
+
+ container = VPlotContainer(plot1,plot2,plot3)
+ self.plot = container
+
+class ContainerHor4(HasTraits):
+
+ plot = Instance(VPlotContainer)
+
+ traits_view = View(Item('plot', editor=ComponentEditor(), show_label=False),
+ width=1000, height=800, resizable=True, title="Chaco Plot")
+
+ def __init__(self, plot1,plot2,plot3, plot4):
+ super(ContainerHor4, self).__init__()
+
+ container = VPlotContainer(plot1,plot2,plot3,plot4)
+ self.plot = container
+
+class ContainerGrid(HasTraits):
+
+ plot = Instance(GridPlotContainer)
+
+ traits_view = View(Item('plot', editor=ComponentEditor(), show_label=False),
+ width=1000, height=1000, resizable=True, title="All plots")
+
+ def __init__(self, plot1,plot2,plot3, plot4,plot5,plot6):
+ super(ContainerGrid, self).__init__()
+
+ container = GridPlotContainer(plot1,plot2,plot3, plot4,plot5,plot6)
+ print container.shape
+ self.plot = container
+
+#class LinePlot(HasTraits):
+ #plot = Instance(Plot)
+ #traits_view = View(
+ #Item('plot',editor=ComponentEditor(), show_label=False),
+ #width=500, height=500, resizable=True, title="Chaco Plot")
+
+ #def __init__(self, x, y, title ):
+ #super(LinePlot, self).__init__()
+
+ ##x = marray2[0]
+ ##y = marray2[1]
+ ##y2 = marray2[4]
+ ##y3 = marray2[5]
+
+ #plotdata = ArrayPlotData(x=x, y=y ) #, y2=y2, y3=y3 )
+ #plot = Plot(plotdata)
+ #plot.plot(("x", "y"), type="line", color="blue")
+ #plot.title = title
+ ##self.plot = plot
+
+def makeplot( x,y,title ):
+ plotdata = ArrayPlotData(x=x, y=y ) #, y2=y2, y3=y3 )
+ plot = Plot(plotdata)
+ plot.plot(("x", "y"), type="line", color="blue")
+ plot.title = title
+ return plot
+
+class LinePlot(HasTraits):
+ plot = Instance(Plot)
+ traits_view = View(
+ Item('plot',editor=ComponentEditor(), show_label=False),
+ width=500, height=500, resizable=True, title="Chaco Plot")
+
+ def __init__(self, plot ):
+ super(LinePlot, self).__init__()
+
+ self.plot = plot
+
+
+if __name__ == "__main__":
+
+ parser = optparse.OptionParser(description='Plot the log.')
+ parser.add_option('-f','--file', action='store', type="string", dest="filename",default="",
+ help='the name of the log file to plot [default:%s]'% '')
+
+ (options,args) = parser.parse_args()
+
+ #x = numpy.asarray( range( 0, 500 ) ) / 10.
+ #y = []
+ #for i in x:
+ #y.append( 20 * ( 1 - math.exp( i ) ) )
+ #y = numpy.exp( -x*math.pi/10. )
+ #y2 = pow( 20 - x, 2 )/400.
+ #y2 = 1 - numpy.exp( -x*math.pi/50. )
+ #y = numpy.asarray( y )
+
+ x = numpy.asarray( range( 0, 4000 ) ) / 1000.
+ y2 = numpy.exp( -x*math.pi/3. )
+ #y = numpy.asarray( y )
+
+ #plot = makeplot( x, y, "limiter" )
+ plot2 = makeplot( x, y2, "precision" )
+ #print y
+ #LinePlot( plot ).configure_traits();
+ LinePlot( plot2 ).configure_traits();
+
Please sign in to comment.
Something went wrong with that request. Please try again.