Files
sf-rf/script/KR84_test.py
2016-07-01 08:54:55 +02:00

66 lines
2.2 KiB
Python

# struct definition to hold all relevant statistics data
class statistics_data (object):
min = 0.0
mean = 0.0
max = 0.0
sigma = 0.0
# struct definition for statistics dat aof all three amplitude levels
class all_statistics_data (object):
sat = statistics_data()
m5 = statistics_data()
m10 = statistics_data()
def print(self):
print "Statistics:\t\tmin\tmean\tmax\tstdev
print "Saturation :" + str(self.sat.min) + "\t" + str(self.sat.mean) + "\t" + str(self.sat.max) + "\t" + str(self.sat.stdev)
print "5% out of sat :" + str(self.m5.min) + "\t" + str(self.m5.mean) + "\t" + str(self.m5.max) + "\t" + str(self.m5.stdev)
print "10% out of sat:" + str(self.m10.min) + "\t" + str(self.m10.mean) + "\t" + str(self.m10.max) + "\t" + str(self.m10.stdev)
def statistics_calc(data_in):
"function calculates the min/max/mean/stdev of an array"
temp = statistics_data();
temp.mean = mean (data_in)
temp.min = min (data_in)
temp.max = max (data_in)
temp.stdev = stdev(data_in)
return temp
def all_statistics_calc(data_in):
"function calculates for all three amplitudes the statistics data."
temp = all_statistics_data();
temp.m10 = statistics_calc (data_in[0:35])
temp.m5 = statistics_calc (data_in[36:71])
temp.sat = statistics_calc (data_in[72:107])
return temp
# create emtpy structs
ref_jit_amplt = all_statistics_data()
ref_jit_phase = all_statistics_data()
iqm_jit_amplt = all_statistics_data()
iqm_jit_phase = all_statistics_data()
pre_jit_amplt = all_statistics_data()
pre_jit_phase = all_statistics_data()
kly_jit_amplt = all_statistics_data()
kly_jit_phase = all_statistics_data()
# calculate statistics
ref_jit_amplt = all_statistics_calc(scan_result.getReadable(0))
ref_jit_phase = all_statistics_calc(scan_result.getReadable(1))
iqm_jit_amplt = all_statistics_calc(scan_result.getReadable(2))
iqm_jit_phase = all_statistics_calc(scan_result.getReadable(3))
pre_jit_amplt = all_statistics_calc(scan_result.getReadable(4))
pre_jit_phase = all_statistics_calc(scan_result.getReadable(5))
kly_jit_amplt = all_statistics_calc(scan_result.getReadable(6))
kly_jit_phase = all_statistics_calc(scan_result.getReadable(7))