From f94fa0c6854259e4a2aef210a7a54d72f1d85346 Mon Sep 17 00:00:00 2001 From: Gerko de Roo Date: Sun, 20 Jun 2010 09:58:34 +0200 Subject: [PATCH] Added aggression information in guiplayerstats --- pyfpdb/GuiPlayerStats.py | 5 ++++- pyfpdb/SQL.py | 37 +++++++++++++++++++++++++++++++++++++ pyfpdb/Stats.py | 7 +++---- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index 41e82ed8..5a1acc4d 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -93,10 +93,13 @@ class GuiPlayerStats (threading.Thread): , ["plposition", False, "Posn", 1.0, "%s", "str"] # true not allowed for this line (set in code) , ["pname", False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code) , ["n", True, "Hds", 1.0, "%1.0f", "str"] - , ["avgseats", False, "Seats", 1.0, "%3.1f", "str"] + , ["avgseats", False, "Seats", 1.0, "%3.1f", "str"] , ["vpip", True, "VPIP", 1.0, "%3.1f", "str"] , ["pfr", True, "PFR", 1.0, "%3.1f", "str"] , ["pf3", True, "PF3", 1.0, "%3.1f", "str"] + , ["aggfac", True, "AggFac", 1.0, "%2.2f", "str"] + , ["aggfrq", True, "AggFreq", 1.0, "%3.1f", "str"] + , ["conbet", True, "ContBet", 1.0, "%3.1f", "str"] , ["steals", True, "Steals", 1.0, "%3.1f", "str"] , ["saw_f", True, "Saw_F", 1.0, "%3.1f", "str"] , ["sawsd", True, "SawSD", 1.0, "%3.1f", "str"] diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index de60105b..940a58ff 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -1987,6 +1987,18 @@ class Sql: else 100.0*(sum(cast(hp.street1Aggr as integer))+sum(cast(hp.street2Aggr as integer))+sum(cast(hp.street3Aggr as integer))) /(sum(cast(hp.street1Seen as integer))+sum(cast(hp.street2Seen as integer))+sum(cast(hp.street3Seen as integer))) end AS pofafq + ,case when sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer)) = 0 then -999 + else (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + /(sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + end AS aggfac + ,100.0*(sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as integer))) + + (sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + + (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) ) + AS aggfrq + ,100.0*(sum(cast(hp.street1CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street4CBDone as integer))) + / (sum(cast(hp.street1CBChance as integer))+ sum(cast(hp.street2CBChance as integer))+ sum(cast(hp.street3CBChance as integer))+ sum(cast(hp.street4CBChance as integer))) + AS conbet ,sum(hp.totalProfit)/100.0 AS net ,sum(hp.rake)/100.0 AS rake ,100.0*avg(hp.totalProfit/(gt.bigBlind+0.0)) AS bbper100 @@ -2072,6 +2084,18 @@ class Sql: else 100.0*(sum(cast(hp.street1Aggr as integer))+sum(cast(hp.street2Aggr as integer))+sum(cast(hp.street3Aggr as integer))) /(sum(cast(hp.street1Seen as integer))+sum(cast(hp.street2Seen as integer))+sum(cast(hp.street3Seen as integer))) end AS pofafq + ,case when sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer)) = 0 then -999 + else (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + /(sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + end AS aggfac + ,100.0*(sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as integer))) + + (sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + + (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) ) + AS aggfrq + ,100.0*(sum(cast(hp.street1CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street4CBDone as integer))) + / (sum(cast(hp.street1CBChance as integer))+ sum(cast(hp.street2CBChance as integer))+ sum(cast(hp.street3CBChance as integer))+ sum(cast(hp.street4CBChance as integer))) + AS conbet ,sum(hp.totalProfit)/100.0 AS net ,sum(hp.rake)/100.0 AS rake ,100.0*avg(hp.totalProfit/(gt.bigBlind+0.0)) AS bbper100 @@ -2158,6 +2182,18 @@ class Sql: else 100.0*(sum(cast(hp.street1Aggr as integer))+sum(cast(hp.street2Aggr as integer))+sum(cast(hp.street3Aggr as integer))) /(sum(cast(hp.street1Seen as integer))+sum(cast(hp.street2Seen as integer))+sum(cast(hp.street3Seen as integer))) end AS pofafq + ,case when sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer)) = 0 then -999 + else (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + /(sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + end AS aggfac + ,100.0*(sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) + / ((sum(cast(hp.foldToOtherRaisedStreet1 as integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as integer))) + + (sum(cast(hp.street1Calls as integer))+ sum(cast(hp.street2Calls as integer))+ sum(cast(hp.street3Calls as integer))+ sum(cast(hp.street4Calls as integer))) + + (sum(cast(hp.street1Aggr as integer)) + sum(cast(hp.street2Aggr as integer)) + sum(cast(hp.street3Aggr as integer)) + sum(cast(hp.street4Aggr as integer))) ) + AS aggfrq + ,100.0*(sum(cast(hp.street1CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street2CBDone as integer)) + sum(cast(hp.street4CBDone as integer))) + / (sum(cast(hp.street1CBChance as integer))+ sum(cast(hp.street2CBChance as integer))+ sum(cast(hp.street3CBChance as integer))+ sum(cast(hp.street4CBChance as integer))) + AS conbet ,sum(hp.totalProfit)/100.0 AS net ,sum(hp.rake)/100.0 AS rake ,100.0*avg(hp.totalProfit/(gt.bigBlind+0.0)) AS bbper100 @@ -2706,6 +2742,7 @@ class Sql: GROUP BY h.handStart, hp.handId, hp.sawShowdown, hp.totalProfit ORDER BY h.handStart""" + #################################### # Session stats query #################################### diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 654d1652..0f3e726b 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -512,9 +512,9 @@ def agg_freq(stat_dict, player): """ Agression on the flop and all streets """ bet_raise = stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4'] """ number post flop streets seen, this must be number of post-flop calls !! """ - post_call = stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4'] + post_call = stat_dict[player]['call_1'] + stat_dict[player]['call_2'] + stat_dict[player]['call_3'] + stat_dict[player]['call_4'] """ Number of post flop folds this info is not yet in the database """ - post_fold = stat_dict[player]['f_freq_2'] + stat_dict[player]['f_freq_3'] + stat_dict[player]['f_freq_4'] + post_fold = stat_dict[player]['f_freq_1'] + stat_dict[player]['f_freq_2'] + stat_dict[player]['f_freq_3'] + stat_dict[player]['f_freq_4'] stat = float (bet_raise) / float(post_call + post_fold + bet_raise) @@ -537,7 +537,6 @@ def agg_freq(stat_dict, player): def agg_fact(stat_dict, player): """ Post-Flop aggression frequency.""" """ Aggression factor = (times bet or raised post-flop) / (times called post-flop) """ - """ Times called post flop is not availlable, streets seen used """ stat = 0.0 try: bet_raise = stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3'] + stat_dict[player]['aggr_4'] @@ -546,7 +545,7 @@ def agg_fact(stat_dict, player): if post_call > 0: stat = float (bet_raise) / float(post_call) else: - stat = bet_raise + stat = float (bet_raise) return (stat, '%2.2f' % (stat) , 'afa=%2.2f' % (stat) ,