Exemple #1
0
 def std(self, axis=None, dtype=None, out=None, ddof=1):
     """
     Compute unbiased standard deviation of non-null values
     """
     nona = remove_na(self.values)
     if len(nona) < 2:
         return NaN
     return ndarray.std(nona, axis, dtype, out, ddof)
Exemple #2
0
 def std(self, axis=None, dtype=None, out=None, ddof=1):
     """
     Unbiased standard deviation of non-null values
     """
     nona = remove_na(self.values)
     if len(nona) < 2:
         return NaN
     return ndarray.std(nona, axis, dtype, out, ddof)
Exemple #3
0
def compute_stats(samples_healthy, samples_unhealthy, samples_s, samples):
    samples_healthy = array(samples_healthy)
    samples_unhealthy = array(samples_unhealthy)
    samples_s = array(samples_s)

    healthy_mean = ndarray.mean(samples_healthy,0)
    unhealthy_mean = ndarray.mean(samples_unhealthy, 0)
    s_mean = ndarray.mean(samples_s, 0)

    healthy_std = ndarray.std(samples_healthy, 0, dtype=float64)
    unhealthy_std = ndarray.std(samples_unhealthy, 0, dtype=float64)
    s_std = ndarray.std(samples_s, 0, dtype=float64)

    print "Healthy means: \t", healthy_mean
    print "Unhealthy means: \t", unhealthy_mean
    print "S means: \t\t", s_mean
    print "Healthy standard dev: \t", healthy_std
    print "Unhealthy standard dev: \t", unhealthy_std
    print "S standard dev: \t", s_std

    x1 = range(len(samples_healthy))
    x2 = range(len(samples_unhealthy))
    x3 = range(len(samples_s))
    dur1 = [sample[0] for sample in samples_healthy]
    mean1 = [sample[1]  for sample in samples_healthy]
    var1 = [sample[2] for sample in samples_healthy]
    dur2 = [sample[0] for sample in samples_unhealthy]
    mean2 = [sample[1]  for sample in samples_unhealthy]
    var2 = [sample[2]  for sample in samples_unhealthy]
    dur3 = [sample[0] for sample in samples_s]
    mean3 = [sample[1]  for sample in samples_s]
    var3 = [sample[2]  for sample in samples_s]

    plt.figure()
    plt.hist(mean1, normed=True, bins=100, color='red', range=(0, 50))

    plt.figure()
    plt.hist(mean2, normed=True, bins=100, color='green', range=(0, 50))

    plt.figure()
    plt.hist(mean3, normed=True, bins=100, color='blue', range=(0, 50))

    plt.show()