parameters: (routes_by_start_d, root)
docstring: append the route distribution data into the given dom document
      :param routes_by_start_d:   map by start link id with route dicts as values
      :type routes_by_start_d:    dict
      :param root:   XML root element to append children to
  
      .. note:: *modifies/extends* XML root element
docstring_summary: append the route distribution data into the given dom document
      :param routes_by_start_d:   map by start link id with route dicts as values
      :type routes_by_start_d:    dict
      :param root:   XML root element to append children to
docstring_tokens: append the route distribution data into the given dom document : param routes_by_start_d : map by start link id with route dicts as values : type routes_by_start_d : dict : param root : XML root element to append children to
function: def create_routeDistribution_elems(routes_by_start_d, root):
      """append the route distribution data into the given dom document
      :param routes_by_start_d:   map by start link id with route dicts as values
      :type routes_by_start_d:    dict
      :param root:   XML root element to append children to
  
      .. note:: *modifies/extends* XML root element
      """
      # iterating by VISSIM link id
      for start_link in routes_by_start_d:
          if start_link not in flow_d:
              # no flow, no go
              print('- skipping route dist. gen\n'
                    '\tfor route without flow def. for VISSIM start link id:', start_link)
              continue
          if len(routes_by_start_d[start_link]) == 0:
              continue
          ref_time = flow_d[start_link]["flow"][:, 0]
          for ic, time in enumerate(ref_time):
              route_dist = root.ownerDocument.createElement("routeDistribution")
              # just a name
              route_dist.setAttribute("id", "_".join([start_link,
                                                      str(time)]))
              for route in routes_by_start_d[start_link]:
                  if np.abs(route["probability"][ic]) != 0:
                      route_node = root.ownerDocument.createElement("route")
                      route_node.setAttribute("id", route["r_id"])
                      route_node.setAttribute("edges",
                                              " ".join(route["links"]))
                      route_node.setAttribute("probability",
                                              str(np.abs(
                                                  route["probability"][ic])))
                      route_dist.appendChild(route_node)
              if route_dist.hasChildNodes():
                  root.appendChild(route_dist)
function_tokens: def create_routeDistribution_elems ( routes_by_start_d , root ) : # iterating by VISSIM link id for start_link in routes_by_start_d : if start_link not in flow_d : # no flow, no go print ( '- skipping route dist. gen\n' '\tfor route without flow def. for VISSIM start link id:' , start_link ) continue if len ( routes_by_start_d [ start_link ] ) == 0 : continue ref_time = flow_d [ start_link ] [ "flow" ] [ : , 0 ] for ic , time in enumerate ( ref_time ) : route_dist = root . ownerDocument . createElement ( "routeDistribution" ) # just a name route_dist . setAttribute ( "id" , "_" . join ( [ start_link , str ( time ) ] ) ) for route in routes_by_start_d [ start_link ] : if np . abs ( route [ "probability" ] [ ic ] ) != 0 : route_node = root . ownerDocument . createElement ( "route" ) route_node . setAttribute ( "id" , route [ "r_id" ] ) route_node . setAttribute ( "edges" , " " . join ( route [ "links" ] ) ) route_node . setAttribute ( "probability" , str ( np . abs ( route [ "probability" ] [ ic ] ) ) ) route_dist . appendChild ( route_node ) if route_dist . hasChildNodes ( ) : root . appendChild ( route_dist )