Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessTime / AccessCount / AccessSum models don't work with calculate() #89

Open
angela-li opened this issue Feb 14, 2020 · 8 comments
Open

Comments

@angela-li
Copy link
Member

When running accessT.calculate() in the demo notebook I get the following IndexError and cannot continue further:

IndexError                                Traceback (most recent call last)
<ipython-input-18-d35958627452> in <module>()
----> 1 accessT.calculate()

~/Desktop/spatial_access/spatial_access/Models.py in calculate(self)
    314             results[source_id] = []
    315             for category in focus_categories_list:
--> 316                 time_to_nearest_neighbor = self.time_to_nearest_dest(source_id, category)
    317                 results[source_id].append(time_to_nearest_neighbor)
    318 

~/Desktop/spatial_access/spatial_access/BaseModel.py in time_to_nearest_dest(self, source_id, category)
    503             return self.transit_matrix.matrix_interface.time_to_nearest_dest(source_id, None)
    504         else:
--> 505             return self.transit_matrix.matrix_interface.time_to_nearest_dest(source_id, category)
    506 
    507     def count_dests_in_range_by_categories(self, source_id, category, upper_threshold):

~/Desktop/spatial_access/spatial_access/MatrixInterface.py in time_to_nearest_dest(self, source_id, category)
    425         else:
    426             return self.transit_matrix.timeToNearestDestPerCategory(self._parser.encode_source_id(source_id),
--> 427                                                                     self._parser.encode_category(category))
    428 
    429     def count_dests_in_range(self, source_id, threshold, category=None):

~/Desktop/spatial_access/spatial_access/src/_p2pExtension.pyx in _p2pExtension.pyTransitMatrixIxSxUS.timeToNearestDestPerCategory()
    379 
    380     def timeToNearestDestPerCategory(self, source_id, category):
--> 381         return self.thisptr.timeToNearestDestPerCategory(source_id, category)
    382 
    383     def countDestsInRangePerCategory(self, source_id, category, range):

**IndexError: unordered_map::at: key not found**
@angela-li
Copy link
Member Author

angela-li commented Feb 14, 2020

I think this is due to a change made by @lixun910 in commit a726b41 on Models.py that prevents the AccessTime/AccessCount function and others from returning model output, which means that there is nothing to "calculate()" on.

@lixun910
Copy link
Member

@angela-li Just forward the emails (between me and Irene) to you.

@lixun910
Copy link
Member

@angela-li The two files committed in a726b41 were changed by @ifarah , and I just helped to push the changes into GeoDaCenter/spatial_access repo. I'd suggest you can just go and change the code to make it work:)

@angela-li
Copy link
Member Author

angela-li commented Feb 14, 2020

Thanks! While we should probably make sure the unit tests work (#90), I'm not sure this has to do with the a726b41 change, because the version on PyPI should be version 1.0.0 (released in June 2019) and shouldn't take into account any of these commits.

So now I'm rethinking that it has something to do with my _p2pExtension again that affects this line in the Models.py code:

time_to_nearest_neighbor = self.time_to_nearest_dest(source_id, category)

@lixun910
Copy link
Member

@angela-li I think spatial_access PyPi verion 1.0.0 does NOT contain the change of a726b41.

@angela-li
Copy link
Member Author

Yes, that's what I meant :) so I think it's something else internally that's not causing this to work.

@angela-li
Copy link
Member Author

@vidal-anguiano is this the same problem that you're running into? I can't get AccessTime or AccessCount to work either; would love if you wanted to take a look into the internals and figure out what's up!

@angela-li angela-li changed the title IndexError returned for calculate() function in test demo AccessTime / AccessSum models don't work with calculate() Feb 21, 2020
@angela-li angela-li changed the title AccessTime / AccessSum models don't work with calculate() AccessTime / AccessCount / AccessSum models don't work with calculate() Feb 21, 2020
@vidal-anguiano
Copy link
Contributor

@angela-li , yep, this is the exact problem I am running into as well! I'm looking into it right now, will let you know if I can figure it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants