You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(11) |
Sep
|
Oct
|
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(6) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(10) |
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mli...@us...> - 2012-06-24 00:35:25
|
Revision: 62 http://salstat.svn.sourceforge.net/salstat/?rev=62&view=rev Author: mlivingstone Date: 2012-06-24 00:35:14 +0000 (Sun, 24 Jun 2012) Log Message: ----------- [bug 3537307] partial clipboard past fix Modified Paths: -------------- sal.py Modified: sal.py =================================================================== --- sal.py 2011-12-20 09:45:53 UTC (rev 61) +++ sal.py 2012-06-24 00:35:14 UTC (rev 62) @@ -196,8 +196,8 @@ def PasteData(self, event): # this routine needs to check that the grid is big enough to hold the pasted data, resizing it if not. buffer = wx.TextDataObject() - ccol = self.GetGridCursorCol() - crow = self.GetGridCursorRow() + currentcol = self.GetGridCursorCol() + currentrow = self.GetGridCursorRow() res = wx.TheClipboard.Open() if res: res = wx.TheClipboard.GetData(buffer) @@ -205,15 +205,11 @@ if res: self.Saved = False dataIn = buffer.GetText() - lines = dataIn.split('\n') + lines = dataIn.split('\r') for i in range(len(lines)): words = lines[i].split('\t') for j in range(len(words)): - self.SetCellValue(crow + i, ccol + j, words[j]) - """if type(buffer.GetText()) != list: - self.SetCellValue(currentrow, currentcol, buffer.GetText()) - else: - self.SetCellValue(currentrow, currentcol, 'list!')""" + self.SetCellValue(currentrow + i, currentcol + j, words[j]) def EditGrid(self, event, numrows): self.AppendRows(numrows) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-12-20 09:46:05
|
Revision: 61 http://salstat.svn.sourceforge.net/salstat/?rev=61&view=rev Author: mlivingstone Date: 2011-12-20 09:45:53 +0000 (Tue, 20 Dec 2011) Log Message: ----------- Minor code reformatting Modified Paths: -------------- api.py chart.py dataObject.py initVals.py miscClasses.py sal.py salstat_stats.py Modified: api.py =================================================================== --- api.py 2011-10-30 04:28:53 UTC (rev 60) +++ api.py 2011-12-20 09:45:53 UTC (rev 61) @@ -37,7 +37,7 @@ def Describe(datain): """Provides OO descriptive statistics. Called by >>>x = Describe(a) and then a.N for the N, a.sum for the sum etc""" - if (type(datain) == int): + if type(datain) == int: datain = frame.grid.CleanData(col2) return salstat_stats.FullDescriptives(datain) @@ -47,7 +47,7 @@ starting at row 0. The grid is resized if the list is too large. This routine desparately needs to be updated to prevent errors""" n = len(data) - if (n > frame.grid.GetNumberRows()): + if n > frame.grid.GetNumberRows(): frame.grid.AddNCols(-1, (datawidth - gridwidth + 5)) for i in range(n): frame.grid.SetCellValue(i, column, str(data[i])) @@ -56,17 +56,17 @@ """This routine performs a 1 sample t-test using the given data and a specified user mean.""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for column 1\n' + elif type(col1) != list: + error += 'Invalid information for column 1\n' TBase = salstat_stats.OneSampleTests(col1, umean) TBase.OneSampleTTest(usermean) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.t, TBase.df, TBase.prob else: return error @@ -75,17 +75,17 @@ """This routine performs a 1 sample sign-test using the given data and a specified user mean.""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for column 1\n' + elif type(col1) != list: + error += 'Invalid information for column 1\n' TBase = salstat_stats.OneSampleTests(col1, umean) TBase.OneSampleSignTest(usermean) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.nplus, TBase.nminus, TBase.z, TBase.prob else: return error @@ -94,17 +94,17 @@ """This routine performs a chi square for variance ratio test using the given data and a specified user mean.""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for column 1\n' + elif type(col1) != list: + error += 'Invalid information for column 1\n' TBase = salstat_stats.OneSampleTests(col1, umean) TBase.ChiSquareVariance(usermean) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.chisquare, TBase.df, TBase.prob else: return error @@ -116,21 +116,21 @@ lists are used instead. There is a modicum of bounds checking on the passed variables to ensure that they are the right types (and bounds)""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for column 1\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for column 1\n' + if type(col2) == int: col2 = frame.grid.CleanData(col2) - elif (type(col2) != list): - error = error +'Invalid information for column 2\n' + elif type(col2) != list: + error += 'Invalid information for column 2\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.TTestPaired(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.t, TBase.df, TBase.prob else: return error @@ -141,21 +141,21 @@ if the parameters are an integer, then that integers columns data are retrieved.""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.TTestUnpaired() - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.t, TBase.df, TBase.prob else: return error @@ -163,21 +163,21 @@ def DoPearsonsCorrelation(col1, col2, tail = 2): """This function performs a Pearsons correlation upon 2 data sets.""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.PearsonsCorrelation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.t, TBase.r, TBase.df, TBase.prob else: return error @@ -186,21 +186,21 @@ """This performs an F-test for variance ratios upon 2 data sets. Passed in addition to the datasets is the user variance""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.TwoSampleSignTextCorrelation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.t, TBase.r, TBase.df, TBase.prob else: return error @@ -208,21 +208,21 @@ def DoSignTest(col1, col2, tail = 2): """This function performs a 2-sample sign test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.TwoSampleSignTextCorrelation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.z, TBase.prob else: return error @@ -230,21 +230,21 @@ def DoKendallsCorrelation(col1, col2, tail = 2): """This function performs a Kendalls tau correlation""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.KendalssTau(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.tau, TBase.z, TBase.prob else: return error @@ -252,21 +252,21 @@ def DoKSTest(col1, col2, tail = 2): """This function performs a Komogorov-Smirnov test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.KolmogorovSmirnov(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.d, TBase.prob else: return error @@ -274,21 +274,21 @@ def DoSpearmansCorrelation(col1, col2, tail = 2): """This function performs a Spearmans correlation on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.SpearmansCorrelation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.rho, TBase.t, TBase.df, TBase.prob else: return error @@ -296,21 +296,21 @@ def DoRankSums(col1, col2, tail = 2): """This function performs a Wilcoxon rank sums test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.RankSums(col1, col2) TBase.TwoSampleSignTextCorrelation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.z, TBase.prob else: return error @@ -318,21 +318,21 @@ def DoSignedRanks(col1, col2, tail = 2): """This function performs a Wilcoxon signed ranks test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.SignedRanks(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.z, TBase.wt, TBase.prob else: return error @@ -340,21 +340,21 @@ def DoMannWhitneyTest(col1, col2, tail = 2): """This function performs a Mann-Whitney U test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.MannWhitneyU(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.bigu, TBase.smallu, TBase.z, TBase.prob else: return error @@ -362,21 +362,21 @@ def DoLinearRegression(col1, col2, tail = 2): """This function performs a 2-sample sign test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.LinearRegression(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.df, TBase.r, TBase.slope, TBase.intercept, \ TBase.sterrest, TBase.prob else: @@ -385,21 +385,21 @@ def DoPairedPermutation(col1, col2, tail = 2): """This function performs a 2-sample sign test on 2 data sets""" error = "" - if (type(col1) == int): + if type(col1) == int: col1 = frame.grid.CleanData(col1) - elif (type(col1) != list): - error = error + 'Invalid information for first dataset\n' - if (type(col2) == int): + elif type(col1) != list: + error += 'Invalid information for first dataset\n' + if type(col2) == int: col2 = frame.grid.CleanData(col1) - elif (type(col2) != list): - error = error + 'Invalid information for second dataset\n' + elif type(col2) != list: + error += 'Invalid information for second dataset\n' TBase = salstat_stats.TwoSampleTests(col1, col2) TBase.PairedPermutation(col1, col2) - if (tail == 1): - TBase.prob = TBase.prob / 2 + if tail == 1: + TBase.prob /= 2 if (tail != 1) and (tail != 2): - error = error + "Invalid information for the tail" - if (error == ""): + error += "Invalid information for the tail" + if error == "": return TBase.nperm, TBase.prob else: return error Modified: chart.py =================================================================== --- chart.py 2011-10-30 04:28:53 UTC (rev 60) +++ chart.py 2011-12-20 09:45:53 UTC (rev 61) @@ -38,7 +38,7 @@ self.colour = colour def GetPoints(self): - return (self.x, self.y) + return self.x, self.y def GetFill(self): return self.gfill @@ -172,7 +172,7 @@ gObject.dc.SetPen(wx.Pen(self.colour, self.lineThickness)) for i in range(len(gObject.realaxis)): try: - gObject.dc.DrawLine(gObject.realaxis[i], mapping[i], \ + gObject.dc.DrawLine(gObject.realaxis[i], mapping[i], gObject.realaxis[i]+width, mapping[i+1]) except IndexError: pass @@ -314,7 +314,7 @@ def GetClientArea(self, panel): tmp = panel.GetClientSize() - tmp[1] = tmp[1] - 10 + tmp[1] -= 10 return tmp def GetGraphCoords(self): @@ -336,7 +336,7 @@ pass tmp2 = self.dc.GetTextExtent(self.ylabel) self.gSize[0] = tmp1[0] + tmp2[0] - self.gSize[2] = self.gSize[2] - 10 + self.gSize[2] -= 10 def SetTitle1(self, title): self.title1 = title @@ -383,7 +383,7 @@ def DrawAxis(self): # this routine calculates the x-axis and draws it, labels and all - if self.axis == []: + if not self.axis: # axis has no length, need to use the longest data axesList = [len(i.GetCoords()) for i in self.actions] self.length = max(axesList) Modified: dataObject.py =================================================================== --- dataObject.py 2011-10-30 04:28:53 UTC (rev 60) +++ dataObject.py 2011-12-20 09:45:53 UTC (rev 61) @@ -126,7 +126,7 @@ for i in self.dataSources: newlist.append(self.GetData(i)) print "newlist =", newlist - return numpy.array((newlist)) + return numpy.array(newlist) class OneSampleTestClass(TestDataClass): """ Modified: initVals.py =================================================================== --- initVals.py 2011-10-30 04:28:53 UTC (rev 60) +++ initVals.py 2011-12-20 09:45:53 UTC (rev 61) @@ -31,25 +31,25 @@ variables) """ def __init__(self): - self.testList = ['t-test','Sign test','Chi square test for variance' \ - 'chi square','F test','Kolmogorov-Smirnov', \ - 'Linear Regression', 'Mann-Whitney U', 'Paired Permutation', \ - 'Paired Sign', 't-test paired','t-test unpaired', \ - 'Wald-Wolfowitz Runs', 'Wilcoxon Rank Sums', \ - 'Wilcoxon Signed Ranks', 'Kendalls tau','Pearsons correlation'\ - ,'Point Biserial r', 'Spearmans rho','anova between subjects',\ - 'anova within subjects','Kruskall Wallis','Friedman test',\ + self.testList = ['t-test','Sign test','Chi square test for variance' + 'chi square','F test','Kolmogorov-Smirnov', + 'Linear Regression', 'Mann-Whitney U', 'Paired Permutation', + 'Paired Sign', 't-test paired','t-test unpaired', + 'Wald-Wolfowitz Runs', 'Wilcoxon Rank Sums', + 'Wilcoxon Signed Ranks', 'Kendalls tau','Pearsons correlation', + 'Point Biserial r', 'Spearmans rho','anova between subjects', + 'anova within subjects','Kruskall Wallis','Friedman test', 'Cochranes Q'] self.descriptivesList = \ - ['N','Sum','Mean','Variance','Standard Deviation','Standard Error',\ - 'Sum of Squares','Sum of Squared Devs', \ - 'Coefficient of Variation', \ - 'Range','Number Missing', \ - 'Geometric Mean','Harmonic Mean', \ - 'Skewness','Kurtosis', 'Minimum', 'First Quartile',\ - 'Median', 'Third Quartile', 'Maximum', \ - 'Interquartile Range', \ - 'Median Absolute Deviation','Mode', \ + ['N','Sum','Mean','Variance','Standard Deviation','Standard Error', + 'Sum of Squares','Sum of Squared Devs', + 'Coefficient of Variation', + 'Range','Number Missing', + 'Geometric Mean','Harmonic Mean', + 'Skewness','Kurtosis', 'Minimum', 'First Quartile', + 'Median', 'Third Quartile', 'Maximum', + 'Interquartile Range', + 'Median Absolute Deviation','Mode', 'Number of Unique Levels'] # get the list of 2 sample tests self.OneSampleTestsDict = {} @@ -77,17 +77,17 @@ att = getattr(salstat_stats.Correlations, i).__doc__.split('\n')[0] self.CorrelationsTestsDict.setdefault(att,i) self.oneSampleTests = ['t-test','Sign test','Chi square test for variance'] - self.twoSampleTests = ['chi square','F test','Kolmogorov-Smirnov', \ - 'Linear Regression', 'Mann-Whitney U', 'Paired Permutation', \ - 'Paired Sign', 't-test paired','t-test unpaired', \ - 'Wald-Wolfowitz Runs', 'Wilcoxon Rank Sums', \ + self.twoSampleTests = ['chi square','F test','Kolmogorov-Smirnov', + 'Linear Regression', 'Mann-Whitney U', 'Paired Permutation', + 'Paired Sign', 't-test paired','t-test unpaired', + 'Wald-Wolfowitz Runs', 'Wilcoxon Rank Sums', 'Wilcoxon Signed Ranks'] - self.correlations = ['Kendalls tau','Pearsons correlation'\ + self.correlations = ['Kendalls tau','Pearsons correlation' ,'Point Biserial r', 'Spearmans rho'] - """self.threeSampleTests = ['anova between subjects',\ - 'anova within subjects','Kruskall Wallis','Friedman test',\ + """self.threeSampleTests = ['anova between subjects', + 'anova within subjects','Kruskall Wallis','Friedman test', 'Cochranes Q']""" - """self.testlist = self.OneSampleTestsDict + self.TwoSampleTestsDict + \ + """self.testlist = self.OneSampleTestsDict + self.TwoSampleTestsDict + self.ThreeSampleTestsDict + self.CorrelationsTestsDict""" self.HOME = os.getcwd() self.userVals = {} Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-10-30 04:28:53 UTC (rev 60) +++ miscClasses.py 2011-12-20 09:45:53 UTC (rev 61) @@ -141,7 +141,7 @@ cols = self.GetNumberCols() for i in range(cols): dat = self.GetCellValue(0, i) - if (dat != ''): + if dat != '': ColsUsed.append(self.GetColLabelValue(i)) colnums.append(i) return ColsUsed, colnums @@ -159,16 +159,16 @@ def GetUsedRows(self): RowsUsed = [] for i in range(self.GetNumberCols()): - if (self.GetCellValue(0, i) != ''): + if self.GetCellValue(0, i) != '': for j in range(self.GetNumberRows()): - if (self.GetCellValue(j,i) == ''): + if self.GetCellValue(j,i) == '': RowsUsed.append(j) break return RowsUsed def SaveAsDataASCII(self, event): default = inits.get('savedir') - dlg = wx.FileDialog(self, "Save Data File", default,"",\ + dlg = wx.FileDialog(self, "Save Data File", default,"", "ASCII Text (*.dat)|*.dat", wx.SAVE | wx.OVERWRITE_PROMPT) #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE | wx.OVERWRITE_PROMPT) icon = images.getIconIcon() @@ -181,13 +181,13 @@ self.outputfilename = outputfilename fout = open(filename, "w") cols,waste = self.GetUsedCols() - if (dlg.GetFilterIndex() == 0): + if dlg.GetFilterIndex() == 0: #save as plain text rows = self.GetUsedRows() maxrows = max(rows) for i in range(len(cols)): for j in range(maxrows): - if (self.GetCellValue(j,i) == ''): + if self.GetCellValue(j,i) == '': self.SetCellValue(j,i,'.') for i in range(maxrows): datapoint=[] @@ -199,7 +199,7 @@ line = string.join(datapoint) fout.write(line) fout.write('\n') - elif (dlg.GetFilterIndex() == 1): + elif dlg.GetFilterIndex() == 1: # save as native format print "cannot do this just yet!" fout.close() @@ -207,7 +207,7 @@ def SaveDataASCII(self, event): default = inits.get('savedir') - if (filename == 'UNTITLED'): + if filename == 'UNTITLED': self.SaveAsDataASCII(event) """dlg = wx.FileDialog(self, "Save Data File", default,"",\ "ASCII Text (*.dat)|*.dat| \ @@ -272,7 +272,7 @@ for j in range(len(words)): self.SetCellValue(gridline, j, words[j]) gridline += 1 - if (gridline == self.GetNumberRows()): + if gridline == self.GetNumberRows(): self.AddNCells(0,10) fin.close() self.Thaw() @@ -297,7 +297,7 @@ def LoadNativeXML(self, filename): # also get rid of the old history - if os.path.isfile(filename) == 0: + if not os.path.isfile(filename): pass else: # now start the XML processing @@ -370,21 +370,21 @@ line = fin.readline() except: pass - if (line == ''): + if line == '': break dataheight += 1 gridwidth = self.GetNumberCols() gridheight = self.GetNumberRows() - if (datawidth > gridwidth): + if datawidth > gridwidth: self.AddNCols(-1, (datawidth - gridwidth + 5)) - if (dataheight > gridheight): + if dataheight > gridheight: self.AddNRows(-1, (dataheight - gridheight + 5)) fin.close() fin = open(filename, "r") currentrow = 0 for i in range(dataheight): line = fin.readline() - if (line == ''): + if line == '': break line = string.replace(line, ',', ' ') words = string.split(line) @@ -419,9 +419,9 @@ indata = [] for i in range(self.GetNumberCols()): datapoint = self.GetCellValue(row, i) - if (datapoint != ''): + if datapoint != '': value = float(datapoint) - if (value != missingvalue): + if value != missingvalue: indata.append(value) return indata @@ -434,7 +434,7 @@ if (datapoint != '') and (datapoint != '.'): try: value = float(datapoint) - if (value != missingvalue): + if value != missingvalue: indata.append(value) else: self.missing += 1 Modified: sal.py =================================================================== --- sal.py 2011-10-30 04:28:53 UTC (rev 60) +++ sal.py 2011-12-20 09:45:53 UTC (rev 61) @@ -260,7 +260,7 @@ dat = self.GetCellValue(j, i) if dat != '': tmp += 1 - if (tmp > 0): + if tmp > 0: ColsUsed.append(self.GetColLabelValue(i)) colnums.append(i) tmp = 0 @@ -280,9 +280,9 @@ def GetUsedRows(self): RowsUsed = [] for i in range(self.GetNumberCols()): - if (self.GetCellValue(0, i) != ''): + if self.GetCellValue(0, i) != '': for j in range(self.GetNumberRows()): - if (self.GetCellValue(j,i) == ''): + if self.GetCellValue(j,i) == '': RowsUsed.append(j) break return RowsUsed @@ -302,13 +302,13 @@ ini.filename = filename fout = open(ini.filename, "w") cols,waste = self.GetUsedCols() - if (dlg.GetFilterIndex() == 0): + if dlg.GetFilterIndex() == 0: #save as plain text rows = self.GetUsedRows() maxrows = max(rows) for i in range(len(cols)): for j in range(maxrows): - if (self.GetCellValue(j,i) == ''): + if self.GetCellValue(j,i) == '': self.SetCellValue(j,i,'.') for i in range(maxrows): datapoint=[] @@ -320,7 +320,7 @@ line = string.join(datapoint) fout.write(line) fout.write('\n') - elif (dlg.GetFilterIndex() == 1): + elif dlg.GetFilterIndex() == 1: # save as native format print "cannot do this just yet!" fout.close() @@ -328,7 +328,7 @@ def SaveDataASCII(self, event): default = ini.userVals.get('savedir') - if (ini.filename == 'UNTITLED'): + if ini.filename == 'UNTITLED': self.SaveAsDataASCII(event) """dlg = wx.FileDialog(self, "Save Data File", default,"",\ "ASCII Text (*.dat)|*.dat| \ @@ -416,7 +416,7 @@ def LoadNativeXML(self, filename): # also get rid of the old history - if os.path.isfile(filename) == 0: + if not os.path.isfile(filename): pass else: # now start the XML processing @@ -647,7 +647,7 @@ if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() if not os.path.splitext(filename) [1]: - filename = filename + '.html' + filename += '.html' self.filename = filename fout = open(self.filename, "w") script = self.scripted.GetText() @@ -699,23 +699,23 @@ def GoBackPressed(self, event): pagenum = self.tabs.GetSelection() - if (pagenum == 0): + if not pagenum: self.wizard.GoBack(event) - if (pagenum == 1): + if pagenum == 1: self.topics.GoBack(event) def GoForwardPressed(self, event): pagenum = self.tabs.GetSelection() - if (pagenum == 0): + if not pagenum: self.wizard.GoForward(event) - if (pagenum == 1): + if pagenum == 1: self.topics.GoForward(event) def GoHomePressed(self, event): pagenum = self.tabs.GetSelection() - if (pagenum == 0): + if not pagenum: self.wizard.LoadPage('wizard.html') - if (pagenum == 1): + if pagenum == 1: self.topics.LoadPage('help/index.html') def OnCloseAbout(self, event): @@ -762,10 +762,10 @@ def OnOkayVariables(self, event): for i in range(frame.grid.GetNumberCols()-1): newlabel = self.vargrid.GetCellValue(0, i) - if (newlabel != ''): + if newlabel != '': frame.grid.SetColLabelValue(i, newlabel) newsig = self.vargrid.GetCellValue(1, i) - if (newsig != ''): + if newsig != '': try: frame.grid.SetColFormatFloat(i, -1, int(newsig)) except ZeroDivisionError: @@ -846,7 +846,7 @@ buffer = wx.TextDataObject() data = self.WholeOutString data = data[:-1] - if (wx.TheClipboard.Open()): + if wx.TheClipboard.Open(): buffer.SetText(data) wx.TheClipboard.SetData(buffer) wx.TheClipboard.Close() Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-10-30 04:28:53 UTC (rev 60) +++ salstat_stats.py 2011-12-20 09:45:53 UTC (rev 61) @@ -76,7 +76,7 @@ itemp = ivec[j] ivec[j] = ivec[j+gap] ivec[j+gap] = itemp - gap = gap / 2 # integer division needed + gap /= 2 # svec is now sorted inlist, and ivec has the order svec[i] = vec[ivec[i]] return svec, ivec @@ -94,8 +94,8 @@ dupcount = 0 newlist = [0]*n for i in range(n): - sumranks = sumranks + i - dupcount = dupcount + 1 + sumranks += i + dupcount += 1 if i==n-1 or svec[i] != svec[i+1]: averank = sumranks / float(dupcount) + 1 for j in range(i-dupcount+1,i+1): @@ -118,15 +118,15 @@ n = len(sorted) T = 0.0 i = 0 - while (i<n-1): + while i<n-1: if sorted[i] == sorted[i+1]: nties = 1 while (i<n-1) and (sorted[i] == sorted[i+1]): - nties = nties +1 - i = i +1 - T = T + nties**3 - nties - i = i+1 - T = T / float(n**3-n) + nties += 1 + i += 1 + T += nties**3 - nties + i += 1 + T /= float(n**3-n) return 1.0 - T def sum (inlist): @@ -137,7 +137,7 @@ """ s = 0 for item in inlist: - s = s + item + s += item return s ########################### @@ -162,7 +162,7 @@ if chisq <= 0 or df < 1: return 1.0 a = 0.5 * chisq - if df%2 == 0: + if not df % 2: even = 1 else: even = 0 @@ -172,7 +172,7 @@ s = y else: s = 2.0 * zprob(-math.sqrt(chisq)) - if (df > 2): + if df > 2: chisq = 0.5 * (df - 1.0) if even: z = 1.0 @@ -184,10 +184,10 @@ else: e = math.log(math.sqrt(math.pi)) c = math.log(a) - while (z <= chisq): - e = math.log(z) + e - s = s + ex(c*z-a-e) - z = z + 1.0 + while z <= chisq: + e += math.log(z) + s += ex(c*z-a-e) + z += 1.0 return s else: if even: @@ -195,11 +195,11 @@ else: e = 1.0 / math.sqrt(math.pi) / math.sqrt(a) c = 0.0 - while (z <= chisq): - e = e * (a/float(z)) - c = c + e - z = z + 1.0 - return (c*y+s) + while z <= chisq: + e *= (a/float(z)) + c += e + z += 1.0 + return c*y+s else: return s @@ -212,13 +212,13 @@ minchisq = 0.0 maxchisq = 99999.0 chi_epsilon = 0.000001 - if (prob <= 0.0): + if prob <= 0.0: return maxchisq - elif (prob >= 1.0): + elif prob >= 1.0: return 0.0 chisqval = df / math.sqrt(prob) - while ((maxchisq - minchisq) > chi_epsilon): - if (chisqprob(chisqval, df) < prob): + while (maxchisq - minchisq) > chi_epsilon: + if chisqprob(chisqval, df) < prob: maxchisq = chisqval else: minchisq = chisqval @@ -234,10 +234,10 @@ """ z = abs(x) t = 1.0 / (1.0+0.5*z) - ans = t * math.exp(-z*z-1.26551223 + t*(1.00002368+t*(0.37409196+t* \ - (0.09678418+t*(-0.18628806+t* \ - (0.27886807+t*(-1.13520398+t* \ - (1.48851587+t*(-0.82215223+t* \ + ans = t * math.exp(-z*z-1.26551223 + t*(1.00002368+t*(0.37409196+t* + (0.09678418+t*(-0.18628806+t* + (0.27886807+t*(-1.13520398+t* + (1.48851587+t*(-0.82215223+t* 0.17087277))))))))) if x >= 0: return ans @@ -262,7 +262,7 @@ y = 0.5 * math.fabs(z) if y >= (Z_MAX*0.5): x = 1.0 - elif (y < 1.0): + elif y < 1.0: w = y*y x = ((((((((0.000124818987 * w -0.001075204047) * w +0.005198775019) * w @@ -270,7 +270,7 @@ -0.151968751364) * w +0.319152932694) * w -0.531923007300) * w +0.797884560593) * y * 2.0 else: - y = y - 2.0 + y -= 2.0 x = (((((((((((((-0.000045255659 * y +0.000152529290) * y -0.000019538132) * y -0.000676904986) * y +0.001390604284) * y @@ -298,7 +298,7 @@ a2 = -2.0*alam*alam for j in range(1,201): term = fac*math.exp(a2*j*j) - ksum = ksum + term + ksum += term if math.fabs(term)<=(0.001*termbf) or math.fabs(term)<(1.0e-8*ksum): return ksum fac = -fac @@ -330,7 +330,7 @@ if (prob <= 0.0) or (prob >= 1.0): return 0.0 fval = 1.0 / prob - while (abs(maxf - minf) > f_epsilon): + while abs(maxf - minf) > f_epsilon: if fprob(fval, df1, df2) < prob: maxf = fval else: @@ -367,7 +367,7 @@ bm = bp/bpp az = app/bpp bz = 1.0 - if (abs(az-aold)<(EPS*abs(az))): + if abs(az-aold)<(EPS*abs(az)): return az # needs to return something after an 'else:' statement #print 'a or b too big, or ITMAX too small in Betacf.' @@ -385,11 +385,11 @@ 0.120858003e-2, -0.536382e-5] x = xx - 1.0 tmp = x + 5.5 - tmp = tmp - (x+0.5)*math.log(tmp) + tmp -= (x+0.5)*math.log(tmp) ser = 1.0 for j in range(len(coeff)): - x = x + 1 - ser = ser + coeff[j]/x + x += 1 + ser += coeff[j]/x return -tmp + math.log(2.50662827465*ser) def betai(a,b,x): @@ -404,14 +404,14 @@ Usage: betai(a,b,x) """ - if (x<0.0 or x>1.0): + if x<0.0 or x>1.0: raise ValueError, 'Bad x in lbetai' - if (x==0.0 or x==1.0): + if x==0.0 or x==1.0: bt = 0.0 else: bt = math.exp(gammln(a+b)-gammln(a)-gammln(b)+a*math.log(x)+b* math.log(1.0-x)) - if (x<(a+1.0)/(a+b+2.0)): + if x<(a+1.0)/(a+b+2.0): return bt*betacf(a,b,x)/float(a) else: return 1.0-bt*betacf(b,a,1.0-x)/float(b) @@ -425,14 +425,14 @@ """ returns the incomplete beta function """ - if (x<0.0 or x>1.0): + if x<0.0 or x>1.0: raise ValueError, 'Bad x in lbetai' - if (x==0.0 or x==1.0): + if x==0.0 or x==1.0: bt = 0.0 else: bt = math.exp(gammln(a+b)-gammln(a)-gammln(b)+a*math.log(x)+b* math.log(1.0-x)) - if (x<(a+1.0)/(a+b+2.0)): + if x<(a+1.0)/(a+b+2.0): self.prob = bt*betacf(a,b,x)/float(a) else: self.prob = 1.0-bt*betacf(b,a,1.0-x)/float(b) @@ -445,11 +445,11 @@ 0.120858003e-2, -0.536382e-5] x = xx - 1.0 tmp = x + 5.5 - tmp = tmp - (x+0.5)*math.log(tmp) + tmp -= (x+0.5)*math.log(tmp) ser = 1.0 for j in range(len(coeff)): - x = x + 1 - ser = ser + coeff[j]/x + x += 1 + ser += coeff[j]/x return -tmp + math.log(2.50662827465*ser) def betacf(self, a, b, x): @@ -474,7 +474,7 @@ bm = bp/bpp az = app/bpp bz = 1.0 - if (abs(az-aold)<(EPS*abs(az))): + if abs(az-aold)<(EPS*abs(az)): return az ########################### @@ -493,21 +493,21 @@ interquartile range (interquartile), number of unique values (numberuniques). """ def __init__(self, inlist, name = '', missing = 0): - self.all = {'N':'','Sum':0,'Mean':0,'Variance':0, \ - 'Standard Deviation':0,'Standard Error':0, \ - 'Sum of Squares':0,'Sum of Squared Devs':0,\ - 'Coefficient of Variation':0, \ - 'Range':0,'Number Missing':0, \ - 'Geometric Mean':0,'Harmonic Mean':0, \ - 'Skewness':0,'Kurtosis':0, 'Minimum':0,'First Quartile':0, 'Median':0, \ - 'Third Quartile':0, 'Maximum':0, \ - 'Median Absolute Deviation':0,'Mode':0, \ - 'Interquartile Range':0, \ + self.all = {'N':'','Sum':0,'Mean':0,'Variance':0, + 'Standard Deviation':0,'Standard Error':0, + 'Sum of Squares':0,'Sum of Squared Devs':0, + 'Coefficient of Variation':0, + 'Range':0,'Number Missing':0, + 'Geometric Mean':0,'Harmonic Mean':0, + 'Skewness':0,'Kurtosis':0, 'Minimum':0,'First Quartile':0, 'Median':0, + 'Third Quartile':0, 'Maximum':0, + 'Median Absolute Deviation':0,'Mode':0, + 'Interquartile Range':0, 'Number of Unique Levels':0} self.Name = name self.all['Name']=self.Name - if len(inlist) == 0: + if not len(inlist): self.N = 0 self.sum = self.mean = self.sumsquares = self.minimum = self.maximum = self.median = 0 self.firstquartile = self.thirdquartile = self.mad = self.numberuniques = self.harmmean = 0 @@ -550,7 +550,7 @@ self.median = numpy.median(inlist) # median of ranks - useful in comparisons for KW & Friedmans ranklist = rankdata(self.sortlist) - if (self.N % 2): + if self.N % 2: self.medianranks = ranklist[(self.N + 1) / 2] else: self.medianranks = ranklist[self.N / 2] @@ -561,9 +561,9 @@ difflist.append(self.sortlist[i] - self.mean) self.mad = self.mad + (self.sortlist[i] - self.median) # harmonic mean being calculated here seeing we are looping over the data anyway! - if (self.sortlist[i] != 0.0): - self.harmmean = self.harmmean + (1.0/self.sortlist[i]) - if (self.harmmean != 0.0): + if self.sortlist[i] != 0.0: + self.harmmean += (1.0/self.sortlist[i]) + if self.harmmean != 0.0: self.harmmean = self.N / self.harmmean self.ssdevs = numpy.sum(map(squared, difflist)) self.geomean = reduce(multiply, difflist) @@ -592,13 +592,15 @@ self.stderr = self.stddev / math.sqrt(self.N) h = {} for n in inlist: - try: h[n] = h[n]+1 - except KeyError: h[n] = 1 + try: + h[n] += 1 + except KeyError: + h[n] = 1 a = map(lambda x: (x[1], x[0]), h.items()) self.mode = max(a)[1] if len(inlist) > 2: - if (self.N % 2): # EVEN number of rows + if self.N % 2: # EVEN number of rows self.firstquartile = self.sortlist[((self.N + 1) / 4) - 1] self.thirdquartile = self.sortlist[(3 * (self.N + 1) / 4) - 1] else: # ODD number of rows @@ -665,8 +667,7 @@ self.t = (self.d1.mean - usermean) / math.sqrt(svar*(1.0/self.d1.N)) except ZeroDivisionError: self.t = 0.0 - self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+ \ - self.t*self.t)) + self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+self.t*self.t)) self.all=[['t','df','probability'],[float('%.4f'%self.t), self.df, float('%1.6f'%self.prob)]] def OneSampleSignTest(self, data1, usermean): @@ -679,10 +680,10 @@ self.nplus=0 self.nminus=0 for i in range(len(data1)): - if (data1[i] < usermean): - self.nplus=self.nplus+1 - if (data1[i] > usermean): - self.nminus=self.nminus+1 + if data1[i] < usermean: + self.nplus += 1 + if data1[i] > usermean: + self.nminus += 1 self.ntotal = self.nplus + self.nminus try: self.z=(self.nplus-(self.ntotal/2)/math.sqrt(self.ntotal/2)) @@ -713,7 +714,7 @@ """This class performs a series of 2 sample statistical tests upon two sets of data. """ - def __init__(self, data1, data2, name1 = '', name2 = '', \ + def __init__(self, data1, data2, name1 = '', name2 = '', missing1=0,missing2=0): """ The __init__ method retrieves a full set of descriptive statistics @@ -732,12 +733,11 @@ Returns: t, df, prob """ self.df = (self.d1.N + self.d2.N) - 2 - svar = ((self.d1.N-1)*self.d1.samplevar+(self.d2.N-1)* \ + svar = ((self.d1.N-1)*self.d1.samplevar+(self.d2.N-1)* self.d2.samplevar)/float(self.df) - self.t = (self.d1.mean-self.d2.mean)/math.sqrt(svar* \ + self.t = (self.d1.mean-self.d2.mean)/math.sqrt(svar* (1.0/self.d1.N + 1.0/self.d2.N)) - self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+self.t* \ - self.t)) + self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+self.t*self.t)) self.all=[['t','df','probability'],[float('%.4f'%self.t), self.df, float('%1.6f'%self.prob)]] def TTestPaired(self, data1, data2): @@ -747,7 +747,7 @@ Usage: TTestPaired(data1, data2) Returns: t, df, prob """ - if (self.d1.N != self.d2.N): + if self.d1.N != self.d2.N: self.prob = -1.0 self.df = 0 self.t = 0.0 @@ -755,15 +755,13 @@ cov = 0.0 self.df = self.d1.N - 1 for i in range(self.d1.N): - cov = cov + ((data1[i] - self.d1.mean) * (data2[i] - \ - self.d2.mean)) - cov = cov / float(self.df) - sd = math.sqrt((self.d1.samplevar + self.d2.samplevar - 2.0 * \ + cov += ((data1[i] - self.d1.mean) * (data2[i] - self.d2.mean)) + cov /= float(self.df) + sd = math.sqrt((self.d1.samplevar + self.d2.samplevar - 2.0 * cov) / float(self.d1.N)) try: self.t = (self.d1.mean - self.d2.mean) / sd - self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+ \ - self.t*self.t)) + self.prob = betai(0.5*self.df,0.5,float(self.df)/(self.df+ self.t*self.t)) except ZeroDivisionError: self.t = -1.0 self.prob = 0.0 @@ -792,7 +790,7 @@ Usage: TwoSampleSignTest(data1, data2) Returns: nplus, nminus, ntotal, z, prob """ - if (self.d1.N != self.d2.N): + if self.d1.N != self.d2.N: self.z = 0.0 self.ntotal = 0 self.prob=-1.0 @@ -828,11 +826,11 @@ d1=data3[j1] d2=data4[j2] if d1 <= d2: - j1 = j1 + 1 - fn1 = (j1)/float(self.d1.N) + j1 += 1 + fn1 = j1 /float(self.d1.N) if d2 <= d1: - j2 = j2 + 1 - fn2 = (j2)/float(self.d2.N) + j2 += 1 + fn2 = j2 /float(self.d2.N) dt = (fn2-fn1) if math.fabs(dt) > math.fabs(self.d): self.d = dt @@ -878,7 +876,7 @@ d=[] for i in range(self.d1.N): diff = data1[i] - data2[i] - if diff != 0: + if diff: d.append(diff) count = len(d) absd = map(abs,d) @@ -911,7 +909,7 @@ self.bigu = max(u1,u2) self.smallu = min(u1,u2) T = math.sqrt(tiecorrect(ranked)) - if T == 0: + if not T: self.prob = -.10 self.z = -1.0 else: @@ -927,15 +925,15 @@ Returns: r, df, t, prob, slope, intercept, sterrest """ TINY = 1.0e-20 - if (self.d1.N != self.d2.N): + if self.d1.N != self.d2.N: self.prob = -1.0 self.t = 0.0 self.df = 0 else: summult = numpy.sum(map(multiply, x, y)) r_num = float(self.d1.N*summult - self.d1.sum*self.d2.sum) - r_den = math.sqrt((self.d1.N*self.d1.sumsquares - \ - (self.d1.sum**2))*(self.d2.N* \ + r_den = math.sqrt((self.d1.N*self.d1.sumsquares - + (self.d1.sum**2))*(self.d2.N* self.d2.sumsquares - (self.d2.sum**2))) try: self.r = r_num / r_den @@ -944,11 +942,9 @@ #[] warning - z not used - is there a line missing here? z = 0.5*math.log((1.0+self.r+TINY)/(1.0-self.r+TINY)) self.df = self.d1.N - 2 - self.t = self.r*math.sqrt(self.df/((1.0-self.r+TINY)*(1.0+ \ - self.r+TINY))) + self.t = self.r*math.sqrt(self.df/((1.0-self.r+TINY)*(1.0+ self.r+TINY))) self.prob = betai(0.5*self.df,0.5,self.df/(self.df+self.t*self.t)) - self.slope = r_num / float(self.d1.N*self.d1.sumsquares - \ - (self.d1.sum**2)) + self.slope = r_num / float(self.d1.N*self.d1.sumsquares - (self.d1.sum**2)) self.intercept = self.d2.mean - self.slope*self.d1.mean self.sterrest = math.sqrt(1-self.r*self.r)*math.sqrt \ (self.d2.variance) @@ -978,11 +974,11 @@ sum = 0 for i in range(self.d1.N): sum = sum + d[index[i]][i] - self.nperm = self.nperm + 1 - if (sum >= self.crit): - self.utail = self.utail + 1 + self.nperm += 1 + if sum >= self.crit: + self.utail += 1 for i in range((self.d1.N-1), 0, -1): - if (index[i] == 1): + if index[i] == 1: index[i] = 2 continue index[i] = 1 @@ -1003,7 +999,7 @@ else: self.chisq = 0.0 for i in range(self.df+1): - self.chisq = self.chisq+((x[i]-y[i])**2)/float(y[i]) + self.chisq+=((x[i]-y[i])**2)/float(y[i]) self.prob = chisqprob(self.chisq, self.df) self.all=[['chi','df','probability'],[float('%.4f'%self.chisq), self.df, float('%1.6f'%self.prob)]] @@ -1011,7 +1007,7 @@ """This class performs a series of correlations upon two sets of data. """ - def __init__(self, data1, data2, name1 = '', name2 = '', \ + def __init__(self, data1, data2, name1 = '', name2 = '', missing1=0,missing2=0): """ The __init__ method retrieves a full set of descriptive statistics @@ -1031,7 +1027,7 @@ Returns: r, t, df, prob """ TINY = 1.0e-60 - if (self.d1.N != self.d2.N): + if self.d1.N != self.d2.N: self.prob = -1.0 self.t = 0.0 self.df = 0 @@ -1043,10 +1039,8 @@ r_den = math.sqrt(r_left*r_right) self.r = r_num / r_den self.df = self.d1.N - 2 - self.t = self.r*math.sqrt(self.df/((1.0-self.r+TINY)* \ - (1.0+self.r+TINY))) - self.prob = betai(0.5*self.df,0.5,self.df/float \ - (self.df+self.t*self.t)) + self.t = self.r*math.sqrt(self.df/((1.0-self.r+TINY)*(1.0+self.r+TINY))) + self.prob = betai(0.5*self.df,0.5,self.df/float(self.df+self.t*self.t)) self.all=[['r','df','probability'],[float('%.4f'%self.r), self.df, float('%1.6f'%self.prob)]] def KendallsTau(self, data1, data2): @@ -1063,18 +1057,18 @@ a1 = data1[j] - data1[k] a2 = data2[j] - data2[k] aa = a1 * a2 - if (aa): # neither list has a tie - n1 = n1 + 1 - n2 = n2 + 1 + if aa: # neither list has a tie + n1 += 1 + n2 += 1 if aa > 0: - iss = iss + 1 + iss += 1 else: - iss = iss -1 + iss -= 1 else: - if (a1): - n1 = n1 + 1 + if a1: + n1 += 1 else: - n2 = n2 + 1 + n2 += 1 self.tau = iss / math.sqrt(n1*n2) svar = (4.0*self.d1.N+10.0) / (9.0*self.d1.N*(self.d1.N-1)) self.z = self.tau / math.sqrt(svar) @@ -1204,8 +1198,8 @@ k = len(means) self.SSwit = numpy.sum(ssdevs) for i in means: - self.SSbet = self.SSbet + ((i - GM) ** 2) - self.SSbet = self.SSbet * (GN / k) + self.SSbet += ((i - GM) ** 2) + self.SSbet *= (GN / k) self.SStot = self.SSwit + self.SSbet self.dfbet = int(k - 1) self.dferr = int(GN - k) @@ -1243,16 +1237,16 @@ rsums = [] for i in range(len(args)): rsums.append(sum(args[i])**2) - rsums[i] = rsums[i] / float(n[i]) + rsums[i] /= float(n[i]) ssbn = sum(rsums) totaln = sum(n) self.h = 12.0 / (totaln*(totaln+1)) * ssbn - 3*(totaln+1) self.df = len(args) - 1 - if T == 0: + if not T: self.h = 0.0 self.prob = 1.0 else: - self.h = self.h / float(T) + self.h /= float(T) self.prob = chisqprob(self.h,self.df) self.all = [['H','df','probability'],[float('%.4f'%self.h), self.df, float('%1.6f'%self.prob)]] @@ -1288,7 +1282,7 @@ sums = [] for i in range(k): tmp = sum(data2[i]) - ssbn = ssbn + (tmp ** 2) + ssbn += (tmp ** 2) sums.append(tmp/len(data2[i])) self.chisq = (12.0 / (k*n*(k+1))) * ssbn - 3*n*(k+1) self.df = k-1 @@ -1310,14 +1304,14 @@ g = 0 for j in range(n): g = g + inlist[i][j] - gtot = gtot + (g ** 2) + gtot += (g ** 2) l = lsq = 0 for i in range(n): rowsum = 0 for j in range(k): rowsum = rowsum + inlist[j][i] - l = l + rowsum - lsq = lsq + (rowsum ** 2) + l += rowsum + lsq += (rowsum ** 2) self.q = ((k-1)*((k*gtot)-(l**2)))/((k*l)-lsq) self.prob = chisqprob(self.q, self.df) self.all = [['Q','df','probability'],[float('%.4f'%self.q), @@ -1337,10 +1331,10 @@ self.outstr=self.outstr+'<br>Critical Value (>= for sig) = '+str(crit) for i in range(len(medians)): for j in range(i+1, len(medians)): - if (i != j): - self.outstr = self.outstr+'<br>'+str(i+1)+' against '+str(j+1) + if i != j: + self.outstr+='<br>'+str(i+1)+' against '+str(j+1) diff = abs(medians[i] - medians[j]) - self.outstr = self.outstr+' = '+str(diff) + self.outstr+=' = '+str(diff) class KWComp: """This class performs multiple comparisons on a Kruskal-Wallis @@ -1352,13 +1346,13 @@ crit = inversechi(p, k-1) value = crit * math.sqrt((k * (k + 1)) / (6 * n * k)) self.outstr = '<p>Multiple Comparisons for Friedman\'s test:</p>' - self.outstr=self.outstr+'<br>Critical Value (>= for sig) = '+str(crit) + self.o... [truncated message content] |
From: <mli...@us...> - 2011-10-30 04:28:59
|
Revision: 60 http://salstat.svn.sourceforge.net/salstat/?rev=60&view=rev Author: mlivingstone Date: 2011-10-30 04:28:53 +0000 (Sun, 30 Oct 2011) Log Message: ----------- Code indentation error caused chi square error. Also rearranged descriptive calculations to enable some tests to be done when only 2 values present - user beware descriptive results! Modified Paths: -------------- salstat_stats.py Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-10-29 05:15:52 UTC (rev 59) +++ salstat_stats.py 2011-10-30 04:28:53 UTC (rev 60) @@ -184,11 +184,11 @@ else: e = math.log(math.sqrt(math.pi)) c = math.log(a) - while (z <= chisq): - e = math.log(z) + e - s = s + ex(c*z-a-e) - z = z + 1.0 - return s + while (z <= chisq): + e = math.log(z) + e + s = s + ex(c*z-a-e) + z = z + 1.0 + return s else: if even: e = 1.0 @@ -507,29 +507,26 @@ self.Name = name self.all['Name']=self.Name -# if len(inlist) == 0: -# self.N = 0 -# self.sum = self.mean = self.sumsquares = self.minimum = self.maximum = self.median = 0 -# self.firstquartile = self.thirdquartile = self.mad = self.numberuniques = self.harmmean = 0 -# self.ssdevs = self.samplevar = self.geomean = self.variance = self.coeffvar = self.skewness = 0 -# self.range = self.interquartilerange = self.range = self.kurtosis = self.mode = 0 -# for i in self.all: -# self.all[i] = 0 -# elif len(inlist) == 1: -# self.N = self.numberuniques = 1 -# self.sum = self.mean = self.minimum = self.maximum = self.median = inlist[0] -# self.firstquartile = self.thirdquartile = self.mad = self.harmmean = self.geomean = inlist[0] -# self.samplevar = self.variance = self.coeffvar = self.skewness = self.mode = 0 -# self.range = self.interquartilerange = self.kurtosis = self.sumsquares = self.ssdevs = 0 -# # this needs working on - elegant solution please! - if len(inlist) <= 2: - wx.MessageBox("We need more than 2 valid data points in each used column", "Calculating Descriptive Statistics", wx.ICON_ERROR) - elif len(inlist) > 2: + if len(inlist) == 0: + self.N = 0 + self.sum = self.mean = self.sumsquares = self.minimum = self.maximum = self.median = 0 + self.firstquartile = self.thirdquartile = self.mad = self.numberuniques = self.harmmean = 0 + self.ssdevs = self.samplevar = self.geomean = self.variance = self.coeffvar = self.skewness = 0 + self.range = self.interquartilerange = self.range = self.kurtosis = self.mode = self.stddev = 0 + for i in self.all: + self.all[i] = 0 + elif len(inlist) == 1: + self.N = self.numberuniques = 1 + self.sum = self.mean = self.minimum = self.firstquartile = self.thirdquartile = self.maximum = self.median = inlist[0] + self.firstquartile = self.thirdquartile = self.mad = self.harmmean = self.geomean = inlist[0] + self.samplevar = self.variance = self.coeffvar = self.skewness = self.mode = self.stddev = 0 + self.range = self.missing = self.interquartilerange = 0 + self.kurtosis = self.sumsquares = self.ssdevs = self.stderr = 0 + # this needs working on - elegant solution please! + elif len(inlist) > 1: self.missing = missing self.N = len(inlist) - self.all['N'] = int(self.N) self.sum = numpy.sum(inlist) - self.all['Sum'] = self.sum #try: # self.mean = self.sum / float(self.N) #except ZeroDivisionError: @@ -550,16 +547,7 @@ self.harmmean=0.0 # first and third quartiles medianindex = self.N / 2 - if (self.N % 2): # EVEN number of rows - self.median = numpy.median(inlist) - self.firstquartile = self.sortlist[((self.N + 1) / 4) - 1] - self.thirdquartile = self.sortlist[(3 * (self.N + 1) / 4) - 1] - else: # ODD number of rows - self.median = numpy.median(inlist) - self.firstquartile = (self.sortlist[(self.N / 4) - 1] + self.sortlist[(self.N / 4)]) / 2.0 - self.thirdquartile = (self.sortlist[(3 * self.N / 4) - 1] + self.sortlist[3 * (self.N + 1) / 4]) / 2.0 - # interquartile range - self.interquartilerange = self.thirdquartile - self.firstquartile + self.median = numpy.median(inlist) # median of ranks - useful in comparisons for KW & Friedmans ranklist = rankdata(self.sortlist) if (self.N % 2): @@ -608,25 +596,41 @@ except KeyError: h[n] = 1 a = map(lambda x: (x[1], x[0]), h.items()) self.mode = max(a)[1] - self.all['Variance'] = float('%.4f'%self.variance) - self.all['Standard Deviation'] = float('%.4f'%self.stddev) - self.all['Standard Error'] = float('%.4f'%self.stderr) - self.all['Sum of Squared Devs'] = float('%.4f'%self.ssdevs) - self.all['Coefficient of Variation'] = float('%.4f'%self.coeffvar) - self.all['Number Missing'] = int(self.missing) - self.all['Geometric Mean'] = float('%.4f'%self.geomean) - self.all['Harmonic Mean'] = float('%.4f'%self.harmmean) - self.all['Skewness'] = float('%.4f'%self.skewness) - self.all['Kurtosis'] = float('%.4f'%self.kurtosis) - self.all['First Quartile'] = float('%.4f'%self.firstquartile) - self.all['Median'] = float('%.4f'%self.median) - self.all['Third Quartile'] = float('%.4f'%self.thirdquartile) - self.all['Median Absolute Deviation'] = float('%.4f'%self.mad) - self.all['Mode'] = float('%.4f'%self.mode) - self.all['Interquartile Range'] = float('%.4f'%self.interquartilerange) - self.all['Number of Unique Levels'] = int(self.numberuniques) - #return self.all + if len(inlist) > 2: + if (self.N % 2): # EVEN number of rows + self.firstquartile = self.sortlist[((self.N + 1) / 4) - 1] + self.thirdquartile = self.sortlist[(3 * (self.N + 1) / 4) - 1] + else: # ODD number of rows + self.firstquartile = (self.sortlist[(self.N / 4) - 1] + self.sortlist[(self.N / 4)]) / 2.0 + self.thirdquartile = (self.sortlist[(3 * self.N / 4) - 1] + self.sortlist[3 * (self.N + 1) / 4]) / 2.0 + # interquartile range + self.interquartilerange = self.thirdquartile - self.firstquartile + + self.all['Sum'] = float(self.sum) + self.all['N'] = int(self.N) + self.all['Variance'] = float('%.4f'%self.variance) + self.all['Standard Deviation'] = float('%.4f'%self.stddev) + self.all['Standard Error'] = float('%.4f'%self.stderr) + self.all['Sum of Squared Devs'] = float('%.4f'%self.ssdevs) + self.all['Coefficient of Variation'] = float('%.4f'%self.coeffvar) + self.all['Number Missing'] = int(self.missing) + self.all['Geometric Mean'] = float('%.4f'%self.geomean) + self.all['Harmonic Mean'] = float('%.4f'%self.harmmean) + self.all['Skewness'] = float('%.4f'%self.skewness) + self.all['Kurtosis'] = float('%.4f'%self.kurtosis) + self.all['First Quartile'] = float('%.4f'%self.firstquartile) + self.all['Median'] = float('%.4f'%self.median) + self.all['Third Quartile'] = float('%.4f'%self.thirdquartile) + self.all['Median Absolute Deviation'] = float('%.4f'%self.mad) + self.all['Mode'] = float('%.4f'%self.mode) + self.all['Interquartile Range'] = float('%.4f'%self.interquartilerange) + self.all['Number of Unique Levels'] = int(self.numberuniques) + + if len(inlist) < 3: + wx.MessageBox("We need more than 2 valid data points in each used column", "Calculating Descriptive Statistics", wx.ICON_HAND) + + class OneSampleTests: """ This class produces single factor statistical tests. @@ -702,6 +706,7 @@ except ZeroDivisionError: self.chisquare = 0.0 self.prob = chisqprob(self.chisquare, self.df) + print "prob =", self.prob self.all=[['chi','df','probability'],[float('%.4f'%self.chisquare),self.df, float('%1.6f'%self.prob)]] class TwoSampleTests: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-29 05:15:59
|
Revision: 59 http://salstat.svn.sourceforge.net/salstat/?rev=59&view=rev Author: mlivingstone Date: 2011-10-29 05:15:52 +0000 (Sat, 29 Oct 2011) Log Message: ----------- Test headings displayed on same line as results instead of above them. Modified Paths: -------------- dataObject.py salstat_stats.py Modified: dataObject.py =================================================================== --- dataObject.py 2011-10-29 04:23:16 UTC (rev 58) +++ dataObject.py 2011-10-29 05:15:52 UTC (rev 59) @@ -355,7 +355,7 @@ def SetComplex(self, data): tmp = ['<table border = "1" cellspacing = "0">'] for i in range(len(data)): - #tmp.append('<tr>') + tmp.append('<tr>') for j in range(len(data[i])): # should be the heading, therefore defining part of table try: tmp.append('<td>'+str(data[i][j])+'</td>') Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-10-29 04:23:16 UTC (rev 58) +++ salstat_stats.py 2011-10-29 05:15:52 UTC (rev 59) @@ -635,9 +635,9 @@ """ Pass the data to the init function. """ - #self.d1 = FullDescriptives(data1, name, missing) - # is the call to the FullDescriptives actually needed? - # try to get rid of any repeats + self.d1 = FullDescriptives(data1, name, missing) + # Call to FullDescriptives above needed so we can decouple Descriptives frame + # from Test frames. self.all = [] self.tests = [i for i in dir(self) if callable(getattr(self, i))] self.tests.pop(-1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-29 04:23:22
|
Revision: 58 http://salstat.svn.sourceforge.net/salstat/?rev=58&view=rev Author: mlivingstone Date: 2011-10-29 04:23:16 +0000 (Sat, 29 Oct 2011) Log Message: ----------- We require > 2 data points in each column before we calculate Descriptive Statistics. If any column has < 2 data points, we put up an explanatory MessageBox and still calculate other valid columns. Modified Paths: -------------- salstat_stats.py Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-10-29 02:58:27 UTC (rev 57) +++ salstat_stats.py 2011-10-29 04:23:16 UTC (rev 58) @@ -26,6 +26,8 @@ import math import copy +import wx + import numpy # Short routines used in the functional constructs to reduce analysis time @@ -504,22 +506,25 @@ 'Number of Unique Levels':0} self.Name = name self.all['Name']=self.Name - if len(inlist) == 0: - self.N = 0 - self.sum = self.mean = self.sumsquares = self.minimum = self.maximum = self.median = 0 - self.firstquartile = self.thirdquartile = self.mad = self.numberuniques = self.harmmean = 0 - self.ssdevs = self.samplevar = self.geomean = self.variance = self.coeffvar = self.skewness = 0 - self.range = self.interquartilerange = self.range = self.kurtosis = self.mode = 0 - for i in self.all: - self.all[i] = 0 - elif len(inlist) == 1: - self.N = self.numberuniques = 1 - self.sum = self.mean = self.minimum = self.maximum = self.median = inlist[0] - self.firstquartile = self.thirdquartile = self.mad = self.harmmean = self.geomean = inlist[0] - self.samplevar = self.variance = self.coeffvar = self.skewness = self.mode = 0 - self.range = self.interquartilerange = self.kurtosis = self.sumsquares = self.ssdevs = 0 - # this needs working on - elegant solution please! - elif len(inlist) > 1: + +# if len(inlist) == 0: +# self.N = 0 +# self.sum = self.mean = self.sumsquares = self.minimum = self.maximum = self.median = 0 +# self.firstquartile = self.thirdquartile = self.mad = self.numberuniques = self.harmmean = 0 +# self.ssdevs = self.samplevar = self.geomean = self.variance = self.coeffvar = self.skewness = 0 +# self.range = self.interquartilerange = self.range = self.kurtosis = self.mode = 0 +# for i in self.all: +# self.all[i] = 0 +# elif len(inlist) == 1: +# self.N = self.numberuniques = 1 +# self.sum = self.mean = self.minimum = self.maximum = self.median = inlist[0] +# self.firstquartile = self.thirdquartile = self.mad = self.harmmean = self.geomean = inlist[0] +# self.samplevar = self.variance = self.coeffvar = self.skewness = self.mode = 0 +# self.range = self.interquartilerange = self.kurtosis = self.sumsquares = self.ssdevs = 0 +# # this needs working on - elegant solution please! + if len(inlist) <= 2: + wx.MessageBox("We need more than 2 valid data points in each used column", "Calculating Descriptive Statistics", wx.ICON_ERROR) + elif len(inlist) > 2: self.missing = missing self.N = len(inlist) self.all['N'] = int(self.N) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-29 02:58:34
|
Revision: 57 http://salstat.svn.sourceforge.net/salstat/?rev=57&view=rev Author: mlivingstone Date: 2011-10-29 02:58:27 +0000 (Sat, 29 Oct 2011) Log Message: ----------- Introduced more rigorous checking of whether a column was being used. Previous code assumed a column was unused if there was no value in row one of the column and didn't check for further column use. Modified Paths: -------------- sal.py Modified: sal.py =================================================================== --- sal.py 2011-10-28 06:08:38 UTC (rev 56) +++ sal.py 2011-10-29 02:58:27 UTC (rev 57) @@ -253,12 +253,18 @@ def GetUsedCols(self): ColsUsed = [] colnums = [] - cols = self.GetNumberCols() - for i in range(cols): - dat = self.GetCellValue(0, i) - if (dat!=''): + dat = '' + tmp = 0 + for i in range(self.GetNumberCols()): + for j in range(self.GetNumberRows()): + dat = self.GetCellValue(j, i) + if dat != '': + tmp += 1 + if (tmp > 0): ColsUsed.append(self.GetColLabelValue(i)) colnums.append(i) + tmp = 0 + print ColsUsed, colnums return ColsUsed, colnums def GetColsUsedList(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-28 06:08:46
|
Revision: 56 http://salstat.svn.sourceforge.net/salstat/?rev=56&view=rev Author: mlivingstone Date: 2011-10-28 06:08:38 +0000 (Fri, 28 Oct 2011) Log Message: ----------- UI elements changed to look more like the elegant Mac Grey colour scheme used in Mac Excel and Pages. At this point hardcoded since we do not have any skinning interface - maybe in the medium to long term future? Modified Paths: -------------- dataObject.py sal.py Property Changed: ---------------- / Property changes on: ___________________________________________________________________ Modified: svn:ignore - .project + .project .idea .pydevproject Modified: dataObject.py =================================================================== --- dataObject.py 2011-10-28 00:22:52 UTC (rev 55) +++ dataObject.py 2011-10-28 06:08:38 UTC (rev 56) @@ -300,22 +300,22 @@ #self.output.SetComplex([]) # Can't (yet?) see need for this (blank) table insertion?! self.OutputResults(self.output) out = ['<p><b>Descriptive Statistics</b></p><br><table border = "1" cellspacing = "0">'] #table setup for first table - print("dataSources =", dataObject.dataSources) + #print("dataSources =", dataObject.dataSources) for i in range(0, len(dataObject.dataSources), 4): # 0 .. numColumnsOfStatistics % 4 - print("i =", i) + #print("i =", i) out.append('<tr>') # start heading table row d = [] - out.append('<br><td>Statistic</td>') # Row 1 Column 1 heading data + out.append('<br><td><b>Statistic</b></td>') # Row 1 Column 1 heading data for j in range(i, i+4): - print("j =", j) + #print("j =", j) if j < len(dataObject.dataSources): - print("columns selected =", dataObject.dataSources) # how many columns selected + #print("columns selected =", dataObject.dataSources) # how many columns selected _missing = dataObject.GetMissing(j) # how many missing values in the column? d.append(salstat_stats.FullDescriptives(dataObject.GetData(j), missing = _missing)) # add chosen statistic test - out.append('<td>'+str(dataObject.dataNames[j])+'</td>') # print column letter e.g. A, B, C, etc + out.append('<td><b>'+str(dataObject.dataNames[j])+'</b></td>') # print column letter e.g. A, B, C, etc out.append('</tr><tr>') # end of headings row / end of "j for block" for k in dataObject.descriptives: - out.append('<td>'+str(k)+'</td>') # print statistic name e.g. N, sum, min etc + out.append('<td><b>'+str(k)+'</b></td>') # print statistic name e.g. N, sum, min etc for l in d: if l <= len(d): out.append('<td>'+str(l.all[k])+'</td>') # print statistic values (e.g. all N) in a formatted table row Modified: sal.py =================================================================== --- sal.py 2011-10-28 00:22:52 UTC (rev 55) +++ sal.py 2011-10-28 06:08:38 UTC (rev 56) @@ -726,19 +726,23 @@ class VariablesFrame(wx.Dialog): def __init__(self,parent,id): wx.Dialog.__init__(self, parent,id,"SalStat - Variables", - size=(500,185+wind)) + size=(550,250)) #set icon for frame (needs x-platform separator!) icon = images.getIconIcon() self.SetIcon(icon) - okaybutton = wx.Button(self, 2001, "Okay",wx.Point(10,170), + okaybutton = wx.Button(self, 2001, "Set",wx.Point(10,170), wx.DefaultSize) cancelbutton = wx.Button(self, 2002, "Cancel",wx.Point(100,170), wx.DefaultSize) - self.vargrid = wx.grid.Grid(self,-1,size=(480,130),pos=(10,10)) + self.vargrid = wx.grid.Grid(self,-1,size=(535,128),pos=(10,10)) self.vargrid.SetRowLabelSize(120) self.vargrid.SetDefaultRowSize(27, True) maxcols = frame.grid.GetNumberCols() self.vargrid.CreateGrid(3,maxcols) + self.vargrid.SetDefaultCellAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) + self.vargrid.SetGridLineColour("#b7b7b7") + self.vargrid.SetLabelBackgroundColour("#d2d2d2") + self.vargrid.SetLabelTextColour("#444444") for i in range(maxcols): oldlabel = frame.grid.GetColLabelValue(i) self.vargrid.SetCellValue(0, i, oldlabel) @@ -965,7 +969,7 @@ def __init__(self, parent, id): wx.Dialog.__init__(self, parent, id, "Descriptive Statistics", - size=(500,400+wind)) + size=(500,400)) x = self.GetClientSize() winheight = x[1] icon = images.getIconIcon() @@ -977,7 +981,7 @@ #self.DescChoice = wx.Choice(self, 1107) #self.DescChoice = DescChoiceBox(self, 1107) self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), - wx.Size(230,(winheight * 0.8)), ColumnList) + wx.Size(230,(winheight * 0.75)), ColumnList) okaybutton = wx.Button(self,1103,"Okay",wx.Point(10,winheight-35), wx.DefaultSize) cancelbutton = wx.Button(self,1104,"Cancel",wx.Point(100,winheight-35), @@ -1310,8 +1314,15 @@ #still need to define event handlers #set up the datagrid self.grid = SimpleGrid(self, log) - self.grid.SetDefaultColSize(60, True) + self.grid.SetDefaultColSize(80, True) self.grid.SetRowLabelSize(40) + self.grid.SetDefaultCellAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTRE) + self.grid.SetColLabelAlignment(wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) + self.grid.SetGridLineColour("#b7b7b7") + self.grid.SetLabelBackgroundColour("#d2d2d2") + self.grid.SetLabelTextColour("#444444") + + #win2 = TestFrame(self, 'Tests') #win2.Show(True) #...and some events! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-28 00:22:59
|
Revision: 55 http://salstat.svn.sourceforge.net/salstat/?rev=55&view=rev Author: mlivingstone Date: 2011-10-28 00:22:52 +0000 (Fri, 28 Oct 2011) Log Message: ----------- pythonic updates, ui updates, initial margin and font size changes to maximise amount on screen and printout Modified Paths: -------------- dialogs.py menus.py miscClasses.py sal.py Modified: dialogs.py =================================================================== --- dialogs.py 2011-10-25 06:09:13 UTC (rev 54) +++ dialogs.py 2011-10-28 00:22:52 UTC (rev 55) @@ -34,17 +34,17 @@ self.label_2 = wx.StaticText(self, -1, "Select Test to Perform:") self.label_3 = wx.StaticText(self, -1, "Select Descriptive Statistics:") self.label_4 = wx.StaticText(self, -1, "User Mean:") - self.colsBox = wx.CheckListBox(self, 110, size=(230,60),choices=self.data.dataNames) - self.testBox = wx.CheckListBox(self, 111, size=(230,80), choices=self.data.tests) - self.descBox = wx.CheckListBox(self, 112, size=(240,210), choices=self.parent.ini.descriptivesList) - self.OkayButton = wx.Button(self, 101, "Run Test", size=(80,25)) + self.colsBox = wx.CheckListBox(self, 110, size=(240,60),choices=self.data.dataNames) + self.testBox = wx.CheckListBox(self, 111, size=(250,80), choices=self.data.tests) + self.descBox = wx.CheckListBox(self, 112, size=(240,490), choices=self.parent.ini.descriptivesList) + self.OkayButton = wx.Button(self, 101, "Run Tests", size=(80,25)) self.CancelButton = wx.Button(self, 102, "Cancel", size=(80,25)) - self.SelectAllButton = wx.Button(self, 103, "Select All",size=(80,25)) - self.SelectNoneButton = wx.Button(self, 104, "Select None",size=(80,25)) + self.SelectAllButton = wx.Button(self, 103, "Select All",size=(90,25)) + self.SelectNoneButton = wx.Button(self, 104, "Select None",size=(92,25)) self.userMean = wx.TextCtrl(self, 105) - self.hypChoice = wx.RadioBox(self, 106, "Select Hypothesis:",\ - wx.Point(10,270),wx.DefaultSize,HypList) - self.blank = wx.Panel(self, -1, size=(160,25)) + self.hypChoice = wx.RadioBox(self, 106, "Select Hypothesis:", + wx.Point(10,270),wx.DefaultSize,HypList) + self.blank = wx.Panel(self, -1, size=(80,50)) self.SetTitle(self.parent.testType.title) self.__do_layout() Modified: menus.py =================================================================== --- menus.py 2011-10-25 06:09:13 UTC (rev 54) +++ menus.py 2011-10-28 00:22:52 UTC (rev 55) @@ -25,6 +25,7 @@ self.ID_FILE_OPEN = wx.NewId() self.ID_FILE_SAVE = wx.NewId() self.ID_FILE_SAVEAS = wx.NewId() + self.ID_FILE_PAGESETUP = wx.NewId() self.ID_FILE_PRINT = wx.NewId() self.ID_FILE_CLOSE = wx.NewId() self.ID_FILE_EXIT = wx.NewId() @@ -155,8 +156,12 @@ file_menu.Append(self.ID_FILE_OPEN, '&Open...\tCtrl+O') file_menu.Append(self.ID_FILE_SAVE, '&Save\tCtrl+S') file_menu.Append(self.ID_FILE_SAVEAS, 'Save &As...') + file_menu.AppendSeparator() + file_menu.Append(self.ID_FILE_PAGESETUP, 'Page Setup...\tShift+Ctrl+P') file_menu.Append(self.ID_FILE_PRINT, '&Print...\tCtrl+P') #file_menu.Append(self.ID_FILE_CLOSE, '&Close') + file_menu.AppendSeparator() + #edit_menu.Append(self.ID_EDIT_CUT, 'Cu&t') edit_menu.Append(407, '&Copy\tCtrl+C') #edit_menu.Append(self.ID_EDIT_PASTE, '&Paste') Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-10-25 06:09:13 UTC (rev 54) +++ miscClasses.py 2011-10-28 00:22:52 UTC (rev 55) @@ -31,7 +31,7 @@ self.Saved = True self.moveTo = None self.SetGridLineColour(wx.BLACK) - self.CreateGrid(int(inits.get("gridcellsy")), \ + self.CreateGrid(int(inits.get("gridcellsy")), int(inits.get("gridcellsx"))) self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM) for i in range(20): @@ -66,7 +66,7 @@ data = 'range' # change this to coords self.tl self.br else: data = self.GetCellValue(currentrow, currentcol) - if (wx.TheClipboard.Open()): + if wx.TheClipboard.Open(): buffer.SetText(data) wx.TheClipboard.SetData(buffer) wx.TheClipboard.Close() @@ -80,7 +80,7 @@ # data = [2,3,4,5] #else: data = self.GetCellValue(currentrow, currentcol) - if (wx.TheClipboard.Open()): + if wx.TheClipboard.Open(): buffer.SetText(data) wx.TheClipboard.SetData(buffer) wx.TheClipboard.Close() @@ -177,7 +177,7 @@ inits.update({'savedir': dlg.GetDirectory()}) filename = dlg.GetPath() if not os.path.splitext(outputfilename) [1]: - outputfilename = outputfilename + '.dat' + outputfilename += '.dat' self.outputfilename = outputfilename fout = open(filename, "w") cols,waste = self.GetUsedCols() @@ -202,7 +202,7 @@ elif (dlg.GetFilterIndex() == 1): # save as native format print "cannot do this just yet!" - fout.close + fout.close() self.Saved = True def SaveDataASCII(self, event): @@ -222,7 +222,7 @@ else: return""" if not os.path.splitext(filename) [1]: - filename = filename + '.dat' + filename += '.dat' self.filename = filename fout = open(filename, "w") cols, waste = self.GetUsedCols() @@ -238,15 +238,15 @@ line = string.join(datapoint) fout.write(line) fout.write('\n') - fout.close + fout.close() self.Saved = True # Loads an ASCII data file - only with all datapoints filled though! # also does csv values as well def LoadDataASCII(self, event): default = inits.get('opendir') - dlg = wx.FileDialog(self, "Load Data File", default,"",\ - self.wildcard, wx.OPEN) + dlg = wx.FileDialog(self, "Load Data File", default,"", + self.wildcard, wx.OPEN) #SalStat Native (*.xml)|*.xml|", wx.OPEN) icon = images.getIconIcon() dlg.SetIcon(icon) @@ -271,7 +271,7 @@ self.AddNCells(NumberCols, 0) for j in range(len(words)): self.SetCellValue(gridline, j, words[j]) - gridline = gridline + 1 + gridline += 1 if (gridline == self.GetNumberRows()): self.AddNCells(0,10) fin.close() @@ -372,14 +372,14 @@ pass if (line == ''): break - dataheight = dataheight + 1 + dataheight += 1 gridwidth = self.GetNumberCols() gridheight = self.GetNumberRows() if (datawidth > gridwidth): self.AddNCols(-1, (datawidth - gridwidth + 5)) if (dataheight > gridheight): self.AddNRows(-1, (dataheight - gridheight + 5)) - fin.close + fin.close() fin = open(filename, "r") currentrow = 0 for i in range(dataheight): @@ -390,7 +390,7 @@ words = string.split(line) for i in range(len(words)): self.SetCellValue(currentrow, i, words[i]) - currentrow = currentrow + 1 + currentrow += 1 elif filename[-3:] == 'npy': p = pickle.Unpickler(fin) dataset = p.load() @@ -437,7 +437,7 @@ if (value != missingvalue): indata.append(value) else: - self.missing = self.missing + 1 + self.missing += 1 except ValueError: pass return indata @@ -449,7 +449,7 @@ for i in range(len(numcols)): smalllist = frame.grid.CleanData(numcols[i]) biglist.append(smalllist) - return numpy.array((biglist)) + return numpy.array(biglist) class HtmlFrame(wx.html.HtmlWindow): def __init__(self, parent, id): @@ -484,8 +484,8 @@ self.Addhtml(TextIn) def LoadHtmlPage(self, event): - dlg = wx.FileDialog(self, "Load Output File", "","","*.html|*.*", \ - wx.OPEN) + dlg = wx.FileDialog(self, "Load Output File", "","","*.html|*.*", + wx.OPEN) if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() self.LoadPage(outputfilename) @@ -496,7 +496,7 @@ if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() if not os.path.splitext(outputfilename) [1]: - outputfilename = outputfilename + '.html' + outputfilename += '.html' self.outputfilename = outputfilename fout = open(outputfilename, "w") fout.write(self.WholeOutString) Modified: sal.py =================================================================== --- sal.py 2011-10-25 06:09:13 UTC (rev 54) +++ sal.py 2011-10-28 00:22:52 UTC (rev 55) @@ -53,7 +53,7 @@ class SaveDialog(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, "Save Data?", \ + wx.Dialog.__init__(self, parent, id, "Save Data?", size=(306,140)) icon = images.getIconIcon() self.SetIcon(icon) @@ -112,7 +112,7 @@ self.tl = (0,0) self.br = (0,0) self.SetGridLineColour(wx.BLACK) - self.CreateGrid(int(ini.userVals.get("gridcellsy")), \ + self.CreateGrid(int(ini.userVals.get("gridcellsy")), int(ini.userVals.get("gridcellsx"))) self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM) for i in range(20): @@ -166,7 +166,7 @@ data = ''.join(copy) else: data = self.GetCellValue(currentrow, currentcol) - if (wx.TheClipboard.Open()): + if wx.TheClipboard.Open(): buffer.SetText(data) wx.TheClipboard.SetData(buffer) wx.TheClipboard.Close() @@ -188,7 +188,7 @@ currentrow = self.GetGridCursorRow() data = self.GetCellValue(currentrow, currentcol) data = data[:-1] - if (wx.TheClipboard.Open()): + if wx.TheClipboard.Open(): buffer.SetText(data) wx.TheClipboard.SetData(buffer) wx.TheClipboard.Close() @@ -283,8 +283,8 @@ def SaveAsDataASCII(self, event): default = ini.userVals.get('savedir') - dlg = wx.FileDialog(self, "Save Data File", default,"",\ - "ASCII Text (*.dat)|*.dat", wx.SAVE | wx.OVERWRITE_PROMPT) + dlg = wx.FileDialog(self, "Save Data File", default,"", + "ASCII Text (*.dat)|*.dat", wx.SAVE | wx.OVERWRITE_PROMPT) #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE | wx.OVERWRITE_PROMPT) icon = images.getIconIcon() dlg.SetIcon(icon) @@ -292,7 +292,7 @@ ini.userVals.update({'savedir': dlg.GetDirectory()}) filename = dlg.GetPath() if not os.path.splitext(filename) [1]: - filename = filename + '.dat' + filename += '.dat' ini.filename = filename fout = open(ini.filename, "w") cols,waste = self.GetUsedCols() @@ -337,7 +337,7 @@ else: return""" if not os.path.splitext(ini.filename) [1]: - ini.filename = ini.filename + '.dat' + ini.filename += '.dat' fout = open(ini.filename, "w") cols, waste = self.GetUsedCols() rows = self.GetUsedRows() @@ -359,8 +359,8 @@ # also does csv values as well def LoadDataASCII(self, event): default = ini.userVals.get('opendir') - dlg = wx.FileDialog(self, "Load Data File", '/home/alan',"",\ - self.wildcard, wx.OPEN) + dlg = wx.FileDialog(self, "Load Data File", '~',"", + self.wildcard, wx.OPEN) #"SalStat Native (*.xml)|*.xml|", wx.OPEN) icon = images.getIconIcon() dlg.SetIcon(icon) @@ -461,7 +461,7 @@ for i in range(self.GetNumberRows()): datapoint = self.GetCellValue(i, col) if (datapoint == '.') or (datapoint == 'NA'): - self.missing = self.missing + 1 + self.missing += 1 else: pass missing = self.missing @@ -489,14 +489,14 @@ for i in range(len(numcols)): smalllist = frame.grid.CleanData(numcols[i]) biglist.append(smalllist) - return numpy.array((biglist)) + return numpy.array(biglist) #--------------------------------------------------------------------------- # base class for getting number of columns/rows to add class EditGridFrame(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, "Change Grid Size", \ - size=(205, 100+wind)) + wx.Dialog.__init__(self, parent, id, "Change Grid Size", + size=(205, 100+wind)) icon = images.getIconIcon() self.SetIcon(icon) l1 = wx.StaticText(self, -1, 'Add Column(s)',pos=(10,15)) @@ -507,9 +507,9 @@ self.numnewRows = wx.SpinCtrl(self, -1, "", wx.Point(110, 50), wx.Size(80,25)) self.numnewRows.SetRange(0, 100) self.numnewRows.SetValue(0) - okaybutton = wx.Button(self, 421, "Okay", wx.Point(10, 90),\ + okaybutton = wx.Button(self, 421, "Okay", wx.Point(10, 90), wx.DefaultSize) - cancelbutton = wx.Button(self, 422, "Cancel", wx.Point(110,90), \ + cancelbutton = wx.Button(self, 422, "Cancel", wx.Point(110,90), wx.DefaultSize) wx.EVT_BUTTON(self, 421, self.OkayButtonPressed) wx.EVT_BUTTON(self, 422, self.CancelButtonPressed) @@ -527,7 +527,7 @@ # grid preferences - set row & col sizes class GridPrefs(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, "Cell Size", \ + wx.Dialog.__init__(self, parent, id, "Cell Size", size=(205,100+wind)) icon = images.getIconIcon() self.SetIcon(icon) @@ -539,9 +539,9 @@ self.rowheight.SetValue(frame.grid.GetDefaultRowSize()) l1 = wx.StaticText(self, -1, 'Column Width:',pos=(10,15)) l2 = wx.StaticText(self, -1, 'Row Height:',pos=(10,55)) - okaybutton = wx.Button(self, 321, "Okay", wx.Point(10, 90), \ + okaybutton = wx.Button(self, 321, "Okay", wx.Point(10, 90), wx.DefaultSize) - cancelbutton = wx.Button(self, 322, "Cancel", wx.Point(110,90),\ + cancelbutton = wx.Button(self, 322, "Cancel", wx.Point(110,90), wx.DefaultSize) wx.EVT_BUTTON(self, 321, self.OkayButtonPressed) wx.EVT_BUTTON(self, 322, self.OnCloseGridPrefs) @@ -563,7 +563,7 @@ dimy = int(ini.userVals.get('scriptsizey')) posx = int(ini.userVals.get('scriptposx')) posy = int(ini.userVals.get('scriptposy')) - wx.Frame.__init__(self, parent, id, "Scripting Window", \ + wx.Frame.__init__(self, parent, id, "Scripting Window", size=(dimx, dimy), pos=(posx,posy)) #set icon for frame (needs x-platform separator!) icon = images.getIconIcon() @@ -624,8 +624,8 @@ # the open script method needs work def OpenScript(self, event): default = inits.get('opendir') - dlg = wx.FileDialog(self, "Open Script File",default,"",\ - "Any (*)|*",wx.OPEN) + dlg = wx.FileDialog(self, "Open Script File",default,"", + "Any (*)|*",wx.OPEN) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() fin = file(filename, "r") @@ -636,7 +636,7 @@ def SaveScriptAs(self, event): default = ini.userVals.get('savedir') - dlg = wx.FileDialog(self, "Save Script File", default,"",\ + dlg = wx.FileDialog(self, "Save Script File", default,"", "Any (*)|*", wx.SAVE | wx.OVERWRITE_PROMPT) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() @@ -656,8 +656,8 @@ dimy = int(ini.userVals.get('scriptsizey')) posx = int(ini.userVals.get('scriptposx')) posy = int(ini.userVals.get('scriptposy')) - wx.Frame.__init__(self, parent, id, "About SalStat", \ - size=(dimx, dimy), pos=(posx, posy)) + wx.Frame.__init__(self, parent, id, "About SalStat", + size=(dimx, dimy), pos=(posx, posy)) icon = images.getIconIcon() self.SetIcon(icon) GoIcon = images.getApplyBitmap() @@ -725,16 +725,16 @@ class VariablesFrame(wx.Dialog): def __init__(self,parent,id): - wx.Dialog.__init__(self, parent,id,"SalStat - Variables", \ - size=(500,185+wind)) + wx.Dialog.__init__(self, parent,id,"SalStat - Variables", + size=(500,185+wind)) #set icon for frame (needs x-platform separator!) icon = images.getIconIcon() self.SetIcon(icon) - okaybutton = wx.Button(self, 2001, "Okay",wx.Point(10,170),\ + okaybutton = wx.Button(self, 2001, "Okay",wx.Point(10,170), + wx.DefaultSize) + cancelbutton = wx.Button(self, 2002, "Cancel",wx.Point(100,170), wx.DefaultSize) - cancelbutton = wx.Button(self, 2002, "Cancel",wx.Point(100,170),\ - wx.DefaultSize) - self.vargrid = wx.Grid(self,-1,size=(480,130),pos=(10,10)) + self.vargrid = wx.grid.Grid(self,-1,size=(480,130),pos=(10,10)) self.vargrid.SetRowLabelSize(120) self.vargrid.SetDefaultRowSize(27, True) maxcols = frame.grid.GetNumberCols() @@ -807,7 +807,7 @@ self.parent.SetFocus() def LoadHtmlPage(self, event): - dlg = wx.FileDialog(self, "Load Output File", "","","*.html|*.*", \ + dlg = wx.FileDialog(self, "Load Output File", "","","*.html|*.*", wx.OPEN) if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() @@ -819,7 +819,7 @@ if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() if not os.path.splitext(outputfilename) [1]: - outputfilename = outputfilename + '.html' + outputfilename += '.html' self.outputfilename = outputfilename fout = open(self.outputfilename, "w") fout.write(self.WholeOutString) @@ -830,7 +830,7 @@ def PrintHtmlPage(self, event): dlg = wx.PrintDialog(self) if dlg.ShowModal() == wx.ID_OK: - dlg.destroy() + dlg.Destroy() def CopyData(self, event): buffer = wx.TextDataObject() @@ -860,7 +860,7 @@ posx = int(ini.userVals.get('outputposx')) posy = int(ini.userVals.get('outputposy')) - wx.Frame.__init__(self, parent, -1, "SalStat Statistics - Output", \ + wx.Frame.__init__(self, parent, -1, "SalStat Statistics - Output", size=(dimx, dimy), pos=(posx, posy)) # get menu bar menuBar = menus.menu() @@ -902,8 +902,10 @@ wx.EVT_CLOSE(self, self.DoNothing) wx.EVT_MENU(self, menuBar.ID_FILE_NEW, self.ClearAll) wx.EVT_TOOL(self, 401, self.ClearAll) - wx.EVT_MENU(self, menuBar.ID_FILE_PRINT, self.PrintOutput) - wx.EVT_TOOL(self, 404, self.PrintOutput) + wx.EVT_MENU(self, menuBar.ID_FILE_PAGESETUP, self.OnPageSetup) + wx.EVT_TOOL(self, 404, self.OnPageSetup) + wx.EVT_MENU(self, menuBar.ID_FILE_PRINT, self.OnPrintOutput) + wx.EVT_TOOL(self, 404, self.OnPrintOutput) wx.EVT_MENU(self, menuBar.ID_FILE_OPEN, self.htmlpage.LoadHtmlPage) wx.EVT_TOOL(self, 402, self.htmlpage.LoadHtmlPage) wx.EVT_MENU(self, 407, self.htmlpage.CopyData) @@ -914,18 +916,41 @@ wx.EVT_MENU(self, menuBar.ID_HELP_TOPICS, frame.GoHelpTopicsFrame) wx.EVT_MENU(self, menuBar.ID_HELP_LICENCE, frame.GoHelpLicenceFrame) + self.pdata = wx.PrintData() + self.pdata.SetPaperId(wx.PAPER_A4) + self.pdata.SetOrientation(wx.PORTRAIT) + self.margins = (wx.Point(10, 10), wx.Point(10, 10)) - def PrintOutput(self, event): - data = wx.PrintDialogData() + def OnPageSetup(self, event): + data = wx.PageSetupDialogData() + data.SetPrintData(self.pdata) + data.SetDefaultMinMargins(True) + data.SetMarginTopLeft(self.margins[0]) + data.SetMarginBottomRight(self.margins[1]) + dlg = wx.PageSetupDialog(self, data) + if dlg.ShowModal() == wx.ID_OK: + data = dlg.GetPageSetupData() + self.pdata = wx.PrintData(data.GetPrintData()) + self.pdata.SetPaperId(data.GetPaperId()) + self.margins = (data.GetMarginTopLeft(), + data.GetMarginBottomRight()) + dlg.Destroy() + + def OnPrintOutput(self, event): + data = wx.PrintDialogData(self.pdata) + printer = wx.Printer(data) data.EnablePrintToFile(True) data.EnablePageNumbers(True) data.EnableSelection(True) + data.EnableHelp(True) + useSetupDialog = True dlg = wx.PrintDialog(output, data) if dlg.ShowModal() == wx.ID_OK: #print out html + self.printer.SetFonts("calibri", "menlo") self.printer.PrintText(self.htmlpage.WholeOutString) dlg.Destroy() - + def DoNothing(self, event): pass @@ -938,9 +963,9 @@ # user selects which cols to analyse, and what stats to have class DescriptivesFrame(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, \ - "Descriptive Statistics", \ - size=(500,400+wind)) + wx.Dialog.__init__(self, parent, id, + "Descriptive Statistics", + size=(500,400+wind)) x = self.GetClientSize() winheight = x[1] icon = images.getIconIcon() @@ -951,23 +976,23 @@ l4 = wx.StaticText(self,-1,"Select Descriptive Statistics:",pos=(250,10)) #self.DescChoice = wx.Choice(self, 1107) #self.DescChoice = DescChoiceBox(self, 1107) - self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), \ - wx.Size(230,(winheight * 0.8)), ColumnList) - okaybutton = wx.Button(self,1103,"Okay",wx.Point(10,winheight-35),\ - wx.DefaultSize) - cancelbutton = wx.Button(self,1104,"Cancel",wx.Point(100,winheight-35),\ - wx.DefaultSize) + self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), + wx.Size(230,(winheight * 0.8)), ColumnList) + okaybutton = wx.Button(self,1103,"Okay",wx.Point(10,winheight-35), + wx.DefaultSize) + cancelbutton = wx.Button(self,1104,"Cancel",wx.Point(100,winheight-35), + wx.DefaultSize) if wx.Platform == '__WXMSW__': # Darn! Some cross-platform voodoo needed... - allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-70),\ - wx.DefaultSize) - nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-70),\ - wx.DefaultSize) + allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-70), + wx.DefaultSize) + nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-70), + wx.DefaultSize) else: - allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-50),\ - wx.DefaultSize) - nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-50),\ - wx.DefaultSize) + allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-50), + wx.DefaultSize) + nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-50), + wx.DefaultSize) wx.EVT_BUTTON(okaybutton, 1103, self.OnOkayButton) wx.EVT_BUTTON(cancelbutton, 1104, self.OnCloseContDesc) #wx.EVT_BUTTON(allbutton, 105, self.DescChoice.SelectAllDescriptives) @@ -978,9 +1003,9 @@ for i in range(len(self.colnums)): if self.ColChoice.IsChecked(i): name = frame.grid.GetColLabelValue(i) - descs.append(salstat_stats.FullDescriptives( \ - frame.grid.CleanData(i), name, \ - frame.grid.missing)) + descs.append(salstat_stats.FullDescriptives( + frame.grid.CleanData(i), name, + frame.grid.missing)) #ManyDescriptives(self, descs) self.Close(True) @@ -991,8 +1016,8 @@ # Same as DescriptivesContinuousFrame, but for nominal descriptives class MFanovaFrame(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, "Multi-Factorial Anova", \ - size=(500,400+wind)) + wx.Dialog.__init__(self, parent, id, "Multi-Factorial Anova", + size=(500,400+wind)) #set icon for frame (needs x-platform separator! x = self.GetClientSize() winheight = x[1] @@ -1003,26 +1028,26 @@ l1 = wx.StaticText(self, -1, "Select IV:", pos=(10,60)) l2 = wx.StaticText(self, -1, "Select DV:", pos=(10,170)) l4 = wx.StaticText(self,-1,"Select Descriptive Statistics:",pos=(250,10)) - self.IVbox = wx.CheckListBox(self, 413,wx.Point(10,30),\ - wx.Size(230,130),ColumnList) - self.DVbox = wx.CheckListBox(self, 414,wx.Point(10,190), \ - wx.Size(230,120),ColumnList) - self.hypchoice=wx.RadioBox(self, 205,"Select Hypothesis:",\ - wx.Point(10,320),wx.DefaultSize,HypList) + self.IVbox = wx.CheckListBox(self, 413,wx.Point(10,30), + wx.Size(230,130),ColumnList) + self.DVbox = wx.CheckListBox(self, 414,wx.Point(10,190), + wx.Size(230,120),ColumnList) + self.hypchoice=wx.RadioBox(self, 205,"Select Hypothesis:", + wx.Point(10,320),wx.DefaultSize,HypList) self.hypchoice.SetSelection(1) #self.DescChoice = DescChoiceBox(self, 215) # I might leave the descriptives out and implement a feedback box # that tells the user about the analysis (eg, how many factors, # # levels per factor, # interactions etc which might be useful. It # would be updated whenever the user changes a selection. - okaybutton = wx.Button(self,216,"Okay",wx.Point(10,winheight-35), \ - wx.DefaultSize) - cancelbutton = wx.Button(self,217,"Cancel",wx.Point(100,winheight-35), \ - wx.DefaultSize) - allbutton = wx.Button(self, 218,"Select All",wx.Point(250,winheight-70),\ - wx.DefaultSize) - nonebutton = wx.Button(self, 220, "Select None", wx.Point(360, \ - winheight-70),wx.DefaultSize) + okaybutton = wx.Button(self,216,"Okay",wx.Point(10,winheight-35), + wx.DefaultSize) + cancelbutton = wx.Button(self,217,"Cancel",wx.Point(100,winheight-35), + wx.DefaultSize) + allbutton = wx.Button(self, 218,"Select All",wx.Point(250,winheight-70), + wx.DefaultSize) + nonebutton = wx.Button(self, 220, "Select None", wx.Point(360, + winheight-70),wx.DefaultSize) self.DescChoice = DescChoiceBox(self, 104) wx.EVT_BUTTON(okaybutton, 216, self.OnOkayButton) wx.EVT_BUTTON(cancelbutton, 217, self.OnCloseTwoCond) @@ -1068,8 +1093,8 @@ #--------------------------------------------------------------------------- class TransformFrame(wx.Dialog): def __init__(self, parent, id): - wx.Dialog.__init__(self, parent, id, "Transformations", \ - size=(500,400+wind)) + wx.Dialog.__init__(self, parent, id, "Transformations", + size=(500,400+wind)) #set icon for frame (needs x-platform separator! x = self.GetClientSize() winheight = x[1] @@ -1080,22 +1105,22 @@ self.ColumnList, self.colnums = frame.grid.GetUsedCols() self.cols = frame.grid.GetNumberCols() l0 = wx.StaticText(self,-1,"Select Column(s) to Transform:",pos=(10,10)) - self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), \ - wx.DefaultSize, self.ColumnList) - okaybutton = wx.Button(self,1105,"Okay",wx.Point(10,winheight-35),\ - wx.DefaultSize) - cancelbutton = wx.Button(self,1106,"Cancel",wx.Point(100,winheight-35),\ - wx.DefaultSize) + self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), + wx.DefaultSize, self.ColumnList) + okaybutton = wx.Button(self,1105,"Okay",wx.Point(10,winheight-35), + wx.DefaultSize) + cancelbutton = wx.Button(self,1106,"Cancel",wx.Point(100,winheight-35), + wx.DefaultSize) # common transformations: l1 = wx.StaticText(self, -1, "Common Transformations:", pos=(250,30)) - squareRootButton = wx.Button(self, 1110, "Square Root", wx.Point(250, 60), \ - wx.DefaultSize) - logButton = wx.Button(self, 1111, "Logarithmic",wx.Point(250, 100), \ - wx.DefaultSize) - reciprocalButton = wx.Button(self, 1112, "Reciprocal", wx.Point(250,140), \ - wx.DefaultSize) - squareButton = wx.Button(self, 1113, "Square", wx.Point(250,180), \ - wx.DefaultSize) + squareRootButton = wx.Button(self, 1110, "Square Root", wx.Point(250, 60), + wx.DefaultSize) + logButton = wx.Button(self, 1111, "Logarithmic",wx.Point(250, 100), + wx.DefaultSize) + reciprocalButton = wx.Button(self, 1112, "Reciprocal", wx.Point(250,140), + wx.DefaultSize) + squareButton = wx.Button(self, 1113, "Square", wx.Point(250,180), + wx.DefaultSize) l2 = wx.StaticText(self, -1, "Function:", wx.Point(250, 315)) self.transformEdit = wx.TextCtrl(self,1114,pos=(250,335),size=(150,20)) wx.EVT_BUTTON(okaybutton, 1105, self.OnOkayButton) @@ -1151,7 +1176,7 @@ oldHead = frame.grid.GetColLabelValue(self.colnums[i]) if self.transformName == "": self.transformName = ' ' + self.transform - oldHead = oldHead + self.transformName + oldHead += self.transformName frame.grid.SetColLabelValue(emptyCols[i], oldHead) emptyCols.pop(emptyCols[i]) self.Close(True) @@ -1164,7 +1189,7 @@ # This frame holds the plots using the wx.PlotCanvas widget class PlotFrame(wx.Frame): def __init__(self, parent, log): - wx.Frame.__init__(self, parent, -1,"SalStat Plot (Basic!)", \ + wx.Frame.__init__(self, parent, -1,"SalStat Plot (Basic!)", size=(500,400)) file_menu = wx.Menu() edit_menu = wx.Menu() @@ -1203,7 +1228,7 @@ dlg = wx.TextEntryDialog(self, 'Enter the graph title','Graph Title') dlg.SetValue(self.client.getTitle()) # the previous line doesn't work. - if dlg.ShowModal() == wxID_OK: + if dlg.ShowModal() == wx.ID_OK: self.client.setTitle(dlg.GetValue()) def SetXAxis(self, event): @@ -1338,7 +1363,7 @@ def GoClearData(self, evt): #shows a new data entry frame - if self.grid.Saved == False: + if not self.grid.Saved: win = SaveDialog(self, -1) win.Show(True) else: @@ -1353,8 +1378,8 @@ # Shows the find & replace dialog # NOTE - this doesn't appear to work on the grid, so I might be missing something... data = wx.FindReplaceData() - dlg = wx.FindReplaceDialog(self.grid, data, 'Find and Replace', \ - wx.FR_REPLACEDIALOG) + dlg = wx.FindReplaceDialog(self.grid, data, 'Find and Replace', + wx.FR_REPLACEDIALOG) dlg.data = data dlg.Show(True) @@ -1377,14 +1402,16 @@ def GoFontPrefsDialog(self, evt): # shows Font dialog for the data grid (output window has its own) - data = wx.FontData() - dlg = wx.FontDialog(frame, data) + dlg = wx.FontDialog(self, wx.FontData()) icon = images.getIconIcon() self.SetIcon(icon) if dlg.ShowModal() == wx.ID_OK: data = dlg.GetFontData() - #data2 = data.GetChosenFont() - self.grid.SetDefaultCellFont(data.GetChosenFont()) + font = data.GetChosenFont() + colour = data.GetColour() + self.grid.SetDefaultCellFont(font) + self.grid.SetDefaultCellTextColour(colour) + dlg.Destroy() def GoContinuousDescriptives(self, evt): # shows the continuous descriptives dialog @@ -1532,7 +1559,7 @@ for i in range(len(initskeys)): fout.write(str(initskeys[i])+' '+str(initsvalues[i])+'\n') fout.close() - if self.grid.Saved == False: + if not self.grid.Saved: win = SaveDialog(self, -1) win.Show(True) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-25 06:09:19
|
Revision: 54 http://salstat.svn.sourceforge.net/salstat/?rev=54&view=rev Author: mlivingstone Date: 2011-10-25 06:09:13 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Remove extraneous duplicate FullDescriptives invocation Modified Paths: -------------- salstat_stats.py Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-10-25 05:59:12 UTC (rev 53) +++ salstat_stats.py 2011-10-25 06:09:13 UTC (rev 54) @@ -630,7 +630,7 @@ """ Pass the data to the init function. """ - self.d1 = FullDescriptives(data1, name, missing) + #self.d1 = FullDescriptives(data1, name, missing) # is the call to the FullDescriptives actually needed? # try to get rid of any repeats self.all = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-25 05:59:19
|
Revision: 53 http://salstat.svn.sourceforge.net/salstat/?rev=53&view=rev Author: mlivingstone Date: 2011-10-25 05:59:12 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Update to Lyx 2.0.1 Modified Paths: -------------- manual/manual.lyx Modified: manual/manual.lyx =================================================================== --- manual/manual.lyx 2011-10-11 10:21:46 UTC (rev 52) +++ manual/manual.lyx 2011-10-25 05:59:12 UTC (rev 53) @@ -1,5 +1,5 @@ -#LyX 1.6.7 created this file. For more info see http://www.lyx.org/ -\lyxformat 345 +#LyX 2.0 created this file. For more info see http://www.lyx.org/ +\lyxformat 413 \begin_document \begin_header \textclass book @@ -7,18 +7,26 @@ \makeatother \end_preamble \use_default_options false +\maintain_unincluded_children false \language english +\language_package default \inputencoding latin1 +\fontencoding global \font_roman default \font_sans default \font_typewriter default \font_default_family default +\use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default +\default_output_format default +\output_sync 0 +\bibtex_command default +\index_command default \paperfontsize default \spacing single \use_hyperref false @@ -26,9 +34,18 @@ \use_geometry false \use_amsmath 0 \use_esint 0 +\use_mhchem 1 +\use_mathdots 1 \cite_engine basic \use_bibtopic false +\use_indices false \paperorientation portrait +\suppress_date false +\use_refstyle 0 +\index Index +\shortcut idx +\color #008000 +\end_index \secnumdepth 5 \tocdepth 3 \paragraph_separation skip @@ -39,8 +56,9 @@ \paperpagestyle default \tracking_changes false \output_changes false -\author "" -\author "" +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false \end_header \begin_body @@ -50,7 +68,7 @@ \end_layout \begin_layout Author -© 2002 - 2010 Alan James Salmoni & Mark Livingstone +© 2002 - 2011 Alan James Salmoni & Mark Livingstone \end_layout \begin_layout Standard @@ -1695,8 +1713,10 @@ \begin_layout Standard \emph on -\begin_inset Formula \[ -\chi^{2}=\Sigma\frac{(observed\ count-expected\ count)^{2}}{expected\ count}\] +\begin_inset Formula +\[ +\chi^{2}=\Sigma\frac{(observed\ count-expected\ count)^{2}}{expected\ count} +\] \end_inset This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-10-11 10:21:57
|
Revision: 52 http://salstat.svn.sourceforge.net/salstat/?rev=52&view=rev Author: mlivingstone Date: 2011-10-11 10:21:46 +0000 (Tue, 11 Oct 2011) Log Message: ----------- Number of missing values in a column correctly calculated / displayed Modified Paths: -------------- dataObject.py sal.py Modified: dataObject.py =================================================================== --- dataObject.py 2011-07-04 07:02:05 UTC (rev 51) +++ dataObject.py 2011-10-11 10:21:46 UTC (rev 52) @@ -100,7 +100,7 @@ self.dataNames.extend([name]) def AddDescriptive(self, test): - if test in inits2.descriptivesList: + if test in initsVals.initVals.descriptivesList: self.descriptives.extend([test]) def SetAlphaLevel(self, alpha): @@ -109,6 +109,10 @@ else: self.alphaLevel = alpha + def GetMissing(self, col): + # return the number of missing values ('.' or 'NA') in the column + return self.parent.grid.NumberMissingData(col) + def GetData(self, col): # returns a 'cleaned' data column # this will actually query the grid / data matrix and return what's there @@ -286,6 +290,7 @@ This routine works through the list only getting four lots at a time before outputting them, as some lists may require lots of data. This is written specially for SalStat. + This method is called by selecting Descriptive statistics in Analyse -> n Condition Tests """ def __init__(self, dataObject): self.display = dataObject.display.htmlpage @@ -294,27 +299,31 @@ self.output.SetTitle('Analysis session begun: '+x) #self.output.SetComplex([]) # Can't (yet?) see need for this (blank) table insertion?! self.OutputResults(self.output) - out = ['<p><b>Descriptive Statistics</b></p><br><table border = "1" cellspacing = "0">'] - for i in range(0, len(dataObject.dataSources), 4): - out.append('<tr>') # add the variable names! + out = ['<p><b>Descriptive Statistics</b></p><br><table border = "1" cellspacing = "0">'] #table setup for first table + print("dataSources =", dataObject.dataSources) + for i in range(0, len(dataObject.dataSources), 4): # 0 .. numColumnsOfStatistics % 4 + print("i =", i) + out.append('<tr>') # start heading table row d = [] - out.append('<br><td>Statistic</td>') + out.append('<br><td>Statistic</td>') # Row 1 Column 1 heading data for j in range(i, i+4): + print("j =", j) if j < len(dataObject.dataSources): - #print len(dataObject.dataSources) - d.append(salstat_stats.FullDescriptives(dataObject.GetData(j))) - out.append('<td>'+str(dataObject.dataNames[j])+'</td>') - out.append('</tr><tr>') + print("columns selected =", dataObject.dataSources) # how many columns selected + _missing = dataObject.GetMissing(j) # how many missing values in the column? + d.append(salstat_stats.FullDescriptives(dataObject.GetData(j), missing = _missing)) # add chosen statistic test + out.append('<td>'+str(dataObject.dataNames[j])+'</td>') # print column letter e.g. A, B, C, etc + out.append('</tr><tr>') # end of headings row / end of "j for block" for k in dataObject.descriptives: - out.append('<td>'+str(k)+'</td>') + out.append('<td>'+str(k)+'</td>') # print statistic name e.g. N, sum, min etc for l in d: if l <= len(d): - out.append('<td>'+str(l.all[k])+'</td>') - out.append('</tr><tr>') - if i < max(dataObject.dataSources): - out.append('</table><br><table border = "1" cellspacing = "0">') - out.append('</table>') - self.display.write(''.join(out)) + out.append('<td>'+str(l.all[k])+'</td>') # print statistic values (e.g. all N) in a formatted table row + out.append('</tr><tr>') # end of data row + if i < max(dataObject.dataSources): # every modulus 4 of columns of statistics on variables frame + out.append('</table><br><table border = "1" cellspacing = "0">') # subsequent tables setup + out.append('</table>') # end of table code / end of "i for block" + self.display.write(''.join(out)) # blit it all to html output frame def OutputResults(self, output): self.display.write('<br><p><b>'+output.title+'</b><br>') @@ -357,8 +366,9 @@ self.body = string.join(tmp) if __name__ == '__main__': + """ inits2 = initVals.initVals() - """ + The following code is what a test dialog should do when the user accepts the options they have chosen. All the relevant info (after checking of course!) is put into the dataObject object, and passed to the @@ -366,8 +376,7 @@ This separates the GUI from the stats code, enabling a different GUI to be easily developed and used, or the GUI to be used for other stats codes (such as R or Lisp-Stat for example) - """ - """x = TwoSampleTestClass() + x = TwoSampleTestClass() x.AddDataSource(0) x.AddDataSource(2) x.AddDataSource(1) @@ -375,13 +384,13 @@ x.AddTest('Friedmans chi square') x.AddTest('t-test') x.AddTest('Chi square test for variance') - Perform2SampleTest(x)""" + Perform2SampleTest(x) x = outputClass() x.SetTitle('Between subjects anova') data = [['factor','df','ss','ms','f','p'],['Interaction','2','33.34','2.28','9.127','0.05'], \ ['Total','4','9.11'],['nother col','99','99.999','3','0.99']] x.SetComplex(data) print x.body - """x = initVals.initVals() + x = initVals.initVals() print x.oneSampleTests z = PerformDescriptives(x)""" Modified: sal.py =================================================================== --- sal.py 2011-07-04 07:02:05 UTC (rev 51) +++ sal.py 2011-10-11 10:21:46 UTC (rev 52) @@ -36,10 +36,10 @@ import initVals import dialogs import menus -import api +#import api -missingvalue = -99.999 +missingvalue = '.' class History: def __init__(self): @@ -456,21 +456,30 @@ #for i in range(len(describeTags)): self.Thaw() + def NumberMissingData(self, col): + self.missing = 0 + for i in range(self.GetNumberRows()): + datapoint = self.GetCellValue(i, col) + if (datapoint == '.') or (datapoint == 'NA'): + self.missing = self.missing + 1 + else: + pass + missing = self.missing + return missing + # Routine to return a "clean" list of data from one column def CleanData(self, col): indata = [] - self.missing = 0 for i in range(self.GetNumberRows()): datapoint = self.GetCellValue(i, col) - if (datapoint != '') and (datapoint != '.'): + if (datapoint != '') and (datapoint != '.') and (datapoint != 'NA'): try: value = float(datapoint) - if (value != missingvalue): - indata.append(value) - else: - self.missing = self.missing + 1 + indata.append(value) except ValueError: pass + else: + pass return indata def GetEntireDataSet(self, numcols): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-04 07:02:11
|
Revision: 51 http://salstat.svn.sourceforge.net/salstat/?rev=51&view=rev Author: mlivingstone Date: 2011-07-04 07:02:05 +0000 (Mon, 04 Jul 2011) Log Message: ----------- [bug 3350396] We not append '.dat' or '.html' as appropriate Modified Paths: -------------- miscClasses.py sal.py Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-07-04 06:15:22 UTC (rev 50) +++ miscClasses.py 2011-07-04 07:02:05 UTC (rev 51) @@ -14,6 +14,7 @@ import string import pickle import os +import os.path from xml.dom.minidom import parse import wx @@ -175,6 +176,9 @@ if dlg.ShowModal() == wx.ID_OK: inits.update({'savedir': dlg.GetDirectory()}) filename = dlg.GetPath() + if not os.path.splitext(outputfilename) [1]: + outputfilename = outputfilename + '.dat' + self.outputfilename = outputfilename fout = open(filename, "w") cols,waste = self.GetUsedCols() if (dlg.GetFilterIndex() == 0): @@ -217,6 +221,9 @@ filename = dlg.GetPath() else: return""" + if not os.path.splitext(filename) [1]: + filename = filename + '.dat' + self.filename = filename fout = open(filename, "w") cols, waste = self.GetUsedCols() rows = self.GetUsedRows() @@ -485,9 +492,12 @@ inits.update({'opendir': dlg.GetDirectory()}) def SaveHtmlPage(self, event): - dlg = wx.FileDialog(self, "Save Output","","","*.html|*>*",wx.SAVE) + dlg = wx.FileDialog(self, "Save Output","","","*.html|*.*",wx.SAVE) if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() + if not os.path.splitext(outputfilename) [1]: + outputfilename = outputfilename + '.html' + self.outputfilename = outputfilename fout = open(outputfilename, "w") fout.write(self.WholeOutString) fout.close() Modified: sal.py =================================================================== --- sal.py 2011-07-04 06:15:22 UTC (rev 50) +++ sal.py 2011-07-04 07:02:05 UTC (rev 51) @@ -291,6 +291,8 @@ if dlg.ShowModal() == wx.ID_OK: ini.userVals.update({'savedir': dlg.GetDirectory()}) filename = dlg.GetPath() + if not os.path.splitext(filename) [1]: + filename = filename + '.dat' ini.filename = filename fout = open(ini.filename, "w") cols,waste = self.GetUsedCols() @@ -334,6 +336,8 @@ ini.filename = dlg.GetPath() else: return""" + if not os.path.splitext(ini.filename) [1]: + ini.filename = ini.filename + '.dat' fout = open(ini.filename, "w") cols, waste = self.GetUsedCols() rows = self.GetUsedRows() @@ -624,10 +628,13 @@ def SaveScriptAs(self, event): default = ini.userVals.get('savedir') dlg = wx.FileDialog(self, "Save Script File", default,"",\ - "Any (*)|*", wx.SAVE) + "Any (*)|*", wx.SAVE | wx.OVERWRITE_PROMPT) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() - fout = open(filename, "w") + if not os.path.splitext(filename) [1]: + filename = filename + '.html' + self.filename = filename + fout = open(self.filename, "w") script = self.scripted.GetText() for i in range(len(script)): fout.write(script[i]+'\n') @@ -799,10 +806,13 @@ ini.userVals.update({'opendir': dlg.GetDirectory()}) def SaveHtmlPage(self, event): - dlg = wx.FileDialog(self, "Save Output","","","*.html|*.*",wx.SAVE) + dlg = wx.FileDialog(self, "Save Output","","","*.html",wx.SAVE) if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() - fout = open(outputfilename, "w") + if not os.path.splitext(outputfilename) [1]: + outputfilename = outputfilename + '.html' + self.outputfilename = outputfilename + fout = open(self.outputfilename, "w") fout.write(self.WholeOutString) fout.close() ini.userVals.update({'savedir': dlg.GetDirectory()}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-04 06:15:28
|
Revision: 50 http://salstat.svn.sourceforge.net/salstat/?rev=50&view=rev Author: mlivingstone Date: 2011-07-04 06:15:22 +0000 (Mon, 04 Jul 2011) Log Message: ----------- [bug 3350390] Fixed overwriting file without asking if that is what user intended? Modified Paths: -------------- miscClasses.py sal.py Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-07-03 07:49:14 UTC (rev 49) +++ miscClasses.py 2011-07-04 06:15:22 UTC (rev 50) @@ -168,8 +168,8 @@ def SaveAsDataASCII(self, event): default = inits.get('savedir') dlg = wx.FileDialog(self, "Save Data File", default,"",\ - "ASCII Text (*.dat)|*.dat", wx.SAVE) - #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE) + "ASCII Text (*.dat)|*.dat", wx.SAVE | wx.OVERWRITE_PROMPT) + #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE | wx.OVERWRITE_PROMPT) icon = images.getIconIcon() dlg.SetIcon(icon) if dlg.ShowModal() == wx.ID_OK: Modified: sal.py =================================================================== --- sal.py 2011-07-03 07:49:14 UTC (rev 49) +++ sal.py 2011-07-04 06:15:22 UTC (rev 50) @@ -284,8 +284,8 @@ def SaveAsDataASCII(self, event): default = ini.userVals.get('savedir') dlg = wx.FileDialog(self, "Save Data File", default,"",\ - "ASCII Text (*.dat)|*.dat", wx.SAVE) - #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE) + "ASCII Text (*.dat)|*.dat", wx.SAVE | wx.OVERWRITE_PROMPT) + #"ASCII Text (*.dat)|*.dat|SalStat File (*.xml)|*.xml|", wx.SAVE | wx.OVERWRITE_PROMPT) icon = images.getIconIcon() dlg.SetIcon(icon) if dlg.ShowModal() == wx.ID_OK: @@ -756,6 +756,9 @@ def __init__(self, parent, id): self.parent = parent wx.html.HtmlWindow.__init__(self, parent, id) + html = wx.html.HtmlWindow(self) + if "gtk2" in wx.PlatformInfo: + html.SetStandardFonts() #wx.Image_AddHandler(wxJPEGHandler()) # just in case! self.WholeOutString = '' self.Saved = True @@ -796,7 +799,7 @@ ini.userVals.update({'opendir': dlg.GetDirectory()}) def SaveHtmlPage(self, event): - dlg = wx.FileDialog(self, "Save Output","","","*.html|*>*",wx.SAVE) + dlg = wx.FileDialog(self, "Save Output","","","*.html|*.*",wx.SAVE) if dlg.ShowModal() == wx.ID_OK: outputfilename = dlg.GetPath() fout = open(outputfilename, "w") @@ -808,7 +811,7 @@ def PrintHtmlPage(self, event): dlg = wx.PrintDialog(self) if dlg.ShowModal() == wx.ID_OK: - pass + dlg.destroy() def CopyData(self, event): buffer = wx.TextDataObject() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-03 07:49:20
|
Revision: 49 http://salstat.svn.sourceforge.net/salstat/?rev=49&view=rev Author: mlivingstone Date: 2011-07-03 07:49:14 +0000 (Sun, 03 Jul 2011) Log Message: ----------- [bug 3350404] Fixed raised last statistic figure, and also printing of two unneeded 1x1 pixel tables in output screen Modified Paths: -------------- dataObject.py Modified: dataObject.py =================================================================== --- dataObject.py 2011-07-03 04:41:06 UTC (rev 48) +++ dataObject.py 2011-07-03 07:49:14 UTC (rev 49) @@ -292,7 +292,7 @@ self.output = outputClass() x = time.asctime() self.output.SetTitle('Analysis session begun: '+x) - self.output.SetComplex([[]]) + #self.output.SetComplex([]) # Can't (yet?) see need for this (blank) table insertion?! self.OutputResults(self.output) out = ['<p><b>Descriptive Statistics</b></p><br><table border = "1" cellspacing = "0">'] for i in range(0, len(dataObject.dataSources), 4): @@ -311,8 +311,8 @@ if l <= len(d): out.append('<td>'+str(l.all[k])+'</td>') out.append('</tr><tr>') - if i <= max(dataObject.dataSources): - out.append('<br></table><table border = "1" cellspacing = "0">') + if i < max(dataObject.dataSources): + out.append('</table><br><table border = "1" cellspacing = "0">') out.append('</table>') self.display.write(''.join(out)) @@ -346,7 +346,7 @@ def SetComplex(self, data): tmp = ['<table border = "1" cellspacing = "0">'] for i in range(len(data)): - tmp.append('<tr>') + #tmp.append('<tr>') for j in range(len(data[i])): # should be the heading, therefore defining part of table try: tmp.append('<td>'+str(data[i][j])+'</td>') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-03 04:41:12
|
Revision: 48 http://salstat.svn.sourceforge.net/salstat/?rev=48&view=rev Author: mlivingstone Date: 2011-07-03 04:41:06 +0000 (Sun, 03 Jul 2011) Log Message: ----------- [bug 3349300] Fixed SS Dev always = 0 Modified Paths: -------------- salstat_stats.py Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-07-03 03:55:14 UTC (rev 47) +++ salstat_stats.py 2011-07-03 04:41:06 UTC (rev 48) @@ -606,7 +606,7 @@ self.all['Variance'] = float('%.4f'%self.variance) self.all['Standard Deviation'] = float('%.4f'%self.stddev) self.all['Standard Error'] = float('%.4f'%self.stderr) - self.all['Sum of Squared Deviations'] = float('%.4f'%self.ssdevs) + self.all['Sum of Squared Devs'] = float('%.4f'%self.ssdevs) self.all['Coefficient of Variation'] = float('%.4f'%self.coeffvar) self.all['Number Missing'] = int(self.missing) self.all['Geometric Mean'] = float('%.4f'%self.geomean) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-03 03:55:20
|
Revision: 47 http://salstat.svn.sourceforge.net/salstat/?rev=47&view=rev Author: mlivingstone Date: 2011-07-03 03:55:14 +0000 (Sun, 03 Jul 2011) Log Message: ----------- [bug 3349304] Fixed display / printing no space between blocks of four descriptive results Modified Paths: -------------- dataObject.py Modified: dataObject.py =================================================================== --- dataObject.py 2011-07-03 02:54:34 UTC (rev 46) +++ dataObject.py 2011-07-03 03:55:14 UTC (rev 47) @@ -298,7 +298,7 @@ for i in range(0, len(dataObject.dataSources), 4): out.append('<tr>') # add the variable names! d = [] - out.append('<td>Statistic</td>') + out.append('<br><td>Statistic</td>') for j in range(i, i+4): if j < len(dataObject.dataSources): #print len(dataObject.dataSources) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-03 02:54:41
|
Revision: 46 http://salstat.svn.sourceforge.net/salstat/?rev=46&view=rev Author: mlivingstone Date: 2011-07-03 02:54:34 +0000 (Sun, 03 Jul 2011) Log Message: ----------- Polished and updated to reflect our use of Numpy (rather than Numeric, or Numarray.) Modified Paths: -------------- program.structure.txt Modified: program.structure.txt =================================================================== --- program.structure.txt 2011-07-02 10:03:06 UTC (rev 45) +++ program.structure.txt 2011-07-03 02:54:34 UTC (rev 46) @@ -1,48 +1,85 @@ SalStat Structure. -This document is a brief outline of the new structure of SalStat. It is intended to help future contributors to understand exactly what is supposed to be going on and where. +This document is a brief outline of the new structure of SalStat. It is intended +to help future contributors to understand exactly what is supposed to be going +on - and where. salstat.py -The basic script (salstat.py, though it is termed sal.py in the testing version) contains most of the GUI code. Eventually, it will contain just basic wx classes. Any large bespoke widgets will be farmed out to another module, miscClasses.py. This will be 1) the html render, and 2) the grid widget which will contain methods for loading files, saving files, retrieving data and so on. The grid class will probably be the biggest single piece of code. Currently though, it is called the SimpleGrid and is contained in this module. +The basic script (salstat.py, though it is termed sal.py in the testing version) +contains most of the GUI code. Eventually, it will contain just basic wx classes. +Any large bespoke widgets will be farmed out to another module, miscClasses.py. +This will be 1) the html render, and 2) the grid widget which will contain methods +for loading files, saving files, retrieving data, and so on. The grid class will +probably be the biggest single piece of code. Currently though, it is called the +SimpleGrid, and is contained in this module. -The dialogs necessary will be contained in a separate module (dialogs.py - see below). This module just defines, and calls, the datagrid, the html rendering windows and the frame for user scripting. The dialog size should be made persistent from the last size. Some users may be analysing lots of data and want a large window. The program should allow them to maintain some consistency that makes sense for them. +The dialogs necessary will be contained in a separate module (dialogs.py - see +below). This module just defines, and calls, the datagrid, the html rendering +windows, and the frame for user scripting. The dialog size should be made persistent +from the last size. Some users may be analysing lots of data and want a large window. +The program should allow them to maintain some consistency that makes sense for them. dataObject.py -This module contains the basic classes used for testing. It represents the link / controller between the UI and the stats code. If the UI or the stats code is to be used elsewhere (say, the GUI with R), this is the module that will need to be altered. +This module contains the basic classes used for testing. It represents the link / +controller between the UI and the stats code. If the UI or the stats code is to +be used elsewhere (say, the GUI with R), this is the module that will need to be +altered. -The basic object is called the DataClass. It is derived from by 3 other classes that are used for particular tests - 1 sample, 2 sample and 3 or more sample tests (actually, the 3+ sample tests can use just 2 samples but I'm just saying 3+ to keep a clear distinction). These classes contain details about the data: the tests the user has chosen, the descriptives chosen, the selected alpha level and so on. They are created by the test dialogs which transfer their data into these objects. +The basic object is called the DataClass. It is derived from by 3 other classes +that are used for particular tests - 1 sample, 2 sample, and 3+ sample tests +(actually, the 3+ sample tests can use just 2 samples but I'm just saying 3+ to +keep a clear distinction). These classes contain details about the data: the tests +the user has chosen, the descriptives chosen, the selected alpha level, and so on. +They are created by the test dialogs which transfer their data into these objects. -Also, there are 3 other classes for controlling (PerformXSampleTest). They get passes one of the above test classes, then take the pertinent pieces of information and call the stats routines in the stats engine (salstat_stats.py - see below). +Also, there are 3 other classes for controlling (PerformXSampleTest). They get +passed one of the above test classes, then take the pertinent pieces of information +and call the stats routines in the stats engine (salstat_stats.py - see below). -Finally, there is an output class which takes the output from the stats engine (via the controllers), and outputs it to the proper place. Output is available in html format, or in plain text. +Finally, there is an output class which takes the output from the stats engine +(via the controllers), and outputs it to the proper place. Output is available +in html format, or in plain text. dialogs.py -This module contains the code for the test and grid dialogs. The test dialogs are generic: one dialog suits all the tests currently implemented: only the tests and the "extra value" (eg, user hypothesised mean), if needed, will change. +This module contains the code for the test and grid dialogs. The test dialogs are +generic: one dialog suits all the tests currently implemented: only the tests and +the "extra value" (eg, user hypothesised mean), if needed, will change. -The data entered by the user is here put into a dataObjects.DataClass object, and then passed to one of the dataObjects controller classes which does its job of doing then test and making the output. +The data entered by the user is here put into a dataObjects.DataClass object, and +then passed to one of the dataObjects controller classes which does its job of doing +then test and making the output. fileIO.py -This file does all the input and output ops. Supported formats are: csv and salstat-native-xml, with (hopefully) SPSS binary import too. If I can get someone with good COM experience, an Excel version for Windows should be "doable". +This file does all the input and output ops. Supported formats are: csv and +salstat-native-xml, with (hopefully) SPSS binary import too. If I can get someone +with good COM experience, an Excel version for Windows should be "doable". miscClasses.py -This holds the miscellanous classes that I want in the program. The grid and html renderer will be held here as they are complex widgets with lots of bespoke methods and deserve their own place. +This holds the miscellanous classes that I want in the program. The grid and html +renderer will be held here as they are complex widgets with lots of bespoke methods +and deserve their own place. initVals.py -This contains a single class that holds all the initial values needed as attributes in a class. Things like window position and size, user directories, lists of tests and so on. This helps to provide some 'polish' to the application. +This contains a single class that holds all the initial values needed as attributes +in a class. Things like window position and size, user directories, lists of tests +and so on. This helps to provide some 'polish' to the application. salstat_stats.py -The "stats engine" and workhorse. It uses Numeric (soon numarray?) arrays to perform its calculations. Tests are organised into classes according the type of test (1,2 3+ samples). Some of the routines remain open to optimisation, but remember the dictum: first make it work, then make it pretty, then make it fast. +The "stats engine" and workhorse. It uses Numpy arrays to perform its calculations. +Tests are organised into classes according the type of test (1,2, 3+ samples). +Some of the routines remain open to optimisation, but remember the dictum: +first make it work, then make it pretty, then make it fast. images.py -This holds encoded bitmap images for th icons and so on. +This holds encoded bitmap images for the icons and so on. api.py @@ -50,4 +87,6 @@ menus.py -This holds the menus for both the grid and the output window (the scripting window has none). The init method creates menu items for entries common to both menus, and the 2 methods add the rest! +This holds the menus for both the grid and the output window (the scripting window +has none). The init method creates menu items for entries common to both menus, +and the 2 methods add the rest! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-02 10:03:12
|
Revision: 45 http://salstat.svn.sourceforge.net/salstat/?rev=45&view=rev Author: mlivingstone Date: 2011-07-02 10:03:06 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Beware IDE auto-complete! Modified Paths: -------------- images.py Modified: images.py =================================================================== --- images.py 2011-07-02 09:21:06 UTC (rev 44) +++ images.py 2011-07-02 10:03:06 UTC (rev 45) @@ -3,10 +3,10 @@ import cStringIO import zlib -import wx.ImageFromStream -import wx.BitmapFromImage -import wx.EmptyIcon -# import wx +#import wx.ImageFromStream +#import wx.BitmapFromImage +#import wx.EmptyIcon +import wx def getLeftData(): return zlib.decompress( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-02 09:21:12
|
Revision: 44 http://salstat.svn.sourceforge.net/salstat/?rev=44&view=rev Author: mlivingstone Date: 2011-07-02 09:21:06 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Restructure and delete superceded code Modified Paths: -------------- chart.py sal.py Modified: chart.py =================================================================== --- chart.py 2011-07-02 08:50:23 UTC (rev 43) +++ chart.py 2011-07-02 09:21:06 UTC (rev 44) @@ -365,8 +365,8 @@ tmp = self.dc.GetTextExtent(self.xlabel) tmp = tmp[0] / 2 xlabelpos = int((self.width / 2) - tmp + self.gSize[0]) - try: - ylabelpos = self.dc.GetTextExtent(self.axis[0])[0] + self.gSize[3] - 5 # hack -5 so it doesn't print off bottom of screen + try: # below remove 5 so it doesn't print off bottom of screen + ylabelpos = self.dc.GetTextExtent(self.axis[0])[0] + self.gSize[3] - 5 except IndexError: ylabelpos = self.gSize[3] self.dc.DrawText(self.xlabel, xlabelpos, ylabelpos) Modified: sal.py =================================================================== --- sal.py 2011-07-02 08:50:23 UTC (rev 43) +++ sal.py 2011-07-02 09:21:06 UTC (rev 44) @@ -54,7 +54,7 @@ class SaveDialog(wx.Dialog): def __init__(self, parent, id): wx.Dialog.__init__(self, parent, id, "Save Data?", \ - size=(306,140))#, style = wx.DIALOG_MODAL) + size=(306,140)) icon = images.getIconIcon() self.SetIcon(icon) self.parent = parent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-02 08:50:29
|
Revision: 43 http://salstat.svn.sourceforge.net/salstat/?rev=43&view=rev Author: mlivingstone Date: 2011-07-02 08:50:23 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Restructure and delete superceded code Modified Paths: -------------- api.py chart.py dataObject.py dialogs.py fileIO.py images.py initVals.py menus.py miscClasses.py sal.py salstat.py salstat_stats.py Modified: api.py =================================================================== --- api.py 2011-07-02 02:44:33 UTC (rev 42) +++ api.py 2011-07-02 08:50:23 UTC (rev 43) @@ -5,11 +5,11 @@ to a series of commonly used functions. It is the only module that should be imported with from api import *. -(c) 2003 Alan James Salmoni -Copyright 2011 Mark Livingstone. - Licensed under version 2 or later of the GNU General Public License (GPL). See the file COPYING for full details of this license. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import string Modified: chart.py =================================================================== --- chart.py 2011-07-02 02:44:33 UTC (rev 42) +++ chart.py 2011-07-02 08:50:23 UTC (rev 43) @@ -5,14 +5,14 @@ A pure python module for basic charting. This is to be used for SalStat. +Released under the wxWindows license. + (c) 2003 Alan James Salmoni -Copyright 2011 Mark Livingstone. - -Released under the wxWindows license. +(c) 2011 Mark Livingstone. """ +import wx import numpy -import wx class GraphBaseElement(object): def __init__(self): Modified: dataObject.py =================================================================== --- dataObject.py 2011-07-02 02:44:33 UTC (rev 42) +++ dataObject.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,19 +1,22 @@ """ -dataObjects.py +dataObject.py + A SalStat module to encapsulate the objects that hold the data for analysis. -(c) 2003 Alan James Salmoni. -Copyright 2011 Mark Livingstone. - Released under the GNU General Public License, version 2 or later. See the file 'COPYING' for the full license. + +(c) 2003 Alan James Salmoni. +(c) 2011 Mark Livingstone. """ import string import time -import initVals + import numpy + import salstat_stats +import initVals class InvalidProbabilityValue(ValueError): 'Used to indicate a floating point value less than 0.0 or more than 1.0' @@ -119,7 +122,7 @@ for i in self.dataSources: newlist.append(self.GetData(i)) print "newlist =", newlist - return numpy.array((newlist)) #, float) + return numpy.array((newlist)) class OneSampleTestClass(TestDataClass): """ Modified: dialogs.py =================================================================== --- dialogs.py 2011-07-02 02:44:33 UTC (rev 42) +++ dialogs.py 2011-07-02 08:50:23 UTC (rev 43) @@ -6,21 +6,20 @@ to perform some tests. The dataObject classes come in and provide all the remaining details. -(c) 2003 Alan James Salmoni -Contact ala...@ya... - -Copyright 2011 Mark Livingstone. - Released under version 2 or later of the GNU General Public License. See the enclosed file 'COPYING' for the full license. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import wx -#import images import wx.lib.buttons import wx.lib.wxpTag + import dataObject -# import miscClasses +#import images +#import miscClasses class DataDialog(wx.Dialog): def __init__(self, *args, **kwds): Modified: fileIO.py =================================================================== --- fileIO.py 2011-07-02 02:44:33 UTC (rev 42) +++ fileIO.py 2011-07-02 08:50:23 UTC (rev 43) @@ -4,13 +4,11 @@ A Python / wxPython module to deal with the file input / output of the SalStat statistics package. -(c) 2003 Alan James Salmoni -Contact ala...@ya... - -Copyright 2011 Mark Livingstone. - Released under version 2 or later of the GNU General Public License. See the enclosed file 'COPYING' for the full license. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import csv Modified: images.py =================================================================== --- images.py 2011-07-02 02:44:33 UTC (rev 42) +++ images.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,11 +1,13 @@ # This file generated by /usr/bin/img2py -#from wx import wx.ImageFromStream -#from wx import wx.BitmapFromImage -#from wx import wx.EmptyIcon -import cStringIO, zlib -import wx +import cStringIO +import zlib +import wx.ImageFromStream +import wx.BitmapFromImage +import wx.EmptyIcon +# import wx + def getLeftData(): return zlib.decompress( 'x\xda\x01x\x01\x87\xfe\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x18\ Modified: initVals.py =================================================================== --- initVals.py 2011-07-02 02:44:33 UTC (rev 42) +++ initVals.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,20 +1,22 @@ """ initVals.py -a SalStat module that contains all the 'global' variables (actually in an + +A SalStat module that contains all the 'global' variables (actually in an initVals class, but the effect is much the same). All sorts of miscellanous stuff is kept in here, and this will probably change (expand!) over time. -(c) 2003 Alan James Salmoni. - -Copyright 2011 Mark Livingstone. - Released under the GNU General Public License, version 2 or later. See the file 'COPYING' for the full license. + +(c) 2003 Alan James Salmoni. +(c) 2011 Mark Livingstone. """ import os +import string + import wx -import string + import salstat_stats class initVals(object): @@ -89,7 +91,7 @@ self.ThreeSampleTestsDict + self.CorrelationsTestsDict""" self.HOME = os.getcwd() self.userVals = {} - if wx.Platform == '__WXMSW__': + if wx.Platform == "__WXMSW__": self.DOCDIR = 'c:\My Documents' self.INITDIR = os.getcwd() else: Modified: menus.py =================================================================== --- menus.py 2011-07-02 02:44:33 UTC (rev 42) +++ menus.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,13 +1,14 @@ """ -menus.py. A module that sets up a number of menus for the data grid and the +menus.py + +A module that sets up a number of menus for the data grid and the output sheet as part of SalStat -(c) 2003 Alan James Salmoni - -Copyright 2011 Mark Livingstone. - Licensed under version 2 or later of the GNU General Public License (GPL). See the file COPYING for full details of this license. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import wx Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-07-02 02:44:33 UTC (rev 42) +++ miscClasses.py 2011-07-02 08:50:23 UTC (rev 43) @@ -4,13 +4,11 @@ A Python / wxPython module to hold the miscellanous GUI classes for the SalStat statistics package. -(c) 2003 Alan James Salmoni -Contact ala...@ya... - -Copyright 2011 Mark Livingstone. - Released under version 2 or later of the GNU General Public License. See the enclosed file 'COPYING' for the full license. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import string @@ -18,7 +16,6 @@ import os from xml.dom.minidom import parse - import wx import wx.grid import wx.html @@ -445,7 +442,7 @@ for i in range(len(numcols)): smalllist = frame.grid.CleanData(numcols[i]) biglist.append(smalllist) - return numpy.array((biglist)) #, Numeric.Float) + return numpy.array((biglist)) class HtmlFrame(wx.html.HtmlWindow): def __init__(self, parent, id): Modified: sal.py =================================================================== --- sal.py 2011-07-02 02:44:33 UTC (rev 42) +++ sal.py 2011-07-02 08:50:23 UTC (rev 43) @@ -2,21 +2,25 @@ """ sal.py + SalStat Statistics Package. This is the main file for SalStat (the one which should be run by the user). -Copyright 2003 Alan James Salmoni. -Copyright 2011 Mark Livingstone. - Licensed under version 2 or later of the GNU General Public License (GPL). See the file COPYING for full details of this license. + +(c) 2003 Alan James Salmoni. +(c) 2011 Mark Livingstone. """ -# import wx stuff -import wx +import sys +import string +import os +import os.path +import csv -#import wx.py.editor +import wx import wx.stc import wx.grid import wx.html @@ -24,14 +28,8 @@ import wx.lib.plot import wx.lib.wxpTag -# import system modules -import sys -import string -import os -import os.path -import csv +import numpy -# import SalStat specific modules import salstat_stats import images import dataObject @@ -40,7 +38,6 @@ import menus import api -import numpy missingvalue = -99.999 @@ -479,7 +476,7 @@ for i in range(len(numcols)): smalllist = frame.grid.CleanData(numcols[i]) biglist.append(smalllist) - return numpy.array((biglist), numpy.Float) + return numpy.array((biglist)) #--------------------------------------------------------------------------- # base class for getting number of columns/rows to add @@ -498,9 +495,9 @@ self.numnewRows.SetRange(0, 100) self.numnewRows.SetValue(0) okaybutton = wx.Button(self, 421, "Okay", wx.Point(10, 90),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) cancelbutton = wx.Button(self, 422, "Cancel", wx.Point(110,90), \ - wx.DefaultSize) #Size(BWidth, BHeight)) + wx.DefaultSize) wx.EVT_BUTTON(self, 421, self.OkayButtonPressed) wx.EVT_BUTTON(self, 422, self.CancelButtonPressed) @@ -530,9 +527,9 @@ l1 = wx.StaticText(self, -1, 'Column Width:',pos=(10,15)) l2 = wx.StaticText(self, -1, 'Row Height:',pos=(10,55)) okaybutton = wx.Button(self, 321, "Okay", wx.Point(10, 90), \ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) cancelbutton = wx.Button(self, 322, "Cancel", wx.Point(110,90),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) wx.EVT_BUTTON(self, 321, self.OkayButtonPressed) wx.EVT_BUTTON(self, 322, self.OnCloseGridPrefs) @@ -718,9 +715,9 @@ icon = images.getIconIcon() self.SetIcon(icon) okaybutton = wx.Button(self, 2001, "Okay",wx.Point(10,170),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) cancelbutton = wx.Button(self, 2002, "Cancel",wx.Point(100,170),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) self.vargrid = wx.Grid(self,-1,size=(480,130),pos=(10,10)) self.vargrid.SetRowLabelSize(120) self.vargrid.SetDefaultRowSize(27, True) @@ -935,20 +932,20 @@ self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), \ wx.Size(230,(winheight * 0.8)), ColumnList) okaybutton = wx.Button(self,1103,"Okay",wx.Point(10,winheight-35),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) cancelbutton = wx.Button(self,1104,"Cancel",wx.Point(100,winheight-35),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) if wx.Platform == '__WXMSW__': # Darn! Some cross-platform voodoo needed... allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-70),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-70),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) else: allbutton = wx.Button(self, 105, "Select All", wx.Point(250,winheight-50),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) nonebutton = wx.Button(self, 106, "Select None", wx.Point(360,winheight-50),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) wx.EVT_BUTTON(okaybutton, 1103, self.OnOkayButton) wx.EVT_BUTTON(cancelbutton, 1104, self.OnCloseContDesc) #wx.EVT_BUTTON(allbutton, 105, self.DescChoice.SelectAllDescriptives) @@ -962,7 +959,7 @@ descs.append(salstat_stats.FullDescriptives( \ frame.grid.CleanData(i), name, \ frame.grid.missing)) - ManyDescriptives(self, descs) + #ManyDescriptives(self, descs) self.Close(True) def OnCloseContDesc(self, event): @@ -997,13 +994,13 @@ # levels per factor, # interactions etc which might be useful. It # would be updated whenever the user changes a selection. okaybutton = wx.Button(self,216,"Okay",wx.Point(10,winheight-35), \ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) cancelbutton = wx.Button(self,217,"Cancel",wx.Point(100,winheight-35), \ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) allbutton = wx.Button(self, 218,"Select All",wx.Point(250,winheight-70),\ - wx.DefaultSize) #(BWidth, BHeight)) + wx.DefaultSize) nonebutton = wx.Button(self, 220, "Select None", wx.Point(360, \ - winheight-70),wx.DefaultSize) #(BWidth, BHeight)) + winheight-70),wx.DefaultSize) self.DescChoice = DescChoiceBox(self, 104) wx.EVT_BUTTON(okaybutton, 216, self.OnOkayButton) wx.EVT_BUTTON(cancelbutton, 217, self.OnCloseTwoCond) Modified: salstat.py =================================================================== --- salstat.py 2011-07-02 02:44:33 UTC (rev 42) +++ salstat.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,21 +1,20 @@ #!/usr/bin/env python """ -SalStat +salstat.py -(c) 2003 Alan James Salmoni -Contact ala...@ya... - -Copyright 2011 Mark Livingstone. - Released under version 2 or later of the GNU General Public License. See the enclosed file 'COPYING' for the full license. SalStat is a Python written package for statistical analysis, using wxPython as the GUI toolkit. + +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import sys + import wx if __name__ == '__main__': Modified: salstat_stats.py =================================================================== --- salstat_stats.py 2011-07-02 02:44:33 UTC (rev 42) +++ salstat_stats.py 2011-07-02 08:50:23 UTC (rev 43) @@ -1,5 +1,9 @@ -# stats.py - reworked module for statistical analysis using OOP +# """ +salstat_stats.py + +Reworked module for statistical analysis using OOP. + This module has been written specifically for the SalStat statistics package. It is an object oriented (and more limited) version of Gary Strangman's stats.py module, and much code has been taken from there. The classes and @@ -14,12 +18,14 @@ Harvard University (c) 2002, Gary Strangman, released under the GNU General Public License. -Copyright 2011 Mark Livingstone. +(c) 2003 Alan James Salmoni +(c) 2011 Mark Livingstone. """ import math import copy + import numpy # Short routines used in the functional constructs to reduce analysis time @@ -561,13 +567,6 @@ for i in range(self.N): difflist.append(self.sortlist[i] - self.mean) self.mad = self.mad + (self.sortlist[i] - self.median) -# uniques = 1 -# for j in range(self.N): -# if (i != j): -# if (self.sortlist[i] == self.sortlist[j]): -# uniques = 0 -# if uniques: -# self.numberuniques = self.numberuniques + 1 # harmonic mean being calculated here seeing we are looping over the data anyway! if (self.sortlist[i] != 0.0): self.harmmean = self.harmmean + (1.0/self.sortlist[i]) @@ -1352,7 +1351,7 @@ self.outstr = self.outstr+' = '+str(diff) if __name__ == '__main__': - x = numpy.array(([[1.,2.,3.,4.],[5.,6.,7.,8.],[9.,10.,11.,12.]]), numpy.Float) + x = numpy.array(([[1.,2.,3.,4.],[5.,6.,7.,8.],[9.,10.,11.,12.]])) y = [1,2,3,4,5,6,7,8,9,10,11,12] """d1 = FullDescriptives(x) d2 = FullDescriptives(y) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-07-02 02:44:39
|
Revision: 42 http://salstat.svn.sourceforge.net/salstat/?rev=42&view=rev Author: mlivingstone Date: 2011-07-02 02:44:33 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Fix null dialog issue Modified Paths: -------------- miscClasses.py Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-06-30 09:56:52 UTC (rev 41) +++ miscClasses.py 2011-07-02 02:44:33 UTC (rev 42) @@ -344,7 +344,7 @@ default = inits.get('opendir') dlg = wx.FileDialog(self, "Load Data File", default,"",\ "ASCII Text (*.dat)|*.dat",wx.OPEN) - #Numeric Array (*.npy)|*.npy|", wx.OPEN) + #Numpy Array (*.npy)|*.npy|", wx.OPEN) icon = images.getIconIcon() dlg.SetIcon(icon) if dlg.ShowModal() == wx.ID_OK: @@ -500,7 +500,7 @@ def PrintHtmlPage(self, event): dlg = wx.PrintDialog(self) if dlg.ShowModal() == wx.ID_OK: - null + dlg.Destroy() def GoBack(self, event): if self.HistoryCanBack(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-06-30 09:56:58
|
Revision: 41 http://salstat.svn.sourceforge.net/salstat/?rev=41&view=rev Author: mlivingstone Date: 2011-06-30 09:56:52 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Output screen now supports copying the whole pane to the clipboard. At present it is clipped in raw HTML format Modified Paths: -------------- menus.py sal.py Modified: menus.py =================================================================== --- menus.py 2011-06-30 05:28:27 UTC (rev 40) +++ menus.py 2011-06-30 09:56:52 UTC (rev 41) @@ -1,5 +1,5 @@ """ -menu.py. A module that sets up a number of menus for the data grid and the +menus.py. A module that sets up a number of menus for the data grid and the output sheet as part of SalStat (c) 2003 Alan James Salmoni @@ -147,7 +147,7 @@ def GetOutputMenu(self): file_menu = wx.Menu() - #edit_menu = wx.Menu() + edit_menu = wx.Menu() #pref_menu = wx.Menu() help_menu = wx.Menu() file_menu.Append(self.ID_FILE_NEW, '&New\tCtrl+N') @@ -157,7 +157,7 @@ file_menu.Append(self.ID_FILE_PRINT, '&Print...\tCtrl+P') #file_menu.Append(self.ID_FILE_CLOSE, '&Close') #edit_menu.Append(self.ID_EDIT_CUT, 'Cu&t') - #edit_menu.Append(self.ID_EDIT_COPY, '&Copy') + edit_menu.Append(407, '&Copy\tCtrl+C') #edit_menu.Append(self.ID_EDIT_PASTE, '&Paste') #edit_menu.Append(self.ID_EDIT_SELECTALL, 'Select &All') help_menu.Append(self.ID_HELP_WIZARD, '&What Test Should I Use...\tF2') @@ -166,6 +166,6 @@ help_menu.Append(self.ID_HELP_ABOUT, '&About...\tF4') self.menuBar = wx.MenuBar() self.menuBar.Append(file_menu, '&File') - #self.menuBar.Append(edit_menu, '&Edit') + self.menuBar.Append(edit_menu, '&Edit') #self.menuBar.Append(pref_menu, '&Pref') self.menuBar.Append(help_menu, '&Help') Modified: sal.py =================================================================== --- sal.py 2011-06-30 05:28:27 UTC (rev 40) +++ sal.py 2011-06-30 09:56:52 UTC (rev 41) @@ -1,6 +1,7 @@ #!/usr/bin/env python """ +sal.py SalStat Statistics Package. This is the main file for SalStat (the one which should be run by the user). @@ -810,8 +811,17 @@ def PrintHtmlPage(self, event): dlg = wx.PrintDialog(self) if dlg.ShowModal() == wx.ID_OK: - null + pass + def CopyData(self, event): + buffer = wx.TextDataObject() + data = self.WholeOutString + data = data[:-1] + if (wx.TheClipboard.Open()): + buffer.SetText(data) + wx.TheClipboard.SetData(buffer) + wx.TheClipboard.Close() + def GoBack(self, event): if self.HistoryCanBack(): self.HistoryBack() @@ -821,8 +831,9 @@ self.HistoryForward() #--------------------------------------------------------------------------- -# output window w/html class for output. Also has status bar and menu.Opens -# in new frame +# output window w/html class for output. Also has status bar and menu. Opens +# in new frame. Has only Copy to Clipboard since Cut / Paste does not make any +# sense in the output screen context. class OutputSheet(wx.Frame): def __init__(self, parent, id): dimx = int(ini.userVals.get('outputsizex')) @@ -845,6 +856,7 @@ OpenIcon = images.getOpenBitmap() SaveAsIcon = images.getSaveAsBitmap() PrintIcon = images.getPrintBitmap() + CopyIcon = images.getCopyBitmap() HelpIcon = images.getHelpBitmap() toolBar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.NO_BORDER| \ wx.TB_3DBUTTONS) @@ -854,7 +866,8 @@ toolBar.AddSimpleTool(403, SaveAsIcon,"Save As","Save Data under \ a new filename") toolBar.AddSimpleTool(404, PrintIcon,"Print","Print Out Results") - toolBar.AddSimpleTool(405, HelpIcon, "Help", "Get some help!") + toolBar.AddSimpleTool(407, CopyIcon,"Copy","Copy Data to Clipboard") + toolBar.AddSimpleTool(409, HelpIcon, "Help", "Get some help!") toolBar.SetToolBitmapSize((24,24)) # more toolbuttons are needed: New Output, Save, Print, Cut, \ # Variables, and Wizard creates the toolbar @@ -866,20 +879,23 @@ self.htmlpage.Addhtml('<P><B>SalStat Statistics</B></P>') self.printer = wx.html.HtmlEasyPrinting() wx.EVT_MENU(self, menuBar.ID_FILE_SAVEAS, self.htmlpage.SaveHtmlPage) + wx.EVT_TOOL(self, 403, self.htmlpage.SaveHtmlPage) wx.EVT_CLOSE(self, self.DoNothing) wx.EVT_MENU(self, menuBar.ID_FILE_NEW, self.ClearAll) + wx.EVT_TOOL(self, 401, self.ClearAll) wx.EVT_MENU(self, menuBar.ID_FILE_PRINT, self.PrintOutput) + wx.EVT_TOOL(self, 404, self.PrintOutput) wx.EVT_MENU(self, menuBar.ID_FILE_OPEN, self.htmlpage.LoadHtmlPage) + wx.EVT_TOOL(self, 402, self.htmlpage.LoadHtmlPage) + wx.EVT_MENU(self, 407, self.htmlpage.CopyData) + wx.EVT_TOOL(self, 407, self.htmlpage.CopyData) wx.EVT_MENU(self, menuBar.ID_HELP_ABOUT, frame.GoHelpAboutFrame) + wx.EVT_TOOL(self, 409, frame.GoHelpTopicsFrame) wx.EVT_MENU(self, menuBar.ID_HELP_WIZARD, frame.GoHelpWizardFrame) wx.EVT_MENU(self, menuBar.ID_HELP_TOPICS, frame.GoHelpTopicsFrame) wx.EVT_MENU(self, menuBar.ID_HELP_LICENCE, frame.GoHelpLicenceFrame) - wx.EVT_TOOL(self, 401, self.ClearAll) - wx.EVT_TOOL(self, 402, self.htmlpage.LoadHtmlPage) - wx.EVT_TOOL(self, 403, self.htmlpage.SaveHtmlPage) - wx.EVT_TOOL(self, 404, self.PrintOutput) - wx.EVT_TOOL(self, 405, frame.GoHelpTopicsFrame) + def PrintOutput(self, event): data = wx.PrintDialogData() data.EnablePrintToFile(True) @@ -890,7 +906,7 @@ #print out html self.printer.PrintText(self.htmlpage.WholeOutString) dlg.Destroy() - + def DoNothing(self, event): pass @@ -915,7 +931,7 @@ l0 = wx.StaticText(self,-1,"Select Column(s) to Analyse:",pos=(10,10)) l4 = wx.StaticText(self,-1,"Select Descriptive Statistics:",pos=(250,10)) #self.DescChoice = wx.Choice(self, 1107) - #self.DescChoice = DescChoiceBox(self, 1107) + #self.DescChoice = DescChoiceBox(self, 1107) self.ColChoice = wx.CheckListBox(self,1102, wx.Point(10,30), \ wx.Size(230,(winheight * 0.8)), ColumnList) okaybutton = wx.Button(self,1103,"Okay",wx.Point(10,winheight-35),\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-06-30 05:28:33
|
Revision: 40 http://salstat.svn.sourceforge.net/salstat/?rev=40&view=rev Author: mlivingstone Date: 2011-06-30 05:28:27 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Fix tab / space issue, and convert to use Numpy Modified Paths: -------------- chart.py Modified: chart.py =================================================================== --- chart.py 2011-06-30 05:18:53 UTC (rev 39) +++ chart.py 2011-06-30 05:28:27 UTC (rev 40) @@ -1,8 +1,10 @@ #!/usr/bin/env python """ -chart.py - a pure python module for basic charting. This is to be used for -SalStat. +chart.py + +A pure python module for basic charting. This is to be used for SalStat. + (c) 2003 Alan James Salmoni Copyright 2011 Mark Livingstone. @@ -88,6 +90,7 @@ def SetPoints(self, points): self.points = points + """def AddPoints(self, points): self.points.append(points)""" @@ -437,7 +440,7 @@ self.graphObject.Draw(self.panel, self.dc) def GetMaxMin(x): - s = Numeric.shape(x) + s = numpy.shape(x) if len(s) == 1: while None in x: x.remove(None) @@ -458,17 +461,17 @@ # main loop if __name__ == '__main__': - app = wx.PySimpleApp() - x = Graph() - frame = GraphFrame(None, x) - frame.Show(True) - x.Set('bars',[22,39,31,18],colour="RED", thickness=2, fill=wx.CROSSDIAG_HATCH) - x.Set('lines',[23,33,32,12],colour="GREEN", thickness=3) - x.Set('lines',[76,72,68,84],colour="BLUE", thickness = 1, fill=wx.SOLID) - x.SetAxis(['30 mg','20 mg','10 mg','zero mg']) - x.SetTitle1('Graph Test') - x.SetTitle2('This is the second title, and should be justified centrally') + app = wx.PySimpleApp() + x = Graph() + frame = GraphFrame(None, x) + frame.Show(True) + x.Set('bars',[22,39,31,18],colour="RED", thickness=2, fill=wx.CROSSDIAG_HATCH) + x.Set('lines',[23,33,32,12],colour="GREEN", thickness=3) + x.Set('lines',[76,72,68,84],colour="BLUE", thickness = 1, fill=wx.SOLID) + x.SetAxis(['30 mg','20 mg','10 mg','zero mg']) + x.SetTitle1('Graph Test') + x.SetTitle2('This is the second title, and should be justified centrally') - app.MainLoop() + app.MainLoop() #--------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-06-30 05:18:59
|
Revision: 39 http://salstat.svn.sourceforge.net/salstat/?rev=39&view=rev Author: mlivingstone Date: 2011-06-30 05:18:53 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Fix missing imports and event types and convert to use Numpy Modified Paths: -------------- miscClasses.py Modified: miscClasses.py =================================================================== --- miscClasses.py 2011-06-30 04:01:45 UTC (rev 38) +++ miscClasses.py 2011-06-30 05:18:53 UTC (rev 39) @@ -14,10 +14,19 @@ """ import string +import pickle +import os +from xml.dom.minidom import parse + + import wx import wx.grid import wx.html +import numpy + +import images + class GridFrame(wx.grid.Grid): def __init__(self, parent, log): wx.grid.Grid.__init__(self, parent, -1) @@ -29,8 +38,8 @@ self.SetColLabelAlignment(wx.ALIGN_LEFT, wx.ALIGN_BOTTOM) for i in range(20): self.SetColFormatFloat(i, 8, 4) - EVT_GRID_CELL_CHANGE(self, self.AlterSaveStatus) - EVT_GRID_RANGE_SELECT(self, self.RangeSelected) + wx.grid.EVT_GRID_CELL_CHANGE(self, self.AlterSaveStatus) + wx.grid.EVT_GRID_RANGE_SELECT(self, self.RangeSelected) self.wildcard = "Any File (*.*)|*.*|" \ "ASCII data format (*.dat)|*.dat|" \ "SalStat Format (*.xml)|*.xml" @@ -201,7 +210,7 @@ self.SaveAsDataASCII(event) """dlg = wx.FileDialog(self, "Save Data File", default,"",\ "ASCII Text (*.dat)|*.dat| \ - Numeric Array (*.npy)|*.npy| \ + Numpy Array (*.npy)|*.npy| \ Any (*.*)| \ *.*", wx.SAVE) icon = images.getIconIcon() @@ -290,7 +299,7 @@ # now start the XML processing self.ClearGrid() self.Freeze() - xmldoc = minidom.parse(filename) + xmldoc = parse(filename) datatags = xmldoc.getElementsByTagName('data') self.getData(datatags) deleteRowTags = xmldoc.getElementsByTagName('deleteRow') @@ -430,13 +439,13 @@ return indata def GetEntireDataSet(self, numcols): - """Returns the data specified by a list 'numcols' in a Numeric + """Returns the data specified by a list 'numcols' in a Numpy array""" biglist = [] for i in range(len(numcols)): smalllist = frame.grid.CleanData(numcols[i]) biglist.append(smalllist) - return Numeric.array((biglist), Numeric.Float) + return numpy.array((biglist)) #, Numeric.Float) class HtmlFrame(wx.html.HtmlWindow): def __init__(self, parent, id): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mli...@us...> - 2011-06-30 04:01:51
|
Revision: 38 http://salstat.svn.sourceforge.net/salstat/?rev=38&view=rev Author: mlivingstone Date: 2011-06-30 04:01:45 +0000 (Thu, 30 Jun 2011) Log Message: ----------- Return error not Error. Fix missing imports Modified Paths: -------------- api.py Modified: api.py =================================================================== --- api.py 2011-06-23 09:30:20 UTC (rev 37) +++ api.py 2011-06-30 04:01:45 UTC (rev 38) @@ -1,5 +1,7 @@ """ -api.py - a module to provide and API for user scripting. It allows access +api.py + +A module to provide and API for user scripting. It allows access to a series of commonly used functions. It is the only module that should be imported with from api import *. @@ -10,6 +12,10 @@ See the file COPYING for full details of this license. """ +import string + +import salstat_stats +import sal from sal import OutputSheet # Scripting API is defined here. So far, only basic (but usable!) stuff. @@ -63,7 +69,7 @@ if (error == ""): return TBase.t, TBase.df, TBase.prob else: - return Error + return error def DoOneSampleSignTest(col1, usermean, tail = 2): """This routine performs a 1 sample sign-test using the given data and @@ -82,7 +88,7 @@ if (error == ""): return TBase.nplus, TBase.nminus, TBase.z, TBase.prob else: - return Error + return error def DoChiSquareVariance(col1, usermean, tail = 2): """This routine performs a chi square for variance ratio test using @@ -101,7 +107,7 @@ if (error == ""): return TBase.chisquare, TBase.df, TBase.prob else: - return Error + return error def DoPairedTTest(col1, col2, tail = 2): """This routine performs a paired t-test using the data contained in @@ -127,7 +133,7 @@ if (error == ""): return TBase.t, TBase.df, TBase.prob else: - return Error + return error def DoUnpairedTTest(col1, col2, tail = 2): """This function performs an unpaired t-test on the data passed. If the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |