code: def dataset_features_extractor(
      main_directory, feat_dict, verbose=1, **kwargs
  ):
      """Extracts features from a dataset.
  
      Parameters
      ----------
      main_directory : String
          Input directory
      feat_dict : dict
          Dictionary with features
      verbose : int
          Verbosity mode. 0 = silent, 1 = progress bar.
          (0 or 1 (Default))
      \**kwargs:
      See below:
          * *search_criteria* (``list``) --
              List of file names to compute features. (Example: 'Accelerometer.txt')
              (default: ``None``)
  
          * *time_unit* (``float``) --
              Time unit
              (default: ``1e9``)
  
          * *resampling_rate* (``int``) --
              Resampling rate
              (default: ``100``)
  
          * *window_size* (``int``) --
              Window size in number of samples
              (default: ``100``)
  
          * *overlap* (``float``) --
              Overlap between 0 and 1
              (default: ``0``)
  
          * *pre_process* (``function``) --
              Function with pre processing code
  
              (default: ``None``)
  
          * *output_directory* (``String``) --
              Output directory
              (default: ``'output_directory', str(Path.home()) + '/tsfel_output'``)
  
          * *features_path* (``string``) --
              Directory of script with personal features
  
          * *header_names* (``list or array``) --
              Names of each column window
  
          * *n_jobs* (``int``) --
              The number of jobs to run in parallel. ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
              ``-1`` means using all processors.
              (default: ``None`` in Windows and ``-1`` for other systems)
  
      Returns
      -------
      file
          csv file with the extracted features
  
      """
      search_criteria = kwargs.get("search_criteria", None)
      time_unit = kwargs.get("time_unit", 1e9)
      resample_rate = kwargs.get("resample_rate", 30)
      window_size = kwargs.get("window_size", 100)
      overlap = kwargs.get("overlap", 0)
      pre_process = kwargs.get("pre_process", None)
      output_directory = kwargs.get(
          "output_directory", str(Path.home()) + "/tsfel_output"
      )
      features_path = kwargs.get("features_path", None)
      names = kwargs.get("header_names", None)
  
      # Choosing default of n_jobs by operating system
      if sys.platform[:-2] == "win":
          n_jobs_default = None
      else:
          n_jobs_default = -1
  
      # Choosing default of n_jobs by python interface
      if (
          get_ipython().__class__.__name__ == "ZMQInteractiveShell"
          or get_ipython().__class__.__name__ == "Shell"
      ):
          n_jobs_default = -1
  
      n_jobs = kwargs.get("n_jobs", n_jobs_default)
  
      if main_directory[-1] != os.sep:
          main_directory = main_directory + os.sep
  
      folders = [
          f for f in glob.glob(main_directory + "**/", recursive=True)
      ]
  
      if folders:
          for fl in folders:
              sensor_data = {}
              if search_criteria:
                  for c in search_criteria:
                      if os.path.isfile(fl + c):
                          key = c.split(".")[0]
                          sensor_data[key] = pd.read_csv(
                              fl + c, header=None
                          )
              else:
                  all_files = np.concatenate(
                      (
                          glob.glob(fl + "/*.txt"),
                          glob.glob(fl + "/*.csv"),
                      )
                  )
                  for c in all_files:
                      key = c.split(os.sep)[-1].split(".")[0]
                      try:
                          data_file = pd.read_csv(c, header=None)
                      except pd.io.common.CParserError:
                          continue
  
                      if np.dtype("O") in np.array(data_file.dtypes):
                          continue
  
                      sensor_data[key] = pd.read_csv(c, header=None)
  
              if not sensor_data:
                  continue
  
              pp_sensor_data = (
                  sensor_data
                  if pre_process is None
                  else pre_process(sensor_data)
              )
  
              data_new = merge_time_series(
                  pp_sensor_data, resample_rate, time_unit
              )
  
              windows = signal_window_splitter(
                  data_new, window_size, overlap
              )
  
              if features_path:
                  features = time_series_features_extractor(
                      feat_dict,
                      windows,
                      fs=resample_rate,
                      verbose=0,
                      features_path=features_path,
                      header_names=names,
                      n_jobs=n_jobs,
                  )
              else:
                  features = time_series_features_extractor(
                      feat_dict,
                      windows,
                      fs=resample_rate,
                      verbose=0,
                      header_names=names,
                      n_jobs=n_jobs,
                  )
  
              fl = "/".join(fl.split(os.sep))
              invalid_char = '<>:"\|?* '
              for char in invalid_char:
                  fl = fl.replace(char, "")
  
              pathlib.Path(output_directory + fl).mkdir(
                  parents=True, exist_ok=True
              )
              features.to_csv(
                  output_directory + fl + "/Features.csv",
                  sep=",",
                  encoding="utf-8",
              )
  
          if verbose == 1:
              print("Features files saved in: ", output_directory)
      else:
          raise FileNotFoundError(
              "There is no folder(s) in directory: " + main_directory
          )
  
file_path: tsfel/tsfel/feature_extraction/calc_features.py
imports: import glob
  import importlib
  import multiprocessing
  import numbers
  import os
  import pathlib
  import sys
  import warnings
  from functools import partial
  from pathlib import Path
  import numpy
  import pandas
  from IPython import get_ipython
  from IPython.display import display
  from tsfel.utils.progress_bar import display_progress_bar, progress_bar_notebook
  from tsfel.utils.signal_processing import merge_time_series, signal_window_splitter
label_desc: Use image node_id 1 for calling a global function with example usage: dataset_features_extractor(main_directory, feat_dict, verbose) without return types