Esempio n. 1
0
def general_results(model, results):
    global nfailed, nsucceeded

    results["size"] = model.size
    results["load"] = model.load
    counts["GENERAL"] += 2

    # grid performance
    results["resource_util"] = stats.mean_resource_util(model)
    results["server_util"] = stats.mean_server_util(model)
    results["queue_time"] = stats.mean_queue_time(model)
    results["prop_failed"] = njobs.prop_failed
    
    results["succeed_sizes_mean"] = succeeded_tracker.sizes.mean()
    results["succeed_sizes_skew"] = stats.skew(succeeded_tracker.sizes)

    results["succeed_times_mean"] = succeeded_tracker.times.mean()
    results["succeed_times_skew"] = stats.skew(succeeded_tracker.times)
    
    results["failed_sizes_mean"] = failed_tracker.sizes.mean() if njobs.failed else 0
    results["failed_sizes_skew"] = stats.skew(failed_tracker.sizes) if njobs.failed else 0
    
    results["failed_times_mean"] = failed_tracker.times.mean() if njobs.failed else 0
    results["failed_times_skew"] = stats.skew(failed_tracker.times) if njobs.failed else 0 
    
    counts["GRID"] += 12

    return results
Esempio n. 2
0
 def calculate_stats_num(self, name, per = [5,25,50,75,95]):
     # get columnt instance
     Col = self.get_column(name)
     # type validation
     assert Col.type == 'numerical', 'only possible numerical columns.'
     # get data
     data = self.get_data(name)
     # initialize
     dstats = dict()
     # calculate statistics
     dstats['mean'] = stats.mean(data)
     dstats['median'] = stats.median(data)
     dstats['std'] = stats.std(data)
     dstats['min'] = stats.min(data)
     dstats['max'] = stats.max(data)
     dstats['skew'] = stats.skew(data)
     dstats['kurtosis'] = stats.kurtosis(data)
     for ip in per:
         dstats['per%s'%ip] = stats.percentile(data, ip)
     # return
     Col.stats = dstats
Esempio n. 3
0
a = N.array(l)
af = N.array(lf)
ll = [l]*5
aa = N.array(ll)

print('\nCENTRAL TENDENCY')
print('geometricmean:',stats.geometricmean(l), stats.geometricmean(lf), stats.geometricmean(a), stats.geometricmean(af))
print('harmonicmean:',stats.harmonicmean(l), stats.harmonicmean(lf), stats.harmonicmean(a), stats.harmonicmean(af))
print('mean:',stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af))
print('median:',stats.median(l),stats.median(lf),stats.median(a),stats.median(af))
print('medianscore:',stats.medianscore(l),stats.medianscore(lf),stats.medianscore(a),stats.medianscore(af))
print('mode:',stats.mode(l),stats.mode(a))
print('\nMOMENTS')
print('moment:',stats.moment(l),stats.moment(lf),stats.moment(a),stats.moment(af))
print('variation:',stats.variation(l),stats.variation(a),stats.variation(lf),stats.variation(af))
print('skew:',stats.skew(l),stats.skew(lf),stats.skew(a),stats.skew(af))
print('kurtosis:',stats.kurtosis(l),stats.kurtosis(lf),stats.kurtosis(a),stats.kurtosis(af))
print('mean:',stats.mean(a),stats.mean(af))
print('var:',stats.var(a),stats.var(af))
print('stdev:',stats.stdev(a),stats.stdev(af))
print('sem:',stats.sem(a),stats.sem(af))
print('describe:')
print(stats.describe(l))
print(stats.describe(lf))
print(stats.describe(a))
print(stats.describe(af))
print('\nFREQUENCY')
print('freqtable:')
print('itemfreq:')
print(stats.itemfreq(l))
print(stats.itemfreq(a))
Esempio n. 4
0
af = N.array(lf)
ll = [l]*5
aa = N.array(ll)

print '\nCENTRAL TENDENCY'
print 'geometricmean:',stats.geometricmean(l), stats.geometricmean(lf), stats.geometricmean(a), stats.geometricmean(af)
print 'harmonicmean:',stats.harmonicmean(l), stats.harmonicmean(lf), stats.harmonicmean(a), stats.harmonicmean(af)
print 'mean:',stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af)
print 'median:',stats.median(l),stats.median(lf),stats.median(a),stats.median(af)
print 'medianscore:',stats.medianscore(l),stats.medianscore(lf),stats.medianscore(a),stats.medianscore(af)
print 'mode:',stats.mode(l),stats.mode(a)

print '\nMOMENTS'
print 'moment:',stats.moment(l),stats.moment(lf),stats.moment(a),stats.moment(af)
print 'variation:',stats.variation(l),stats.variation(a),stats.variation(lf),stats.variation(af)
print 'skew:',stats.skew(l),stats.skew(lf),stats.skew(a),stats.skew(af)
print 'kurtosis:',stats.kurtosis(l),stats.kurtosis(lf),stats.kurtosis(a),stats.kurtosis(af)
print 'tmean:',stats.tmean(a,(5,17)),stats.tmean(af,(5,17))
print 'tvar:',stats.tvar(a,(5,17)),stats.tvar(af,(5,17))
print 'tstdev:',stats.tstdev(a,(5,17)),stats.tstdev(af,(5,17))
print 'tsem:',stats.tsem(a,(5,17)),stats.tsem(af,(5,17))
print 'describe:'
print stats.describe(l)
print stats.describe(lf)
print stats.describe(a)
print stats.describe(af)

print '\nFREQUENCY'
print 'freqtable:'
print 'itemfreq:'
print stats.itemfreq(l)
Esempio n. 5
0
    lf), stats.geometricmean(a), stats.geometricmean(af)
print 'harmonicmean:', stats.harmonicmean(l), stats.harmonicmean(
    lf), stats.harmonicmean(a), stats.harmonicmean(af)
print 'mean:', stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af)
print 'median:', stats.median(l), stats.median(lf), stats.median(
    a), stats.median(af)
print 'medianscore:', stats.medianscore(l), stats.medianscore(
    lf), stats.medianscore(a), stats.medianscore(af)
print 'mode:', stats.mode(l), stats.mode(a)

print '\nMOMENTS'
print 'moment:', stats.moment(l), stats.moment(lf), stats.moment(
    a), stats.moment(af)
print 'variation:', stats.variation(l), stats.variation(a), stats.variation(
    lf), stats.variation(af)
print 'skew:', stats.skew(l), stats.skew(lf), stats.skew(a), stats.skew(af)
print 'kurtosis:', stats.kurtosis(l), stats.kurtosis(lf), stats.kurtosis(
    a), stats.kurtosis(af)
print 'mean:', stats.mean(a), stats.mean(af)
print 'var:', stats.var(a), stats.var(af)
print 'stdev:', stats.stdev(a), stats.stdev(af)
print 'sem:', stats.sem(a), stats.sem(af)
print 'describe:'
print stats.describe(l)
print stats.describe(lf)
print stats.describe(a)
print stats.describe(af)

print '\nFREQUENCY'
print 'freqtable:'
print 'itemfreq:'
Esempio n. 6
0
 def _fill_moment_results(self):
     """
     Fills the result arrays used for storing the calculated moments
      common format: time, mean, mode, var, skewness, kurtosis,
                     95% confidence lower limit, 95% upper limit
     """
     toprocess = [('stock_tom', self.c_stock, 2),
                  ('stock_woody', self.c_stock, 3),
                  ('stock_non_woody', self.c_stock, 4),
                  ('stock_acid', self.c_stock, 5),
                  ('stock_water', self.c_stock, 6),
                  ('stock_ethanol',  self.c_stock, 7),
                  ('stock_non_soluble', self.c_stock, 8),
                  ('stock_humus', self.c_stock, 9),
                  ('change_tom', self.c_change, 2),
                  ('change_woody', self.c_change, 3),
                  ('change_non_woody', self.c_change, 4),
                  ('change_acid', self.c_change, 5),
                  ('change_water', self.c_change, 6),
                  ('change_ethanol', self.c_change, 7),
                  ('change_non_soluble', self.c_change, 8),
                  ('change_humus', self.c_change, 9),
                  ('co2', self.co2_yield, 2)]
     for (resto, dataarr, dataind) in toprocess:
         # filter time steps
         ts = numpy.unique(dataarr[:,1])
         # extract data for the timestep
         for timestep in ts:
             ind = numpy.where(dataarr[:,1]==timestep)
             mean = stats.mean(dataarr[ind[0], dataind])
             mode_res = stats.mode(dataarr[ind[0], dataind])
             mode = mode_res[0]
             var = stats.var(dataarr[ind[0], dataind])
             skew = stats.skew(dataarr[ind[0], dataind])
             kurtosis = stats.kurtosis(dataarr[ind[0], dataind])
             if var>0.0:
                 sd2 = 2 * math.sqrt(var)
             else:
                 sd2 = var
             res = [[timestep, mean, mode[0], var, skew, kurtosis,
                    mean - sd2, mean + sd2]]
             if resto=='stock_tom':
                 self.md.stock_tom = numpy.append(self.md.stock_tom,
                                                  res, axis=0)
             elif resto=='stock_woody':
                 self.md.stock_woody = numpy.append(self.md.stock_woody,
                                                    res, axis=0)
             elif resto=='stock_non_woody':
                 self.md.stock_non_woody = numpy.append(\
                         self.md.stock_non_woody, res, axis=0)
             elif resto=='stock_acid':
                 self.md.stock_acid = numpy.append(self.md.stock_acid,
                                                   res, axis=0)
             elif resto=='stock_water':
                 self.md.stock_water = numpy.append(self.md.stock_water,
                                                    res, axis=0)
             elif resto=='stock_ethanol':
                 self.md.stock_ethanol = numpy.append(self.md.stock_ethanol,
                                                      res, axis=0)
             elif resto=='stock_non_soluble':
                 self.md.stock_non_soluble= numpy.append(
                                     self.md.stock_non_soluble, res, axis=0)
             elif resto=='stock_humus':
                 self.md.stock_humus = numpy.append(self.md.stock_humus,
                                                    res, axis=0)
             elif resto=='change_tom':
                 self.md.change_tom = numpy.append(self.md.change_tom,
                                                   res, axis=0)
             elif resto=='change_woody':
                 self.md.change_woody = numpy.append(self.md.change_woody,
                                                     res, axis=0)
             elif resto=='change_non_woody':
                 self.md.change_non_woody = numpy.append(\
                         self.md.change_non_woody, res, axis=0)
             elif resto=='change_acid':
                 self.md.change_acid = numpy.append(self.md.change_acid,
                                                    res, axis=0)
             elif resto=='change_water':
                 self.md.change_water = numpy.append(self.md.change_water,
                                                     res, axis=0)
             elif resto=='change_ethanol':
                 self.md.change_ethanol = numpy.append(
                                         self.md.change_ethanol, res, axis=0)
             elif resto=='change_non_soluble':
                 self.md.change_non_soluble=numpy.append(
                                     self.md.change_non_soluble, res, axis=0)
             elif resto=='change_humus':
                 self.md.change_humus = numpy.append(self.md.change_humus,
                                                     res, axis=0)
             elif resto=='co2':
                 self.md.co2 = numpy.append(self.md.co2, res, axis=0)
Esempio n. 7
0
 def _fill_moment_results(self):
     """
     Fills the result arrays used for storing the calculated moments
      common format: time, mean, mode, var, skewness, kurtosis,
                     95% confidence lower limit, 95% upper limit
     """
     toprocess = [('stock_tom', self.c_stock, 2),
                  ('stock_woody', self.c_stock, 3),
                  ('stock_non_woody', self.c_stock, 4),
                  ('stock_acid', self.c_stock, 5),
                  ('stock_water', self.c_stock, 6),
                  ('stock_ethanol', self.c_stock, 7),
                  ('stock_non_soluble', self.c_stock, 8),
                  ('stock_humus', self.c_stock, 9),
                  ('change_tom', self.c_change, 2),
                  ('change_woody', self.c_change, 3),
                  ('change_non_woody', self.c_change, 4),
                  ('change_acid', self.c_change, 5),
                  ('change_water', self.c_change, 6),
                  ('change_ethanol', self.c_change, 7),
                  ('change_non_soluble', self.c_change, 8),
                  ('change_humus', self.c_change, 9),
                  ('co2', self.co2_yield, 2)]
     for (resto, dataarr, dataind) in toprocess:
         # filter time steps
         ts = numpy.unique(dataarr[:, 1])
         # extract data for the timestep
         for timestep in ts:
             ind = numpy.where(dataarr[:, 1] == timestep)
             mean = stats.mean(dataarr[ind[0], dataind])
             mode_res = stats.mode(dataarr[ind[0], dataind])
             mode = mode_res[0]
             var = stats.var(dataarr[ind[0], dataind])
             skew = stats.skew(dataarr[ind[0], dataind])
             kurtosis = stats.kurtosis(dataarr[ind[0], dataind])
             if var > 0.0:
                 sd2 = 2 * math.sqrt(var)
             else:
                 sd2 = var
             res = [[
                 timestep, mean, mode[0], var, skew, kurtosis, mean - sd2,
                 mean + sd2
             ]]
             if resto == 'stock_tom':
                 self.md.stock_tom = numpy.append(self.md.stock_tom,
                                                  res,
                                                  axis=0)
             elif resto == 'stock_woody':
                 self.md.stock_woody = numpy.append(self.md.stock_woody,
                                                    res,
                                                    axis=0)
             elif resto == 'stock_non_woody':
                 self.md.stock_non_woody = numpy.append(\
                         self.md.stock_non_woody, res, axis=0)
             elif resto == 'stock_acid':
                 self.md.stock_acid = numpy.append(self.md.stock_acid,
                                                   res,
                                                   axis=0)
             elif resto == 'stock_water':
                 self.md.stock_water = numpy.append(self.md.stock_water,
                                                    res,
                                                    axis=0)
             elif resto == 'stock_ethanol':
                 self.md.stock_ethanol = numpy.append(self.md.stock_ethanol,
                                                      res,
                                                      axis=0)
             elif resto == 'stock_non_soluble':
                 self.md.stock_non_soluble = numpy.append(
                     self.md.stock_non_soluble, res, axis=0)
             elif resto == 'stock_humus':
                 self.md.stock_humus = numpy.append(self.md.stock_humus,
                                                    res,
                                                    axis=0)
             elif resto == 'change_tom':
                 self.md.change_tom = numpy.append(self.md.change_tom,
                                                   res,
                                                   axis=0)
             elif resto == 'change_woody':
                 self.md.change_woody = numpy.append(self.md.change_woody,
                                                     res,
                                                     axis=0)
             elif resto == 'change_non_woody':
                 self.md.change_non_woody = numpy.append(\
                         self.md.change_non_woody, res, axis=0)
             elif resto == 'change_acid':
                 self.md.change_acid = numpy.append(self.md.change_acid,
                                                    res,
                                                    axis=0)
             elif resto == 'change_water':
                 self.md.change_water = numpy.append(self.md.change_water,
                                                     res,
                                                     axis=0)
             elif resto == 'change_ethanol':
                 self.md.change_ethanol = numpy.append(
                     self.md.change_ethanol, res, axis=0)
             elif resto == 'change_non_soluble':
                 self.md.change_non_soluble = numpy.append(
                     self.md.change_non_soluble, res, axis=0)
             elif resto == 'change_humus':
                 self.md.change_humus = numpy.append(self.md.change_humus,
                                                     res,
                                                     axis=0)
             elif resto == 'co2':
                 self.md.co2 = numpy.append(self.md.co2, res, axis=0)