code: def calculate_minimum_collision_distances(
      rays,
      thresholded_frame,
      angle_mapping_array,
      distance_mapping_array,
  ):
      ray_collision_distances = dict()
  
      for label, angle in rays.items():
          ray_collision_mask = (angle_mapping_array == angle) & (
              thresholded_frame == 1
          )
  
          collision_distances = distance_mapping_array[
              ray_collision_mask == True
          ]
  
          ray_collision_distances[label] = (
              np.min(collision_distances)
              if collision_distances.size
              else 9999
          )
  
      return ray_collision_distances
  
label_desc: Use image node_id 2 for calling a global function with example usage: calculate_minimum_collision_distances(rays, thresholded_frame, angle_mapping_array, distance_mapping_array) and returns: ray_collision_distances