docstr: Please refer to `self.internal_data.setup` for detailed information about `self.internal_data.data_ic_df`
  
  Indices with format below can be successfully sliced by  `ic_df.loc[:end, pd.IndexSlice[:, :end]]`
  
         2021-06-21 2021-06-04 .. 2021-03-22 2021-03-08
         2021-07-02 2021-06-18 .. 2021-04-02 None
  
  Returns
  -------
      a pd.DataFrame with similar content below.
      - each column corresponds to a trained model named by the training data range
      - each row corresponds to a day of data tested by the models of the columns
      - The rows cells that overlaps with the data used by columns are masked
  
  
                 2009-01-05 2009-02-09 ... 2011-04-27 2011-05-26
                 2009-02-06 2009-03-06 ... 2011-05-25 2011-06-23
      datetime                         ...
      2009-01-13        NaN   0.310639 ...  -0.169057   0.137792
      2009-01-14        NaN   0.261086 ...  -0.143567   0.082581
      ...               ...        ... ...        ...        ...
      2011-06-30  -0.054907  -0.020219 ...  -0.023226        NaN
      2011-07-01  -0.075762  -0.026626 ...  -0.003167        NaN
docstr_tok: ["Please","refer","to","`","self.internal_data.setup","`","for","detailed","information","about","`","self.internal_data.data_ic_df","`","Indices","with","format","below","can","be","successfully","sliced","by","`","ic_df.loc","[",":","end",",","pd.IndexSlice","[",":",",",":","end","]","]","`","2021-06-21","2021-06-04","..","2021-03-22","2021-03-08","2021-07-02","2021-06-18","..","2021-04-02","None","Returns","--","--","--","-","a","pd.DataFrame","with","similar","content","below",".","-","each","column","corresponds","to","a","trained","model","named","by","the","training","data","range","-","each","row","corresponds","to","a","day","of","data","tested","by","the","models","of","the","columns","-","The","rows","cells","that","overlaps","with","the","data","used","by","columns","are","masked","2009-01-05","2009-02-09","...","2011-04-27","2011-05-26","2009-02-06","2009-03-06","...","2011-05-25","2011-06-23","datetime","...","2009-01-13","NaN","0.310639","...","-0.169057","0.137792","2009-01-14","NaN","0.261086","...","-0.143567","0.082581","...","...","...","...","...","...","2011-06-30","-0.054907","-0.020219","...","-0.023226","NaN","2011-07-01","-0.075762","-0.026626","...","-0.003167","NaN"]
code: def _prepare_meta_ipt(self, task) -> pd.DataFrame:
      """
      Please refer to `self.internal_data.setup` for detailed information about `self.internal_data.data_ic_df`
  
      Indices with format below can be successfully sliced by  `ic_df.loc[:end, pd.IndexSlice[:, :end]]`
  
             2021-06-21 2021-06-04 .. 2021-03-22 2021-03-08
             2021-07-02 2021-06-18 .. 2021-04-02 None
  
      Returns
      -------
          a pd.DataFrame with similar content below.
          - each column corresponds to a trained model named by the training data range
          - each row corresponds to a day of data tested by the models of the columns
          - The rows cells that overlaps with the data used by columns are masked
  
  
                     2009-01-05 2009-02-09 ... 2011-04-27 2011-05-26
                     2009-02-06 2009-03-06 ... 2011-05-25 2011-06-23
          datetime                         ...
          2009-01-13        NaN   0.310639 ...  -0.169057   0.137792
          2009-01-14        NaN   0.261086 ...  -0.143567   0.082581
          ...               ...        ... ...        ...        ...
          2011-06-30  -0.054907  -0.020219 ...  -0.023226        NaN
          2011-07-01  -0.075762  -0.026626 ...  -0.003167        NaN
  
      """
      ic_df = self.internal_data.data_ic_df
  
      segs = task["dataset"]["kwargs"]["segments"]
      end = max(segs[k][1] for k in ("train", "valid") if k in segs)
      ic_df_avail = ic_df.loc[:end, pd.IndexSlice[:, :end]]
  
      # meta data set focus on the **information** instead of preprocess
      # 1) filter the overlap info
      def mask_overlap(s):
          """
          mask overlap information
          data after self.name[end] with self.trunc_days that contains future info are also considered as overlap info
  
          Approximately the diagnal + horizon length of data are masked.
          """
          start, end = s.name
          end = get_date_by_shift(
              trading_date=end, shift=self.trunc_days - 1, future=True
          )
          return s.mask((s.index >= start) & (s.index <= end))
  
      ic_df_avail = ic_df_avail.apply(mask_overlap)  # apply to each col
  
      # 2) filter the info with too long periods
      total_len = self.step * self.hist_step_n
      if ic_df_avail.shape[0] >= total_len:
          return ic_df_avail.iloc[-total_len:]
      else:
          raise ValueError(
              "the history of distribution data is not long enough."
          )
  
imports: import pandas
  import numpy
  from copy import deepcopy
  from joblib import Parallel, delayed
  from typing import Dict, List, Union, Text, Tuple
  from qlib.data.dataset.utils import init_task_handler
  from qlib.data.dataset import DatasetH
  from qlib.contrib.torch import data_to_tensor
  from qlib.model.meta.task import MetaTask
  from qlib.model.meta.dataset import MetaTaskDataset
  from qlib.model.trainer import TrainerR
  from qlib.log import get_module_logger
  from qlib.utils import auto_filter_kwargs, get_date_by_shift, init_instance_by_config
  from qlib.utils.data import deepcopy_basic_type
  from qlib.workflow import R
  from qlib.workflow.task.gen import RollingGen, task_generator
  from qlib.workflow.task.utils import TimeAdjuster
  from tqdm.auto import tqdm
label_desc: Use image node_id 2 for calling the MetaDatasetDS obj's underlying member method code with example usage: obj._prepare_meta_ipt(task) and returns: s, ic_df_avail