minor: simplify analysis readme line

This commit is contained in:
Justin Clark-Casey
2014-07-17 01:23:10 +01:00
parent 3db4f63caa
commit 1783cb60c7
3 changed files with 32 additions and 15 deletions
+1 -2
View File
@@ -12,8 +12,7 @@ individual READMEs
## analysis ##
Tools for analysing OpenSimulator or related data files and for extracting
relevant system information.
Tools for analysing OpenSimulator or related data files.
## commands ##
@@ -45,6 +45,17 @@ class OSimStatsCorpus:
else:
return None
def getStats(self, glob):
matchingStats = []
for category, containers in self._data.items():
for container, stats in containers.items():
for statName, stat in stats.items():
if fnmatch.fnmatch(stat['fullName'], glob):
matchingStats.append(stat)
return matchingStats
"""Clear out any existing dataset."""
def clear(self):
self._data = {}
@@ -2,6 +2,7 @@
import argparse
import matplotlib.pyplot as plt
import sys
from pylab import *
from osta.osta import *
@@ -22,24 +23,30 @@ parser.add_argument(
parser.add_argument(
'statsLogPath',
help = "Path to the stats log file.",
metavar = "stats-log-path")
metavar = "stats-log-path",
nargs='*')
opts = parser.parse_args()
corpus = OSimStatsCorpus()
corpus.parse(opts.statsLogPath)
stat = corpus.getStat(opts.select)
for path in opts.statsLogPath:
corpus.parse(path)
if not stat == None:
plt.plot(stat['abs']['values'])
plt.title(stat['fullName'])
plt.xlabel("samples")
plt.ylabel(stat['name'])
stats = corpus.getStats(opts.select)
if len(stats) <= 0:
print "No stats matching %s" % (opts.select)
sys.exit(1)
plt.title(opts.select)
plt.ylabel(stats[0]['name'])
for stat in stats:
plt.plot(stat['abs']['values'])
plt.xlabel("samples")
if 'out' in opts:
savefig(opts.out)
else:
plt.show()
if 'out' in opts:
savefig(opts.out)
else:
print "No such stat as %s" % (opts.select)
plt.show()