class_docstr: Tests `strided_moving_window` function defined in `darts.utils.data.tabularization`.
docstr: Tests that each of the windows extracted by `strided_moving_windows`
  is correct over a number of input parameter combinations.
  
  This is achieved by looping over each extracted window, and checking that the
  `i`th window corresponds to the the next `window_len` values found after
  `i * stride` (i.e. the index position at which the `i`th window should begin).
docstr_tok: ["Tests","that","each","of","the","windows","extracted","by","`","strided_moving_windows","`","is","correct","over","a","number","of","input","parameter","combinations",".","This","is","achieved","by","looping","over","each","extracted","window",",","and","checking","that","the","`","i","`","th","window","corresponds","to","the","the","next","`","window_len","`","values","found","after","`","i","*","stride","`","(","i.e",".","the","index","position","at","which","the","`","i","`","th","window","should","begin",")","."]
code: def test_strided_moving_windows_extracted_windows(self):
      """
      Tests that each of the windows extracted by `strided_moving_windows`
      is correct over a number of input parameter combinations.
  
      This is achieved by looping over each extracted window, and checking that the
      `i`th window corresponds to the the next `window_len` values found after
      `i * stride` (i.e. the index position at which the `i`th window should begin).
      """
      # Parameter combos to test:
      window_len_combos = (1, 2, 5)
      axis_combos = (0, 1, 2)
      stride_combos = (1, 2, 3)
      # Create a 'dummy input' with linearly increasing values:
      x_shape = (10, 8, 12)
      x = np.arange(np.prod(x_shape)).reshape(*x_shape)
      for axis, stride, window_len in product(
          axis_combos, stride_combos, window_len_combos
      ):
          windows = strided_moving_window(x, window_len, stride, axis)
          # Iterate over extracted windows:
          for i in range(windows.shape[axis]):
              # All of the extract windows are found along the `axis` dimension; shift
              # `axis` so that it now appears as the final dimension and then extract
              # `i`th window:
              window = np.moveaxis(windows, axis, -1)[:, :, :, i]
              # `i`th window should begin at `i * stride`:
              window_start_idx = i * stride
              # Window should include next `window_len` values after window start;
              # shift `axis` to last dimension then extract expected window:
              expected = np.moveaxis(x, axis, -1)[
                  :, :, window_start_idx : window_start_idx + window_len
              ]
              assert np.allclose(window, expected)
  
file_path: darts/darts/tests/utils/tabularization/test_strided_moving_window.py
imports: from itertools import product
  import numpy
  import pytest
  from darts.utils.data.tabularization import strided_moving_window
label_desc: Use image node_id 1 for calling the TestStridedMovingWindow obj's underlying member method code with example usage: obj.test_strided_moving_windows_extracted_windows() without return types