# HG changeset patch # User Henry S. Thompson # Date 1700855572 0 # Node ID 684370d1bf22be96fedcce1707e23045ac98834b # Parent d88c8d40259a9a5a8172261d1f3de6eaa774ecbd do the __main__ thing diff -r d88c8d40259a -r 684370d1bf22 lib/python/cc/spearman.py --- a/lib/python/cc/spearman.py Fri Nov 24 19:52:14 2023 +0000 +++ b/lib/python/cc/spearman.py Fri Nov 24 19:52:52 2023 +0000 @@ -151,11 +151,11 @@ x_mean_ranked[i], fd_ranked[i]] for i in range(N)]) -def main(): - global counts, id, corr, ALL, all_s, all_m, x, xd, xs, xm, xsd, x_ranks, rr +def main(file,id): + # this should be a class with all these globals as instance vars + global counts, corr, ALL, all_s, all_m, x, xd, xs, xm, xsd, x_ranks, rr global aa, aa_by_all, N - counts=loadtxt(sys.argv[1]+".csv",delimiter=',') - id=sys.argv[2] + counts=loadtxt(file+".csv",delimiter=',') N=counts.shape[1]-1 # "If axis=0 (default), then each column represents a variable, with # observations in the rows" @@ -181,6 +181,10 @@ aa=ranks() aa_by_all=aa[aa[:,1].argsort()] +if __name__ == '__main__': + sys.exit(main(*sys.argv[1:])) + + ### I need to review rows, e.g. counts[0] is an array of N+1 counts ### for the most common label in the complete crawl, ### from the complete crawl and ALL the segments