code: def create_shape_on_matrix(
      bounding_matrix: np.ndarray,
      y_upper_line: np.ndarray,
      y_lower_line: Union[np.ndarray, None] = None,
      x_step_size: int = 1,
      start_val: int = 0,
  ) -> np.ndarray:
      """Create a shape from a given upper line and lower line on a matrix.
  
      Parameters
      ----------
      bounding_matrix: np.ndarray (2d array)
          Matrix of size mxn where m is len(x) and n is len(y). Values that
          are inside the shape will be replaced with finite values (0.).
      y_upper_line: np.ndarray (1d array)
          Y points of the upper line.
      y_lower_line: np.ndarray (1d array), defaults = None
          Y points of the lower line. If no lower line specified, then y_upper_line
          used as lower line.
      x_step_size: int, defaults = 1
          Step size each iteration will increase by
      start_val: int, defaults = 0
          Starting coordinate for x
  
      Returns
      -------
      np.ndarray (2d array)
          Matrix with values of the shape set to 0. (finite), of the same shape
          as the passed bounding_matrix.
      """
      y_size = bounding_matrix.shape[0]
  
      if y_lower_line is None:
          y_lower_line = y_upper_line
  
      upper_line_y_values = y_upper_line.shape[0]
      lower_line_y_values = y_lower_line.shape[0]
  
      if upper_line_y_values != lower_line_y_values:
          raise ValueError(
              "The number of upper line values must equal the number of lower line "
              "values"
          )
  
      half_way = math.floor(upper_line_y_values / 2)
  
      for i in range(start_val, upper_line_y_values):
          x = i * x_step_size
  
          if i > half_way:
              upper_y = max(
                  0, min(y_size - 1, math.ceil(y_upper_line[i]))
              )
              lower_y = max(
                  0, min(y_size - 1, math.floor(y_lower_line[i]))
              )
          else:
              upper_y = max(
                  0, min(y_size - 1, math.ceil(y_upper_line[i]))
              )
              lower_y = max(
                  0, min(y_size - 1, math.floor(y_lower_line[i]))
              )
  
          if upper_line_y_values == lower_line_y_values:
              if upper_y == lower_y:
                  bounding_matrix[upper_y, x] = 0.0
              else:
                  bounding_matrix[upper_y : (lower_y + 1), x] = 0.0
          else:
              bounding_matrix[upper_y, x] = 0.0
              bounding_matrix[lower_y, x] = 0.0
  
      return bounding_matrix
  
file_path: sktime/sktime/distances/_lower_bounding_numba.py
imports: import math
  from typing import Union
  import numpy
  from sktime.utils.numba.njit import njit
label_desc: Use image node_id 1 for calling a global function with example usage: create_shape_on_matrix(bounding_matrix, y_upper_line, y_lower_line, x_step_size, start_val) and returns: bounding_matrix