def apft(self, over_sampling): N = len(self.frequencies) # choosing the samllest frequence on which # the timelevels will be discretized freq_min = np.min(np.absolute(self.frequencies)) timelevels = 6 * np.arange(0, 1., 1. / float(over_sampling)) / freq_min ap_computation = HbComputation(frequencies=self.frequencies, timelevels=timelevels) # computing the corresponding hbt_matrix ap_idft_matrix = ap_computation.ap_idft_matrix() for line in range(0, 2 * N + 1): # gramm-schmidt kinf of orthonormalization ap_idft_matrix[line + 1:, :] -= np.sum(np.dot(ap_idft_matrix[line + 1:, :], np.diag(ap_idft_matrix[line, :])), axis=0) / \ np.sum(ap_idft_matrix[line, :] ** 2) * \ ap_idft_matrix[line, :] # choossing the vector that was most othogonal to # the one of line k = np.argmax([np.linalg.norm(ap_idft_matrix[line_ind], np.inf) for line_ind in range(line, len(timelevels))]) # swapping vectors ap_idft_matrix[[line, k], :] = ap_idft_matrix[[k, line], :] timelevels[[0, k]] = timelevels[[k, 0]] del ap_idft_matrix timelevels = timelevels[:2 * N + 1] timelevels.sort(0) return timelevels
def _conditionning(self, timelevels): hb_computation = HbComputation(frequencies=self.frequencies, timelevels=timelevels) return abs(hb_computation.conditionning() - self.target)
def _conditionning(self, timelevels): ap_computation = HbComputation(frequencies=self.frequencies, timelevels=timelevels) return ap_computation.conditionning()