parameters: (self, coords)
return_statement: return ids_prtstop_closest, ids_edge_closest
docstring: Returns the closest prt stop for each coord in coords vector.
docstring_summary: Returns the closest prt stop for each coord in coords vector.
docstring_tokens: Returns the closest prt stop for each coord in coords vector .
function: def get_closest(self, coords):
          """
          Returns the closest prt stop for each coord in coords vector.
          """
          net = self.get_scenario().net
          ptstops = net.ptstops
          lanes = net.lanes
          n = len(coords)
          # print 'get_closest',n
  
          #ids_stop = self.get_ids()
  
          ids_prtstop = self.get_ids()
          ids_ptstop = self.ids_ptstop[ids_prtstop]
          coords_stop = ptstops.centroids[ids_ptstop]
          ids_edge_stop = net.lanes.ids_edge[ptstops.ids_lane[ids_ptstop]]
  
          inds_closest = np.zeros(n, dtype=np.int32)
  
          i = 0
          for coord in coords:
              ind_closest = np.argmin(np.sum((coord-coords_stop)**2, 1))
              inds_closest[i] = ind_closest
              i += 1
  
          ids_prtstop_closest = ids_prtstop[inds_closest]
          ids_edge_closest = ids_edge_stop[inds_closest]
  
          return ids_prtstop_closest, ids_edge_closest
function_tokens: def get_closest ( self , coords ) : net = self . get_scenario ( ) . net ptstops = net . ptstops lanes = net . lanes n = len ( coords ) # print 'get_closest',n #ids_stop = self.get_ids() ids_prtstop = self . get_ids ( ) ids_ptstop = self . ids_ptstop [ ids_prtstop ] coords_stop = ptstops . centroids [ ids_ptstop ] ids_edge_stop = net . lanes . ids_edge [ ptstops . ids_lane [ ids_ptstop ] ] inds_closest = np . zeros ( n , dtype = np . int32 ) i = 0 for coord in coords : ind_closest = np . argmin ( np . sum ( ( coord - coords_stop ) ** 2 , 1 ) ) inds_closest [ i ] = ind_closest i += 1 ids_prtstop_closest = ids_prtstop [ inds_closest ] ids_edge_closest = ids_edge_stop [ inds_closest ] return ids_prtstop_closest , ids_edge_closest