def test_setup_windows_partitions_window(self): nwindows = 5 window = (0, 1) piecewisecheb = PiecewiseChebyshevApproximant( np.sin, window_breakpoints=np.linspace(*window, nwindows + 1)) windows = piecewisecheb._setup_windows() np.random.seed(72) x = np.random.rand(101) * np.ptp(window) + window[0] masks = [piecewisecheb._mask_window(x, w) for w in windows] number_of_masks_contained = np.sum(masks, axis=0) self.assertTrue(np.all(number_of_masks_contained == 1))
def test_setup_windows_splits_into_n_windows(self): nwindows = 5 piecewisecheb = PiecewiseChebyshevApproximant( np.sin, window_breakpoints=np.linspace(0, 1, nwindows + 1)) windows = piecewisecheb._setup_windows() self.assertEqual(len(windows), nwindows)