apls icon indicating copy to clipboard operation
apls copied to clipboard

Calling apls.gather_files() function would raise errors

Open antran89 opened this issue 6 years ago • 2 comments

Please help on this issue.

Gathering files...
Creating networkx graph from downloaded OSM data...
Added edge lengths to graph in 0.01 seconds
Created graph with 94 nodes and 230 edges in 0.28 seconds
Begin topologically simplifying the graph...
Identified 71 edge endpoints in 0.00 seconds
Constructed all paths to simplify in 0.00 seconds
Simplified graph (from 94 to 71 nodes and from 230 to 184 edges) in 0.01 seconds
Retrieve proposal graph...
Running wkt_list_to_nodes_edges()...
Time to run wkt_list_to_nodes_egdes(): 0.014730691909790039 seconds
Creating G...
  len(G.nodes(): 142
  len(G.edges(): 166
Time to run nodes_edges_to_G(): 0.011862039566040039 seconds
Clean out short subgraphs
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-24-3a2f4f5cb49d> in <module>
      3                   prop_dir='/Users/an.tran/Desktop/map-workspace/code/apls/apls/data/gt_json_prop_wkt/proposal',
      4                   im_dir='/Users/an.tran/Desktop/map-workspace/code/apls/apls/data/images',
----> 5                  wkt_file='/Users/an.tran/Desktop/map-workspace/code/apls/apls/data/gt_json_prop_wkt/proposal/sn3_sample_submission_albu.csv')

/usr/local/lib/python3.7/site-packages/apls/apls.py in gather_files(test_method, truth_dir, prop_dir, im_dir, im_prefix, wkt_file, max_files, gt_subgraph_filter_weight, gt_min_subgraph_length, prop_subgraph_filter_weight, prop_min_subgraph_length, use_pix_coords, speed_key, travel_time_key, default_speed, verbose, super_verbose)
   2305                 node_iter=node_iter,
   2306                 edge_iter=edge_iter,
-> 2307                 verbose=super_verbose)
   2308 
   2309             t2 = time.time()

/usr/local/lib/python3.7/site-packages/apls/wkt_to_G.py in wkt_to_G(wkt_list, im_file, prop_subgraph_filter_weight, min_subgraph_length, node_iter, edge_iter, simplify_graph, verbose)
    299 
    300     print("Clean out short subgraphs")
--> 301     G0 = apls._clean_sub_graphs(G0, min_length=min_subgraph_length,
    302                           weight=prop_subgraph_filter_weight,
    303                           max_nodes_to_skip=30,

AttributeError: module 'apls' has no attribute '_clean_sub_graphs'


antran89 avatar Aug 24 '19 08:08 antran89

_clean_sub_graphs() is indeed a function within apls.py, so I'm not sure of the source of this error. Try the updated version of apls to see if this is resolved.

avanetten avatar Aug 29 '19 18:08 avanetten

Hi @avanetten, I tried the latest version of apls when it has this error. I think the problem related to the underscore _clean_sub_graphs(). And python3 cannot import the underscore function. I changed the function to without underscore, then it works fine for me.

antran89 avatar Aug 31 '19 04:08 antran89