def autoscale(self, *args): """ Autoscale the fft plot to the last frame. Set the dynamic range and reference level. """ if not len(self.samples): return min_level, max_level = common.get_min_max_fft(self.samples) #set the range to a clean number of the dynamic range self[Y_PER_DIV_KEY] = common.get_clean_num(1+(max_level - min_level)/self[Y_DIVS_KEY]) #set the reference level to a multiple of y per div self[REF_LEVEL_KEY] = self[Y_PER_DIV_KEY]*round(.5+max_level/self[Y_PER_DIV_KEY])
def autoscale(self, *args): """ Autoscale the waterfall plot to the last frame. Set the dynamic range and reference level. Does not affect the current data in the waterfall. """ if not len(self.samples): return min_level, max_level = common.get_min_max_fft(self.samples) #set the range and level self[DYNAMIC_RANGE_KEY] = common.get_clean_num(max_level - min_level) self[REF_LEVEL_KEY] = DYNAMIC_RANGE_STEP*round(.5+max_level/DYNAMIC_RANGE_STEP)