code: def test_sp_to_use_using_index_and_user_def():
      """Seasonal Period detection using Indices (used before 3.0.0rc5). Also
      tests the user defined seasonal periods when used in conjunction with "index".
      """
  
      exp = TSForecastingExperiment()
      data = get_data("airline", verbose=False)
  
      # 1.1 Airline Data with seasonality of 12
      exp.setup(
          data=data,
          sp_detection="index",
          verbose=False,
          session_id=42,
      )
      assert exp.seasonal_period is None
      assert exp.sp_detection == "index"
      assert exp.ignore_seasonality_test is False
      assert exp.candidate_sps == [12]
      assert exp.significant_sps == [12]
      assert exp.significant_sps_no_harmonics == [12]
      assert exp.all_sps_to_use == [12]
      assert exp.primary_sp_to_use == 12
  
      # 1.2 Airline Data with seasonality of M (12), 6
      exp.setup(
          data=data,
          sp_detection="index",
          verbose=False,
          session_id=42,
          seasonal_period=["M", 6],
          num_sps_to_use=-1,
      )
      assert exp.seasonal_period == ["M", 6]
      # overridden to user_defined even through we pass "index"
      assert exp.sp_detection == "user_defined"
      assert exp.ignore_seasonality_test is False
      assert exp.candidate_sps == [12, 6]
      assert exp.significant_sps == [12, 6]
      assert exp.significant_sps_no_harmonics == [12]
      assert exp.all_sps_to_use == [12, 6]
      assert exp.primary_sp_to_use == 12
  
      # 1.3 White noise Data with seasonality of 12
      data = get_data(
          "1", folder="time_series/white_noise", verbose=False
      )
      exp.setup(
          data=data,
          sp_detection="index",
          seasonal_period=12,
          verbose=False,
          session_id=42,
      )
  
      # Should get 1 even though we passed 12
      assert exp.seasonal_period == 12
      # overridden to user_defined even through we pass "index"
      assert exp.sp_detection == "user_defined"
      assert exp.ignore_seasonality_test is False
      assert exp.candidate_sps == [12]
      assert exp.significant_sps == [1]
      assert exp.significant_sps_no_harmonics == [1]
      assert exp.all_sps_to_use == [1]
      assert exp.primary_sp_to_use == 1
  
      # 1.4 White noise Data with seasonality of 12 and ignore_seasonality_test = True
      data = get_data(
          "1", folder="time_series/white_noise", verbose=False
      )
      exp.setup(
          data=data,
          sp_detection="index",
          seasonal_period=12,
          ignore_seasonality_test=True,
          verbose=False,
          session_id=42,
      )
  
      # Should get 1 even though we passed 12
      assert exp.seasonal_period == 12
      # overridden to user_defined even through we pass "index"
      assert exp.sp_detection == "user_defined"
      assert exp.ignore_seasonality_test is True
      assert exp.candidate_sps == [12]
      assert exp.significant_sps == [12]
      assert exp.significant_sps_no_harmonics == [12]
      assert exp.all_sps_to_use == [12]
      assert exp.primary_sp_to_use == 12
  
imports: import math
  import numpy
  import pandas
  import pytest
  from time_series_test_utils import _get_seasonal_values, _get_seasonal_values_alphanumeric, _return_data_seasonal_types_strictly_pos, _return_setup_args_raises, _return_splitter_args
  from pycaret.datasets import get_data
  from pycaret.time_series import TSForecastingExperiment
label_desc: Use image node_id 7 for calling a global function with example usage: test_sp_to_use_using_index_and_user_def() without return types