-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalyse_MC_inversion.py
executable file
·56 lines (47 loc) · 1.21 KB
/
analyse_MC_inversion.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
#!/usr/bin/env python
# -*- coding:Utf-8 -*-
from glob import glob
from io import StringIO
import numpy as np
from scipy.stats import norm
import xml.etree.ElementTree as ET
pat = "report.xml*"
files = glob(pat)
if not files:
raise FileNotFoundError('did not find files with glob {}'.format(pat))
mat = []
cal = []
chi = []
for i in files:
print(i)
handler = ET.parse(i)
bal0 = handler.find("/chi2v")
chi.append(float(bal0.text))
bal = handler.find("/Specie/logvalues")
print(bal.text)
data = np.loadtxt(StringIO(bal.text))
bal2 = handler.find("/calibration")
calibration = float(bal2.text)
mat.append(data)
cal.append(calibration)
vals = np.matrix(mat)
cali = np.array(cal)
chiv = np.array(chi)
# print vals[:,0]
print("Points analysis")
for i in range(len(files)):
print(i, ")------")
ptx = vals[:, i]
mu, sigma = norm.fit(ptx)
print(mu, sigma)
print(ptx.mean(), ptx.std())
print("--------------------")
print("Calibration analysis :")
mu, sigma = norm.fit(cali)
print(cali.mean(), cali.std())
print(mu, sigma)
print("Chi2v analysis :")
mu, sigma = norm.fit(chiv)
print(chiv.mean(), chiv.std())
print(mu, sigma)
print("Min", min(chiv), "Max", max(chiv))