def add_kernel_arrays_1D(array_1, array_2):
 if (array_1.size > array_2.size):
  new_array = array_1.copy()
  center = (array_1.size // 2)
  slice_ = slice((center - (array_2.size // 2)), ((center + (array_2.size // 2)) + 1))
  new_array[slice_] += array_2
  return new_array
 elif (array_2.size > array_1.size):
  new_array = array_2.copy()
  center = (array_2.size // 2)
  slice_ = slice((center - (array_1.size // 2)), ((center + (array_1.size // 2)) + 1))
  new_array[slice_] += array_1
  return new_array
 return (array_2 + array_1)

def add_kernel_arrays_1D ( array_1 , array_2 ) : if ( array_1 . size > array_2 . size ) : new_array = array_1 . copy ( ) center = ( array_1 . size // 2 ) slice_ = slice ( ( center - ( array_2 . size // 2 ) ) , ( ( center + ( array_2 . size // 2 ) ) + 1 ) ) new_array [ slice_ ] += array_2 return new_array elif ( array_2 . size > array_1 . size ) : new_array = array_2 . copy ( ) center = ( array_2 . size // 2 ) slice_ = slice ( ( center - ( array_1 . size // 2 ) ) , ( ( center + ( array_1 . size // 2 ) ) + 1 ) ) new_array [ slice_ ] += array_1 return new_array return ( array_2 + array_1 )
add two 1d kernel arrays of different size .