p104 - grapher improvements by carl

This commit is contained in:
steffen123 2008-09-26 01:05:00 +01:00
parent 005627b9d7
commit 96e9a0112f
3 changed files with 20 additions and 7 deletions

View File

@ -1,7 +1,7 @@
Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts. Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
Please also see db-todo.txt Please also see db-todo.txt
alpha4 (release 25Sep-2Oct) alpha5 (release 25Sep-2Oct)
====== ======
pgsql recreate doesnt work, and it may not store version field on creation if using sql file with pgadmin. pgsql recreate doesnt work, and it may not store version field on creation if using sql file with pgadmin.
check we're reading mucked cards from PS check we're reading mucked cards from PS
@ -22,8 +22,6 @@ printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring
change to savannah? change to savannah?
implement steal and positions in stud implement steal and positions in stud
anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no anonymiser script to generate testdata without making a dozen find&replace all... remember to replace hand no with running no
Import draw (maybe without HudCache for a start)
table with data for graphs for SD/F, W$wSF, W$@SD
separate db table design version and last bugfix in importer separate db table design version and last bugfix in importer
change tabledesign VALIGN and add link to webpage change tabledesign VALIGN and add link to webpage
finish updating filelist finish updating filelist
@ -41,6 +39,8 @@ Many STTs won't import
before beta before beta
=========== ===========
Import draw (maybe without HudCache for a start)
graphs for SD/F, W$wSF, W$@SD
validate webpage validate webpage
make linux use /etc/fpdb for config first, then ~/.fpdb. make linux use /etc/fpdb for config first, then ~/.fpdb.
FTP file with only one partial hand causes error FTP file with only one partial hand causes error

View File

@ -20,12 +20,14 @@ import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
import os import os
import pokereval
try: try:
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
from numpy import arange, sin, pi from numpy import arange, cumsum
from pylab import *
except: except:
print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib." print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib."
@ -55,8 +57,18 @@ class GuiGraphViewer (threading.Thread):
site=1 site=1
self.fig = Figure(figsize=(5,4), dpi=100) self.fig = Figure(figsize=(5,4), dpi=100)
#Set graph properties
self.ax = self.fig.add_subplot(111) self.ax = self.fig.add_subplot(111)
#
self.ax.set_title("Profit graph for ring games")
#Set axis labels and grid overlay properites
self.ax.set_xlabel("Hands", fontsize = 12)
self.ax.set_ylabel("$", fontsize = 12)
self.ax.grid(color='g', linestyle=':', linewidth=0.2)
self.cursor.execute("""SELECT handId, winnings FROM HandsPlayers self.cursor.execute("""SELECT handId, winnings FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId = Players.id INNER JOIN Players ON HandsPlayers.playerId = Players.id
INNER JOIN Hands ON Hands.id = HandsPlayers.handId INNER JOIN Hands ON Hands.id = HandsPlayers.handId
@ -74,11 +86,12 @@ class GuiGraphViewer (threading.Thread):
profit[i]=(i, winnings[i][1]-spent[0]) profit[i]=(i, winnings[i][1]-spent[0])
y=map(lambda x:float(x[1]), profit) y=map(lambda x:float(x[1]), profit)
line = range(len(y)) line = cumsum(y)
line = line/100
for i in range(len(y)): self.ax.annotate ("All Hands, Site %s", (61,25), xytext =(0.1, 0.9) , textcoords ="axes fraction" ,)
line[i] = y[i] + line[i-1]
#Now draw plot
self.ax.plot(line,) self.ax.plot(line,)
self.canvas = FigureCanvas(self.fig) # a gtk.DrawingArea self.canvas = FigureCanvas(self.fig) # a gtk.DrawingArea

0
pyfpdb/fpdb_import.py Normal file → Executable file
View File