aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/webqtlUtil.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility/webqtlUtil.py')
-rw-r--r--wqflask/utility/webqtlUtil.py132
1 files changed, 1 insertions, 131 deletions
diff --git a/wqflask/utility/webqtlUtil.py b/wqflask/utility/webqtlUtil.py
index 4fc978f5..2336e722 100644
--- a/wqflask/utility/webqtlUtil.py
+++ b/wqflask/utility/webqtlUtil.py
@@ -90,70 +90,6 @@ PROGRESSBAR = HT.Image('/images/waitAnima2.gif', alt='checkblue',align="middle",
# Accessory Functions
#########################################
-def inverseCumul(p):
- #Coefficients in rational approximations.
- a = [-3.969683028665376e+01,2.209460984245205e+02,-2.759285104469687e+02,1.383577518672690e+02,-3.066479806614716e+01,2.506628277459239e+00]
-
- b = [-5.447609879822406e+01,1.615858368580409e+02,-1.556989798598866e+02,6.680131188771972e+01,-1.328068155288572e+01]
-
- c = [-7.784894002430293e-03,-3.223964580411365e-01,-2.400758277161838e+00,-2.549732539343734e+00,4.374664141464968e+00,2.938163982698783e+00]
-
- d = [7.784695709041462e-03,3.224671290700398e-01,2.445134137142996e+00,3.754408661907416e+00]
-
- #Define break-points.
-
- p_low = 0.02425
- p_high = 1 - p_low
-
- #Rational approximation for lower region.
-
- if p > 0 and p < p_low:
- q = sqrt(-2*log(p))
- x = (((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) / ((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1)
-
-
- #Rational approximation for central region.
-
- elif p>= p_low and p <= p_high:
- q = p - 0.5
- r = q*q
- x = (((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q /(((((b[0]*r+b[1])*r+b[2])*r+b[3])*r+b[4])*r+1)
-
- #Rational approximation for upper region.
-
- elif p>p_high and p < 1:
- q = sqrt(-2*log(1-p))
- x = -(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1)
-
- else:
- return None
-
- if p>0 and p < 1:
- e = 0.5 * erfcc(-x/sqrt(2)) - p
- u = e * sqrt(2*pi) * exp(x*x/2)
- x = x - u/(1 + x*u/2)
- return x
- else:
- return None
-
-def erfcc(x):
- z=abs(x)
- t=1.0/(1.0+0.5*z)
- ans=t*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.0:
- return ans
- else:
- return 2.0-ans
-
-def U(n):
- x=pow(0.5,1.0/n)
- m=[1-x]
- for i in range(2,n):
- a=(i-0.3175)/(n+0.365)
- m.append(a)
- m.append(x)
- return m
-
def decodeEscape(str):
a = str
pattern = re.compile('(%[0-9A-Fa-f][0-9A-Fa-f])')
@@ -952,72 +888,6 @@ def formatField(name):
#name = name.replace("Mb Mm6", "Mb");
return name.replace("Id", "ID")
-#XZ, 03/27/2009: This function is very specific.
-#It is used by AJAX_table.py, correlationPage.py and dataPage.py
-
-
-def genTableObj(tblobj=None, file="", sortby = ("", ""), tableID = "sortable", addIndex = "1", hiddenColumns=[]):
- header = tblobj['header']
- body = tblobj['body']
- field, order = sortby
-
- #ZAS 9/12/2011 - The hiddenColumns array needs to be converted into a string so they can be placed into the javascript of each up/down button
- hiddenColumnsString = ",".join(hiddenColumns)
-
- tbl = HT.TableLite(Class="collap b2", cellspacing=1, cellpadding=5)
-
- hiddenColumnIdx = [] #indices of columns to hide
- idx = -1
- last_idx = 0 #ZS: This is the index of the last item in the regular table header (without any extra parameters). It is used to determine the index of each extra parameter.
- for row in header:
- hr = HT.TR()
- for i, item in enumerate(row):
- if (item.text == '') or (item.text not in hiddenColumns):
- if item.sort and item.text:
- down = HT.Href("javascript:xmlhttpPost('%smain.py?FormID=AJAX_table', '%s', 'sort=%s&order=down&file=%s&tableID=%s&addIndex=%s&hiddenColumns=%s')" % (webqtlConfig.CGIDIR, tableID, item.text, file, tableID, addIndex, hiddenColumnsString),IMGDESC)
- up = HT.Href("javascript:xmlhttpPost('%smain.py?FormID=AJAX_table', '%s', 'sort=%s&order=up&file=%s&tableID=%s&addIndex=%s&hiddenColumns=%s')" % (webqtlConfig.CGIDIR, tableID, item.text, file, tableID, addIndex, hiddenColumnsString),IMGASC)
- if item.text == field:
- idx = item.idx
- last_idx = idx
- if order == 'up':
- up = IMGASCON
- elif order == 'down':
- down = IMGDESCON
- item.html.append(HT.Div(up, down, style="float: bottom;"))
- hr.append(item.html)
- else:
- hiddenColumnIdx.append(i)
- tbl.append(hr)
-
- for i, row in enumerate(body):
- for j, item in enumerate(row):
- if order == 'down':
- if (item.val == '' or item.val == 'x' or item.val == 'None'):
- item.val = 0
- if order == 'up':
- if (item.val == '' or item.val == 'x' or item.val == 'None'):
- item.val = 'zzzzz'
-
- if idx >= 0:
- if order == 'down':
- body.sort(lambda A, B: cmp(B[idx].val, A[idx].val), key=natsort_key)
- elif order == 'up':
- body.sort(lambda A, B: cmp(A[idx].val, B[idx].val), key=natsort_key)
- else:
- pass
-
- for i, row in enumerate(body):
- hr = HT.TR(Id = row[0].text)
- for j, item in enumerate(row):
- if (j not in hiddenColumnIdx):
- if j == 0:
- if addIndex == "1":
- item.html.contents = [i+1] + item.html.contents
- hr.append(item.html)
- tbl.append(hr)
-
- return tbl
-
def natsort_key(string):
r = []
for c in string:
@@ -1027,4 +897,4 @@ def natsort_key(string):
except: r.append(c)
except:
r.append(c)
- return r
+ return r \ No newline at end of file