code: def calc_window_features(
      dict_features,
      signal_window,
      fs,
      verbose=1,
      single_window=False,
      **kwargs,
  ):
      """This function computes features matrix for one window.
  
      Parameters
      ----------
      dict_features : dict
          Dictionary with features
      signal_window: pandas DataFrame
          Input from which features are computed, window
      fs : float
          Sampling frequency
      verbose : int
          Level of function communication
          (0 or 1 (Default))
      single_window: Bool
          Boolean value for printing the progress bar for only one window feature extraction
      \**kwargs:
      See below:
          * *features_path* (``string``) --
              Directory of script with personal features
          * *header_names* (``list or array``) --
              Names of each column window
  
      Returns
      -------
      pandas DataFrame
          (columns) names of the features
          (data) values of each features for signal
  
      """
  
      features_path = kwargs.get("features_path", None)
      header_names = kwargs.get("header_names", None)
  
      # To handle object type signals
      signal_window = np.array(signal_window).astype(float)
  
      single_axis = True if len(signal_window.shape) == 1 else False
  
      if header_names is None:
          header_names = (
              np.array([0])
              if single_axis
              else np.arange(signal_window.shape[-1])
          )
      else:
          if (
              len(header_names) != signal_window.shape[-1]
              and not single_axis
          ) or (len(header_names) != 1 and single_axis):
              raise Exception(
                  "header_names dimension does not match input columns."
              )
  
      # Execute imports
      exec("from tsfel import *")
      domain = dict_features.keys()
  
      if features_path:
          sys.path.append(
              features_path[: -len(features_path.split(os.sep)[-1]) - 1]
          )
          exec("import " + features_path.split(os.sep)[-1][:-3])
          importlib.reload(
              sys.modules[features_path.split(os.sep)[-1][:-3]]
          )
          exec(
              "from "
              + features_path.split(os.sep)[-1][:-3]
              + " import *"
          )
  
      # Create global arrays
      feature_results = []
      feature_names = []
  
      # Starting the display of progress bar for notebooks interfaces
      # Iterating over features of a single window
      if verbose == 1 and single_window:
          feat_nb = np.hstack(
              [list(dict_features[_type].keys()) for _type in domain]
          )
  
          if (
              get_ipython().__class__.__name__ == "ZMQInteractiveShell"
          ) or (get_ipython().__class__.__name__ == "Shell"):
              out = display(
                  progress_bar_notebook(0, len(feat_nb)),
                  display_id=True,
              )
          else:
              out = None
  
          i_feat = -1
  
      for _type in domain:
          domain_feats = dict_features[_type].keys()
  
          for feat in domain_feats:
              if verbose == 1 and single_window:
                  i_feat = i_feat + 1
                  display_progress_bar(i_feat, len(feat_nb), out)
  
              # Only returns used functions
              if dict_features[_type][feat]["use"] == "yes":
                  # Read Function (real name of function)
                  func_total = dict_features[_type][feat]["function"]
  
                  if func_total.find("tsfel.") == 0:
                      func_total = func_total.replace("tsfel.", "")
  
                  # Check for parameters
                  parameters_total = {}
  
                  if dict_features[_type][feat]["parameters"] != "":
                      parameters_total = dict_features[_type][feat][
                          "parameters"
                      ]
  
                      # Check assert fs parameter:
                      if "fs" in parameters_total:
                          # Select which fs to use
                          if fs is None:
                              # Check if features dict has default sampling frequency value
                              if not (
                                  type(parameters_total["fs"]) is int
                                  or type(parameters_total["fs"])
                                  is float
                              ):
                                  raise Exception(
                                      "No sampling frequency assigned."
                                  )
                          else:
                              parameters_total["fs"] = fs
  
                  # Eval feature results
                  if single_axis:
                      eval_result = locals()[func_total](
                          signal_window, **parameters_total
                      )
                      eval_result = np.array([eval_result])
  
                  for ax in range(len(header_names)):
                      sig_ax = (
                          signal_window
                          if single_axis
                          else signal_window[:, ax]
                      )
                      eval_result_ax = locals()[func_total](
                          sig_ax, **parameters_total
                      )
                      # Function returns more than one element
                      if type(eval_result_ax) == tuple:
                          if np.isnan(eval_result_ax[0]):
                              eval_result_ax = np.zeros(
                                  len(eval_result_ax)
                              )
                          for rr in range(len(eval_result_ax)):
                              feature_results += [eval_result_ax[rr]]
                              feature_names += [
                                  str(header_names[ax])
                                  + "_"
                                  + feat
                                  + "_"
                                  + str(rr)
                              ]
                      else:
                          feature_results += [eval_result_ax]
                          feature_names += [
                              str(header_names[ax]) + "_" + feat
                          ]
  
      features = pd.DataFrame(
          data=np.array(feature_results).reshape(
              1, len(feature_results)
          ),
          columns=np.array(feature_names),
      )
  
      return features
  
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 4 for calling a global function with example usage: calc_window_features(dict_features, signal_window, fs, verbose, single_window) and returns: features