source: script/analizzaRisultati.py @ 26

Last change on this file since 26 was 25, checked in by gnappo, 14 years ago

Piccola modifica al generatore pseudo casuale da cui è possibile farsi restituire il seme. Aggiunta di alcuni script per analizzare l'output e creazione struttura directory provvisioria per l'output.

  • Property svn:executable set to *
File size: 695 bytes
RevLine 
[25]1#!/usr/bin/python
2
3import statistics
4import sys
5import re
6from re import split
7from math import sqrt
8import os
9
10basedir = sys.argv[1]
11
12filesList = [basedir + file for file in os.listdir(basedir) if (re.match('.*dat$', file) and not re.match('^output.*', file))]
13
14results = []
15for file in filesList:
16    inp = open(file,"r")
17    values = []
18    for line in inp.readlines():
19        values.append(float(line))
20    inp.close()
21    print "File ",file," acquisito."
22    results.append(statistics.mean(values))
23variance = statistics.variance(results, mode = "Unbiased")
24confidence = sqrt(variance / len(results)) * 1.6449
25print "Average: ",statistics.mean(results)," Confidence interval: ",confidence
Note: See TracBrowser for help on using the repository browser.