def matlab_fn_as_matlab_input_data(self, filename): data = load_json(os.path.join('shrp', filename)) mag, index = two_max(data['x'], int(data['lowerbound']) - 1, int(data['upperbound']) - 1, data['unitlen']) np.testing.assert_array_almost_equal(mag, data['mag']) np.testing.assert_array_almost_equal(index, int(data['index']) - 1)
def matlab_fn_as_matlab_input_data(self, filename): data = load_json(os.path.join('shrp',filename)) mag, index = two_max(data['x'], int(data['lowerbound'])-1, int(data['upperbound'])-1, data['unitlen']) np.testing.assert_array_almost_equal(mag, data['mag']) np.testing.assert_array_almost_equal(index, int(data['index'])-1)
def test_second_peak_index(self): data = loadmat("twomax_data") x = data["x"] for i in range(142, 146): # Zap the values in the second peak range to exercise the branch. x[i] = 0.0001 * i mag, index = two_max(x, int(data["lowerbound"]) - 1, int(data["upperbound"]) - 1, data["unitlen"]) np.testing.assert_array_almost_equal(mag, np.append(data["mag"], 0.0145)) np.testing.assert_array_equal(index, [int(data["index"]) - 1, 145])
def test_second_peak_index(self): data = load_json(os.path.join('shrp', 'twomax_data')) x = data['x'] for i in range(142, 146): # Zap the values in the second peak range to exercise the branch. x[i] = 0.0001 * i mag, index = two_max(x, int(data['lowerbound']) - 1, int(data['upperbound']) - 1, data['unitlen']) np.testing.assert_array_almost_equal(mag, np.append(data['mag'], 0.0145)) np.testing.assert_array_equal(index, [int(data['index']) - 1, 145])
def test_second_peak_index(self): data = load_json(os.path.join('shrp', 'twomax_data')) x = data['x'] for i in range(142, 146): # Zap the values in the second peak range to exercise the branch. x[i] = 0.0001*i mag, index = two_max(x, int(data['lowerbound'])-1, int(data['upperbound'])-1, data['unitlen']) np.testing.assert_array_almost_equal(mag, np.append(data['mag'], 0.0145)) np.testing.assert_array_equal(index, [int(data['index'])-1, 145])
def matlab_fn_as_matlab_input_data(self, filename): data = loadmat(filename) mag, index = two_max(data["x"], int(data["lowerbound"]) - 1, int(data["upperbound"]) - 1, data["unitlen"]) np.testing.assert_array_almost_equal(mag, data["mag"]) np.testing.assert_array_almost_equal(index, int(data["index"]) - 1)