3208fe37c6787ef0cd3f2f973a02ad63995042fa,osmnx/bearing.py,,add_edge_bearings,#Any#Any#,61

Before Change


    
    if projection.is_projected(G.graph["crs"]):  // pragma: no cover
        raise ValueError("graph must be unprojected to add edge bearings")
    for u, v, data in G.edges(keys=False, data=True):

        if u == v:
            // a self-loop has an undefined compass bearing
            data["bearing"] = np.nan

        else:
            // calculate bearing from edge"s origin to its destination
            origin_point = (G.nodes[u]["y"], G.nodes[u]["x"])
            destination_point = (G.nodes[v]["y"], G.nodes[v]["x"])
            bearing = get_bearing(origin_point, destination_point)
            data["bearing"] = round(bearing, precision)

    return G


def orientation_entropy(Gu, num_bins=36, min_length=0, weight=None):

After Change


    // extract edge IDs and corresponding coordinates from their nodes
    uvk = tuple(G.edges)
    x = G.nodes(data="x")
    y = G.nodes(data="y")
    coords = np.array([(y[u], x[u], y[v], x[v]) for u, v, k in uvk])

    // calculate bearings then set as edge attributes
    bearings = calculate_bearing(coords[:, 0], coords[:, 1], coords[:, 2], coords[:, 3])
    values = zip(uvk, bearings.round(precision))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: gboeing/osmnx
Commit Name: 3208fe37c6787ef0cd3f2f973a02ad63995042fa
Time: 2021-03-26
Author: boeing@usc.edu
File Name: osmnx/bearing.py
Class Name:
Method Name: add_edge_bearings


Project Name: vatlab/SoS
Commit Name: c8788d2eedcdb2671289d7d47a41b8fdcb0294f1
Time: 2017-09-11
Author: ben.bog@gmail.com
File Name: src/sos/sos_executor.py
Class Name: Base_Executor
Method Name: resolve_dangling_targets


Project Name: dmlc/dgl
Commit Name: 68fb5f7e51a8a735f372cb0893dbeed0bc0fb623
Time: 2018-07-03
Author: ly979@nyu.edu
File Name: examples/pytorch/gat.py
Class Name: GAT
Method Name: forward