code: def test_time_stroll_apply_func_vectorized():
      f = FuncWrapper(np.min, output_names="min")
      f_vect = FuncWrapper(
          np.min, output_names="min_vect", vectorized=True, axis=-1
      )
  
      s = pd.Series(data=[0, 1, 2, 3, 4], name="dummy")
      s.index = pd.date_range("2020-01-01", freq="1h", periods=5)
  
      def assert_1col_df_equal(s1, s2):
          assert (s1.shape[1] == 1) & (s2.shape[1] == 1)
          assert np.all(s1.index == s2.index)
          assert np.all(s1.values.ravel() == s2.values.ravel())
  
      ## No Force
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(2, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(3, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(4, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(5, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(50, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(4, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(5, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(6, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
      ## Force
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(2, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      with pytest.raises(Exception):
          # the vectorized function requires the same number of samples in each segmented window
          # this will result in window of length 3 and 1
          sr = TimeStridedRolling(
              s,
              window=pd.Timedelta(3, unit="h"),
              strides=[pd.Timedelta(4, unit="h")],
              window_idx="begin",
              include_final_window=True,
          )
          sr.apply_func(f_vect)
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(5, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(3, unit="h"),
          strides=[pd.Timedelta(50, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(4, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(5, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
      sr = TimeStridedRolling(
          s,
          window=pd.Timedelta(6, unit="h"),
          strides=[pd.Timedelta(1, unit="h")],
          window_idx="begin",
          include_final_window=True,
      )
      assert_1col_df_equal(sr.apply_func(f), sr.apply_func(f_vect))
  
imports: import numpy
  import pandas
  import pytest
  from tsflex.features import FuncWrapper
  from tsflex.features.segmenter.strided_rolling import SequenceStridedRolling, StridedRolling, TimeIndexSampleStridedRolling, TimeStridedRolling
  from .utils import dummy_data
label_desc: Use image node_id 20 for calling a global function with example usage: test_time_stroll_apply_func_vectorized() without return types