def getConsistency(vectors, debug=0): if debug: rhythmMath.prnVectors(vectors) m = rhythmMath.ksdModel(vectors) if debug: rhythmMath.prnVector(m.centerVec, "center:") ratios = m.getRatios() if debug: rhythmMath.prnVector(ratios, "ratios:") rr = rhythmMath.myList(ratios) ksdDevi = rhythmMath.KsdDistance(ratios) if debug: print "sum., avg, std dev:", rr.sum, rr.average, rr.deviation, ksdDevi if debug: print return rr.deviation
def getRatiosToAvg(user, debug=0): allData = ksdMySQL.loadTable('localhost', 'root', 'wpxk00', 'rhythmpass_web') vectors = allData[user] prnUserSelect(allData.keys(), user) if len(vectors) < 1: print "NO data for", user return model = rhythmMath.ksdModel(vectors) ratios = model.getRatios() return ratios, model.avgDistToCenter
def getRatiosToAvg(user, debug=0): allData = ksdMySQL.loadTable('localhost', 'root', 'wpxk00', 'rhythmpass_web') vectors = allData[user] if len(vectors) < 1: print "NO data for", user return model = rhythmMath.ksdModel(vectors) ratios = [] for v in vectors: ratios.append(model.ratioToAvg(v)) if debug: print ratios return ratios, model.avgDist
def getKSDinfo(user, vectors): model = rhythmMath.ksdModel(vectors) ratios = model.getRatios() rr = rhythmMath.myList(ratios) res = [] #res.append(user) res.append("""<a href="/demo.py?user=%s"> %s </a>""" % (user, user)) res.append("%.1f" % model.avgDistToCenter) res.append( rhythmMath.vecToStr(ratios) ) res.append("%.1f" % rr.deviation) res.append("%.1f" % model.centerSize) res.append( rhythmMath.vecToStr(model.centerVec) ) return res