-
Notifications
You must be signed in to change notification settings - Fork 60
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
Reading out data in time interval #120
Comments
Since detailed network animations can be created, this information is already saved somewhere, right? |
@EwoutH thanks for the issues and PRs. I will give you detailed feedback after I get back to work. Quick comments: The data is mostly saved in |
Thanks for getting back. Since most data is in the vehicle, that first needs to be translated to the links. Are there existing functions/data I can hook into? Then from the links we need to aggerate per area. So I think:
Another approach could be to use the existing, How would you approach it? And are there specific functions I could use? |
I'm going to do a deep dive into this tomorrow. Goal is to create a convenient area_to_pandas_in_timespawn function that takes a start and (optionally) end time and reports statistics over that period of time. Having #119 merged might help a lot with keeping that fast. |
@EwoutH As you might noticed (and I forgot to mention), some link-level data is stored in the following variables.
In #123, it looks like you modified how these variables computed. Unfortunately it broke some important logic of the simulator. This must be the reason of failure of these tests . Is it possible to implement your functions without altering the internal logic? It is preferable (and hopefully easy) if you can implement your functions by only adding new methods to |
#123 was a rough draft that's nowhere close to ideal, it just (looks like it) works good enough for my research. Ideally, all that data generated by UXsim should be able to be indexed over time. I see two approaches:
If not all data would be collected, you could get away with some duplication of data on time intervals. Just readout the variable the model uses and save them in a separate variable used for data analysis. #123 was kind of a hybrid solution, in which I stored some timestamps and then aggerated them over some bin width.
Unfortunately, it's impossible to do this without making some (small) changes to What might be interesting, in the Mesa library we're currently working on a similar challenge, over how to collect data from agent-based models. We're working on a more complicated solution in which certain variables are tracked for state changes. Might not be the best fit for UXsim, but there might be some ideas in that as wel.
CC @quaquel |
Unfortunately, I feel sorry to say that changing the internal logic for this specific purpose (as made by #123) is not acceptable, as it critically break backward compatibility, and even putting that aside, we would still need to thoroughly review all the code. |
Maybe I can add more comprehensive and user-friendly getter functions |
In fact, there are getter-like functions already: But I believe directly accessing the lists |
Ah thanks, I indeed didn't know all these things. That helps a lot (and I wish I knew them before starting the implementation in #123). I will try to come up with an implementation using slicing, if I can find the time. But having #119 and #121 merged helps already, that makes the PR diffs smaller, thanks! |
Thanks for all your work yesterday and today! Would you like to implement this functionality as an example of how users can use the |
If you can implement this time-interval-based and #122 's zone-based methods as Works using |
What's the idea behind this check? Line 1221 in 112b425
Finding this took over an hour of debugging why my dataframes kept being empty... |
Right, it's probably so that you don't calculate it too many times? But you want to do exactly that if you want to compute it multiple times. |
I thought splitting in |
That's true. The original design intention is that these Analyzer functions only run after the simulation finished, so only 1 computation was sufficient. I think |
Let's say I have a model that simulates n hours and I want to collect data every hour. For example, I would like get something like
area_to_pandas
every hour (in simulation time), for the past hour.Currently, if I call area_to_pandas(), it calculates everything from the start of the simulation towards the current state.
So I'm curious what's the best way do do such a thing. I already have mechanisms to call it every hour (or n seconds), but I just need a way to only collect data from the last hour and not the full duration.
The text was updated successfully, but these errors were encountered: