Last change
on this file since 38 was
29,
checked in by gnappo, 14 years ago
|
Taggata versione per la demo e aggiunto branch.
|
-
Property svn:executable set to
*
|
File size:
695 bytes
|
Rev | Line | |
---|
[29] | 1 | #!/usr/bin/python |
---|
| 2 | |
---|
| 3 | import statistics |
---|
| 4 | import sys |
---|
| 5 | import re |
---|
| 6 | from re import split |
---|
| 7 | from math import sqrt |
---|
| 8 | import os |
---|
| 9 | |
---|
| 10 | basedir = sys.argv[1] |
---|
| 11 | |
---|
| 12 | filesList = [basedir + file for file in os.listdir(basedir) if (re.match('.*dat$', file) and not re.match('^output.*', file))] |
---|
| 13 | |
---|
| 14 | results = [] |
---|
| 15 | for 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)) |
---|
| 23 | variance = statistics.variance(results, mode = "Unbiased") |
---|
| 24 | confidence = sqrt(variance / len(results)) * 1.6449 |
---|
| 25 | print "Average: ",statistics.mean(results)," Confidence interval: ",confidence |
---|
Note: See
TracBrowser
for help on using the repository browser.