original_docstring: Will split the given curvature section in subsections as to isolate peaks of turn with substantially
    higher curvature values. This will aid on preventing having very long turn sections with low speed limit
    that is only really necessary for a small region of the section.
    
docstring: Will split the given curvature section in subsections as to isolate peaks of turn with substantially
  higher curvature values. This will aid on preventing having very long turn sections with low speed limit
  that is only really necessary for a small region of the section.
docstring_tokens: Will split the given curvature section in subsections as to isolate peaks of turn with substantially higher curvature values . This will aid on preventing having very long turn sections with low speed limit that is only really necessary for a small region of the section .
code: def split_speed_section_by_curv_degree(curv_sec):
    """Will split the given curvature section in subsections as to isolate peaks of turn with substantially
    higher curvature values. This will aid on preventing having very long turn sections with low speed limit
    that is only really necessary for a small region of the section.
    """
    # Only consider spliting a section if long enough.
    lenght = curv_sec[-1, 2] - curv_sec[0, 2]
    if lenght <= _MIN_SPEED_SECTION_LENGHT:
      return [curv_sec]
  
    # Only split if max curvature deviates substantially from mean curvature.
    max_curv_idx = np.argmax(curv_sec[:, 0])
    max_curv = curv_sec[max_curv_idx, 0]
    mean_curv = np.mean(curv_sec[:, 0])
    if max_curv / mean_curv <= _MAX_CURV_DEVIATION_FOR_SPLIT:
      return [curv_sec]
  
    # Calcualate where to split as to isolate a curve section around the max curvature peak.
    arc_side = (np.radians(_MAX_CURV_SPLIT_ARC_ANGLE) / max_curv) / 2.
    arc_side_idx_lenght = int(np.ceil(arc_side / _SPLINE_EVAL_STEP))
    split_idxs = [max_curv_idx - arc_side_idx_lenght, max_curv_idx + arc_side_idx_lenght]
    split_idxs = list(filter(lambda idx: idx > 0 and idx < len(curv_sec) - 1, split_idxs))
  
    # If the arc section to split extendes outside the section, then no need to split.
    if len(split_idxs) == 0:
      return [curv_sec]
  
    # Create the splits and split the resulting sections recursevly.
    splits = [split_speed_section_by_curv_degree(cs) for cs in np.split(curv_sec, split_idxs)]
  
    # Flatten the results and return the new list of curvature sections.
    curv_secs = [cs for split in splits for cs in split]
    return curv_secs
code_tokens: def split_speed_section_by_curv_degree ( curv_sec ) : lenght = curv_sec [ - 1 , 2 ] - curv_sec [ 0 , 2 ] if lenght <= _MIN_SPEED_SECTION_LENGHT : return [ curv_sec ] max_curv_idx = np . argmax ( curv_sec [ : , 0 ] ) max_curv = curv_sec [ max_curv_idx , 0 ] mean_curv = np . mean ( curv_sec [ : , 0 ] ) if max_curv / mean_curv <= _MAX_CURV_DEVIATION_FOR_SPLIT : return [ curv_sec ] arc_side = ( np . radians ( _MAX_CURV_SPLIT_ARC_ANGLE ) / max_curv ) / 2. arc_side_idx_lenght = int ( np . ceil ( arc_side / _SPLINE_EVAL_STEP ) ) split_idxs = [ max_curv_idx - arc_side_idx_lenght , max_curv_idx + arc_side_idx_lenght ] split_idxs = list ( filter ( lambda idx : idx > 0 and idx < len ( curv_sec ) - 1 , split_idxs ) ) if len ( split_idxs ) == 0 : return [ curv_sec ] splits = [ split_speed_section_by_curv_degree ( cs ) for cs in np . split ( curv_sec , split_idxs ) ] curv_secs = [ cs for split in splits for cs in split ] return curv_secs
short_docstring: Will split the given curvature section in subsections as to isolate peaks of turn with substantially
  higher curvature values.
short_docstring_tokens: Will split the given curvature section in subsections as to isolate peaks of turn with substantially higher curvature values .
comment: """Will split the given curvature section in subsections as to isolate peaks of turn with substantially
    higher curvature values. This will aid on preventing having very long turn sections with low speed limit
    that is only really necessary for a small region of the section.
    """$SEP$# Only consider spliting a section if long enough.$SEP$# Only split if max curvature deviates substantially from mean curvature.$SEP$# Calcualate where to split as to isolate a curve section around the max curvature peak.$SEP$# If the arc section to split extendes outside the section, then no need to split.$SEP$# Create the splits and split the resulting sections recursevly.$SEP$# Flatten the results and return the new list of curvature sections.