-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautocorrelations.py
78 lines (71 loc) · 2.51 KB
/
autocorrelations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu May 16 15:56:30 2019
@author: kovnerd
"""
import pandas as pd
#import matlab.engine
import glob
import ast
def main():
#read data from _ens file
#read sim details from _details file
temps = [];
ensembleSize = 0;
Ncor = 0;
Ntherm = 0;
name = raw_input("name of run? (don't include ext) ");
size = int(raw_input("lattice size? "));
files = glob.glob("runs/" + name + "*" + "_" + str(size) +".txt");
found = False;
data = pd.DataFrame();
if(len(files) == 0):
print("File not found!");
return;
else:
for fname in files:
if fname.find("_ens_") != -1:
data = pd.read_csv(fname, sep = " ");
found = True;
break;
else:
found = False;
if(not found):
print("Error, ensemble data not found!");
for fname in files:
#print(fname);
if fname.find("_info_") != -1:
with open(fname, "r") as infofile:
lines = infofile.readlines();
for i in range(len(lines)):
lines[i] = lines[i].split('=')[1];
size = ast.literal_eval(lines[0]);
temps = ast.literal_eval(lines[1]);
ensembleSize = ast.literal_eval(lines[2]);
Ncor = ast.literal_eval(lines[3]);
Ntherm = ast.literal_eval(lines[4]);
found = True;
break;
break;
else:
found = False;
if(not found):
print("Error, run info not found!");
print(data);
print("size = " + str(size));
print("temps = " + str(temps));
print("ensembleSize = " + str(ensembleSize));
print("Ncor = " + str(Ncor));
print("Ntherm = " + str(Ntherm));
#DATA = matrix with dimensions [ensembleSize, 1] with data at T = 26
#data.
Stau = 1.5;#STAU = an initial guess as to tau/tauInt (not sure what this is??)
Nrep = [ensembleSize]; #NREP = a vector sspecifying how to break up the rows of DATA into replicas (set this to [ensembleSize]?)
Name = "\sigma^2";#NAME = name of observable to be used in plots ("sigma^2" or "\sigma^2"?)
quantity = 1;
eng = matlab.engine.start_matlab();
out = eng.UWerr(convertedData,Stau,Nrep,Name,quantity, nargout=6);
eng.quit();
#execute UWerr.m with above parameters
main();