def _example(): from stars import Project s = Project("s") s.ReadData("csiss") income = s.getVariable("pcincome") ym = ClMarkov(income) ym.transMat s.ReadGalMatrix("states48") w = s.getMatrix("states48") sm = SpMarkov(income, w=w) return [ym, income.regionNames, sm]
# create an instance #t=DataTable(root,values,name="Variable Name Here",rowLabels=rowLabels, # columnLabels=columnLabels,fmt=[8,0]) # from stars import Project from Markov import * s=Project('s') s.ReadData("data/csiss") y = s.getVariable('pcr') n,k = shape(y) #values=y #ijs = [ (i,j) for i in range(n) for j in range(k) ] #svalues = [ format([8,3], values[i,j]) for i,j in ijs ] s.ReadGalMatrix('states48') w=s.getMatrix('states48') sm = SpMarkov(y,w=w) classes = [ "%5.3f"% value for value in sm.upperBounds ] k=len(classes) rowLabels = [ c+" | "+r for r in classes for c in classes ] mat = sm.pMat mat = reshape(mat,(k*k,k)) st = DataTable(root,mat,rowLabels=rowLabels, columnLabels=classes,fmt=[8,3], name='Spatial Markov Transition Probabilities') top = Toplevel(root) yt = DataTable(top,y, rowLabels=s.regionNames, columnLabels=s.timeString, fmt=[8,3],name="PCR")