Mercurial > hg > cc > cirrus_work
changeset 175:684370d1bf22
do the __main__ thing
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Fri, 24 Nov 2023 19:52:52 +0000 |
parents | d88c8d40259a |
children | 08e903ed5a98 |
files | lib/python/cc/spearman.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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