original_docstring: Provides the calculations for the speed limits from the curvatures array and distances,
      by providing distances to curvature sections and correspoinding speed limit values as well as
      curvature direction/sign.
    
docstring: Provides the calculations for the speed limits from the curvatures array and distances,
  by providing distances to curvature sections and correspoinding speed limit values as well as
  curvature direction/sign.
docstring_tokens: Provides the calculations for the speed limits from the curvatures array and distances by providing distances to curvature sections and correspoinding speed limit values as well as curvature direction / sign .
code: def speed_limits_for_curvatures_data(curv, dist):
    """Provides the calculations for the speed limits from the curvatures array and distances,
      by providing distances to curvature sections and correspoinding speed limit values as well as
      curvature direction/sign.
    """
    # Prepare a data array for processing with absolute curvature values, curvature sign and distances.
    curv_abs = np.abs(curv)
    data = np.column_stack((curv_abs, np.sign(curv), dist))
  
    # Find where curvatures overshoot turn curvature threshold and define as section
    is_section = curv_abs >= _TURN_CURVATURE_THRESHOLD
  
    # Find the indexes where the sections start and end. i.e. change indexes.
    c_idx = np.nonzero(np.diff(is_section))[0] + 1
  
    # Create independent arrays for each split section base on change indexes.
    splits = np.array(np.split(data, c_idx), dtype=object)
  
    # Filter the splits to keep only the curvature section arrays by getting the odd or even split arrays depending
    # on whether the first split is a curvature split or not.
    curv_sec_idxs = np.arange(0 if is_section[0] else 1, len(splits), 2, dtype=int)
    curv_secs = splits[curv_sec_idxs]
  
    # Further split the curv sections by sign change
    sub_secs = [split_speed_section_by_sign(cs) for cs in curv_secs]
    curv_secs = [cs for sub_sec in sub_secs for cs in sub_sec]
  
    # Further split the curv sections by degree of curvature
    sub_secs = [split_speed_section_by_curv_degree(cs) for cs in curv_secs]
    curv_secs = [cs for sub_sec in sub_secs for cs in sub_sec]
  
    # Return an array where each row represents a turn speed limit section.
    # [start, end, speed_limit, curvature_sign]
    return np.array([speed_section(cs) for cs in curv_secs])
code_tokens: def speed_limits_for_curvatures_data ( curv , dist ) : curv_abs = np . abs ( curv ) data = np . column_stack ( ( curv_abs , np . sign ( curv ) , dist ) ) is_section = curv_abs >= _TURN_CURVATURE_THRESHOLD c_idx = np . nonzero ( np . diff ( is_section ) ) [ 0 ] + 1 splits = np . array ( np . split ( data , c_idx ) , dtype = object ) curv_sec_idxs = np . arange ( 0 if is_section [ 0 ] else 1 , len ( splits ) , 2 , dtype = int ) curv_secs = splits [ curv_sec_idxs ] sub_secs = [ split_speed_section_by_sign ( cs ) for cs in curv_secs ] curv_secs = [ cs for sub_sec in sub_secs for cs in sub_sec ] sub_secs = [ split_speed_section_by_curv_degree ( cs ) for cs in curv_secs ] curv_secs = [ cs for sub_sec in sub_secs for cs in sub_sec ] return np . array ( [ speed_section ( cs ) for cs in curv_secs ] )
short_docstring: Provides the calculations for the speed limits from the curvatures array and distances,
  by providing distances to curvature sections and correspoinding speed limit values as well as
  curvature direction/sign.
short_docstring_tokens: Provides the calculations for the speed limits from the curvatures array and distances by providing distances to curvature sections and correspoinding speed limit values as well as curvature direction / sign .
comment: """Provides the calculations for the speed limits from the curvatures array and distances,
      by providing distances to curvature sections and correspoinding speed limit values as well as
      curvature direction/sign.
    """$SEP$# Prepare a data array for processing with absolute curvature values, curvature sign and distances.$SEP$# Find where curvatures overshoot turn curvature threshold and define as section$SEP$# Find the indexes where the sections start and end. i.e. change indexes.$SEP$# Create independent arrays for each split section base on change indexes.$SEP$# Filter the splits to keep only the curvature section arrays by getting the odd or even split arrays depending$SEP$# on whether the first split is a curvature split or not.$SEP$# Further split the curv sections by sign change$SEP$# Further split the curv sections by degree of curvature$SEP$# Return an array where each row represents a turn speed limit section.$SEP$# [start, end, speed_limit, curvature_sign]