def compute_metric(self): bad_hosts=tspl_utils.lost_data(self.ts) if len(bad_hosts) > 0: print(self.ts.j.id, ': Detected hosts with bad data: ', bad_hosts) return vals=[] for i in [x + 2 for x in range(self.ts.size-4)]: vals.append(self.compute_fit_params(i)) vals2=[] for v in vals: vals2.append([ b/a for (a,b) in v]) arr=numpy.array(vals2) brr=numpy.transpose(arr) (m,n)=numpy.shape(brr) r=[] for i in range(m): jnd=numpy.argmin(brr[i,:]) r.append((jnd,brr[i,jnd])) for (ind,ratio) in r: self.metric = min(ratio,self.metric) return
def compute_metric(self): if len(tspl_utils.lost_data(self.ts)) > 0: print(self.ts.j.id, ': Detected hosts with bad data') return self.tmid=(self.ts.t[:-1]+self.ts.t[1:])/2.0 self.dt = numpy.diff(self.ts.t) #skip first and last two time slices vals=[] for i in [x + 2 for x in range(self.ts.size-4)]: vals.append(self.compute_fit_params(i)) #times hosts ----> # | # | # | # V self.metric = numpy.array(vals).min() return
def compute_metric(self): if len(tspl_utils.lost_data(self.ts)) > 0: print(self.ts.j.id, ': Detected hosts with bad data') return self.tmid = (self.ts.t[:-1] + self.ts.t[1:]) / 2.0 self.dt = numpy.diff(self.ts.t) #skip first and last two time slices vals = [] for i in [x + 2 for x in range(self.ts.size - 4)]: vals.append(self.compute_fit_params(i)) #times hosts ----> # | # | # | # V try: self.metric = numpy.array(vals).min() except: pass return