kuanb / peartree

peartree: A library for converting transit data into a directed graph for sketch network analysis.
MIT License
201 stars 23 forks source link

[reliability] Consistent handling of direction_id when NaNs present #90

Closed yiyange closed 6 years ago

yiyange commented 6 years ago

Fix issue https://github.com/kuanb/peartree/issues/89

codecov[bot] commented 6 years ago

Codecov Report

Merging #90 into master will increase coverage by 0.26%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #90      +/-   ##
==========================================
+ Coverage   91.64%   91.91%   +0.26%     
==========================================
  Files          12       12              
  Lines         862      866       +4     
==========================================
+ Hits          790      796       +6     
+ Misses         72       70       -2
Impacted Files Coverage Δ
peartree/parallel.py 98.56% <100%> (+1.52%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 488f060...e0b90c3. Read the comment docs.

kuanb commented 6 years ago

@yiyange made some slight changes to the comments (see above commit).

kuanb commented 6 years ago

Final request, @yiyange, please add a test in test_paths.py. Something along the lines of:

def test_loading_in_too_small_timeframes():
    path = fixture('samtrans-2017-11-28.zip')
    feed = get_representative_feed(path)

    # Overwrite the stop times so that direction id is null
    st = feed.stop_times
    st.direction_id = np.nan
    feed.stop_times = st

    # Make sure the behavior is as expected
    start = 7 * 60 * 60
    end = 10 * 60 * 60
    G = load_feed_as_graph(feed, start, end)

    # Add an assertion that stops times are not null