Mercurial > hg > lib > markup
comparison python/cluster.py @ 5:672621ab4db4
trim points we check to a circle per radius
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Tue, 25 May 2021 17:19:00 -0400 |
parents | 56508a6033a9 |
children | 3ee329b129c6 |
comparison
equal
deleted
inserted
replaced
4:56508a6033a9 | 5:672621ab4db4 |
---|---|
27 with open(outfile_name,'w') as outfile: | 27 with open(outfile_name,'w') as outfile: |
28 l=infile.readline().rstrip() | 28 l=infile.readline().rstrip() |
29 print(l,file=outfile) | 29 print(l,file=outfile) |
30 ff=PPAT.split(l) | 30 ff=PPAT.split(l) |
31 (nr,ox,oy,oz)=intsMaybe(ff) | 31 (nr,ox,oy,oz)=intsMaybe(ff) |
32 home=(float(ox),float(oy),float(oz)) | |
32 et=ff[9] | 33 et=ff[9] |
33 l=infile.readline().rstrip() | 34 l=infile.readline().rstrip() |
34 print(l,file=outfile) | 35 print(l,file=outfile) |
35 (orad,ymin,ymax)=intsMaybe(PPAT.split(l)) | 36 (orad,ymin,ymax)=intsMaybe(PPAT.split(l)) |
36 print(nr,ox,oy,oz,et,orad,ymin,ymax) | |
37 _=infile.readline() | 37 _=infile.readline() |
38 for l in infile: | 38 for l in infile: |
39 found=False | 39 found=False |
40 q=[float(i) for i in l.split('\t')[2].split(',')] | 40 (_,td,qd)=l.rstrip().split('\t') |
41 q=[float(i) for i in qd.split(',')] | |
42 td=float(td) | |
43 if td>orad: | |
44 # Enforce a circular region, not square | |
45 break | |
41 for c in cc: | 46 for c in cc: |
42 for p in c: | 47 for p in c: |
43 if d(p,q)<=n: | 48 if d(p,q)<=n: |
44 c.append(q) | 49 c.append(q) |
45 found=True | 50 found=True |