class_docstr: This class maintains a pandas.dataframe of filenames for all input sections.
  The list of filenames are obtained by searching the specified folders
  or loading from an existing csv file.
  
  Users can query a subset of the dataframe by train/valid/infer partition
  label and input section names.
docstr: Go through all input data sections, converting each section
  to a list of file names.
  
  These lists are merged on ``COLUMN_UNIQ_ID``.
  
  This function sets ``self._file_list``.
docstr_tok: ["Go","through","all","input","data","sections",",","converting","each","section","to","a","list","of","file","names",".","These","lists","are","merged","on","``","COLUMN_UNIQ_ID","``",".","This","function","sets","``","self._file_list","``","."]
code: def load_data_sections_by_subject(self):
      """
      Go through all input data sections, converting each section
      to a list of file names.
  
      These lists are merged on ``COLUMN_UNIQ_ID``.
  
      This function sets ``self._file_list``.
      """
      if not self.data_param:
          tf.logging.fatal(
              "Nothing to load, please check input sections in the config."
          )
          raise ValueError
      self._file_list = None
      for section_name in self.data_param:
          if isinstance(self.data_param[section_name], dict):
              mod_spec = self.data_param[section_name]
          else:
              mod_spec = vars(self.data_param[section_name])
          if mod_spec.get("csv_data_file", None):  # has csv_data_file
              # skip file search
              continue
  
          modality_file_list = self.grep_files_by_data_section(
              section_name
          )
          if self._file_list is None:
              # adding all rows of the first modality
              self._file_list = modality_file_list
              continue
          n_rows = self._file_list[COLUMN_UNIQ_ID].count()
          self._file_list = pandas.merge(
              self._file_list,
              modality_file_list,
              how="outer",
              on=COLUMN_UNIQ_ID,
          )
          if self._file_list[COLUMN_UNIQ_ID].count() < n_rows:
              tf.logging.warning(
                  "rows not matched in section [%s]", section_name
              )
  
      if self._file_list is None or self._file_list.size == 0:
          tf.logging.fatal(
              "Empty filename lists, please check the csv "
              "files (removing csv_file keyword if it is in the config file "
              "to automatically search folders and generate new csv "
              "files again).\n\n"
              "Please note in the matched file names, each subject id are "
              "created by removing all keywords listed `filename_contains` "
              "in the config.\n"
              "E.g., `filename_contains=foo, bar` will match file "
              "foo_subject42_bar.nii.gz, and the subject id is "
              "_subject42_.\n\n"
          )
          raise IOError
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import os
  import random
  import shutil
  import pandas
  import tensorflow
  from niftynet.engine.signal import TRAIN, VALID, INFER, ALL
  from niftynet.utilities.decorators import singleton
  from niftynet.utilities.filename_matching import KeywordsMatching
  from niftynet.utilities.niftynet_global_config import NiftyNetGlobalConfig
  from niftynet.utilities.util_common import look_up_operations
  from niftynet.utilities.util_csv import match_and_write_filenames_to_csv
  from niftynet.utilities.util_csv import write_csv
label_desc: Use image node_id 4 for calling the ImageSetsPartitioner obj's underlying member method code with example usage: obj.load_data_sections_by_subject() without return types