code: def generate_anomaly_data(
      freq,
      periods,
      anomaly_block_list,
      noise_std=10.0,
      intercept=500,
      delta_range_lower=0,
      delta_range_upper=0.2,
  ):
      """Generates dataset for anomaly detection unit tests.
  
      Parameters
      ----------
      freq: `str`
          Frequency of the dataset.
      periods: `int`
          Number of periods to generate.
      anomaly_block_list: `List`[`List`[`int`]]
          List of blocks of indices to insert anomalies in.
      noise_std: `float` or None, default 10
          Standard deviation of gaussian noise.
      intercept: `float` or None, default 500
          Intercept of the data generation model.
      delta_range_lower: `float` or None, default 0
          Lower boundary of the interval to choose delta from.
      delta_range_upper: `float` or None, default 0.2
          Upper boundary of the interval to choose delta from.
  
      Returns
      -------
      data: `dict`
          A dictionary with two keys.
              - "df": `pd.DataFrame`
                  Dataset containing anomalies.
              - "anomaly_df": `pd.DataFrame`
                  Dataframe with anomaly information.
      """
      df = generate_df_for_tests(
          freq=freq,
          periods=periods,
          noise_std=noise_std,
          intercept=intercept,
          train_start_date="2020-01-01",
          train_frac=0.99,
          seed=123,
      )["df"]
      # Introduces anomalies
      df = contaminate_df_with_anomalies(
          df,
          anomaly_block_list=anomaly_block_list,
          delta_range_lower=delta_range_lower,
          delta_range_upper=delta_range_upper,
          value_col=VALUE_COL,
          min_admissible_value=None,
          max_admissible_value=None,
      )
      anomaly_df = get_anomaly_df(df=df, anomaly_col=ANOMALY_COL)
      df = df.drop(columns=[VALUE_COL, ANOMALY_COL]).rename(
          columns={"contaminated_y": VALUE_COL}
      )
  
      return {"df": df, "anomaly_df": anomaly_df}
  
file_path: greykite/greykite/detection/common/testing_utils.py
imports: import numpy
  import pandas
  from greykite.common.constants import ANOMALY_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils_anomalies import contaminate_df_with_anomalies
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
  from greykite.detection.detector.ad_utils import get_anomaly_df
label_desc: Use image node_id 1 for calling a global function with example usage: generate_anomaly_data(freq, periods, anomaly_block_list, noise_std, intercept, delta_range_lower, delta_range_upper) and returns: dict