Difference between revisions of "Colourdiscon.py"
Jump to navigation
Jump to search
import>Mp466 |
import>Mp466 |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Script useful for DISCONNECTIVITY users |
||
⚫ | |||
⚫ | |||
+ | To do this save the code in ''colourdiscon.py'' file, change privileges of this file: |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | chmod 755 colourdiscon.py |
||
− | """ |
||
⚫ | |||
− | into a set of bins by an order parameter |
||
+ | and type: |
||
⚫ | |||
+ | ./Colourdiscon.py list |
||
⚫ | |||
− | file format |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | """ |
||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
tokens=line.split() |
tokens=line.split() |
||
x.append(float(tokens[1])) |
x.append(float(tokens[1])) |
||
y.append(int(tokens[2])) |
y.append(int(tokens[2])) |
||
+ | |||
− | |||
− | total=[] |
+ | total=[] |
+ | |||
− | |||
− | for a, b in enumerate(bins): |
+ | for a, b in enumerate(bins): |
total.append([]) |
total.append([]) |
||
for i in range(len(x)): |
for i in range(len(x)): |
||
if x[i] >= b and x[i] < bins[a+1] : |
if x[i] >= b and x[i] < bins[a+1] : |
||
total[a].append(y[i]) |
total[a].append(y[i]) |
||
+ | |||
− | |||
− | for a, b in enumerate(bins): |
+ | for a, b in enumerate(bins): |
filefile="test.out.int"+str(a) |
filefile="test.out.int"+str(a) |
||
numpy.savetxt(filefile, total[a], fmt='%d') |
numpy.savetxt(filefile, total[a], fmt='%d') |
Latest revision as of 20:12, 8 May 2009
Script useful for DISCONNECTIVITY users
To do this save the code in colourdiscon.py file, change privileges of this file:
chmod 755 colourdiscon.py
and type:
./Colourdiscon.py list
#!/usr/bin/python import numpy import sys import getopt print files (test.out.int.*) comprised of a set of minima sorted into a set of bins by an order parameter Used for colouring discon graphs Order Parameter Minima # file format AMHQ 0.1653832 6 x=[] y=[] bins = [0.0, 0.4, 0.6, 0.8, 1.0] filename = sys.argv[1] f=open(filename,"r") for line in f: tokens=line.split() x.append(float(tokens[1])) y.append(int(tokens[2])) total=[] for a, b in enumerate(bins): total.append([]) for i in range(len(x)): if x[i] >= b and x[i] < bins[a+1] : total[a].append(y[i]) for a, b in enumerate(bins): filefile="test.out.int"+str(a) numpy.savetxt(filefile, total[a], fmt='%d')