-
Notifications
You must be signed in to change notification settings - Fork 875
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
Fix issue#1768. Change model_vars[var] from List to Dictionary in datacollector.py #2095
Conversation
Change model_vars[var] from List to Dictionary. Modify tests to fit changes.
Performance benchmarks:
|
Thanks for this PR! It's quite a bit breaking change, because users themselves use We're having a big discussion about the future of the datacollector, mainly in #348. We would like to redesign it in the coming months, and then we should also include this issue. So please participate in that discussion. (unfortunately, our time is also limited, it's still all volunteer work at this point, so it moves a little slow) |
Got it. I'll look into the discussion |
I'd say it's fine to introduce a breaking change after the 2.3 release (if the next release is going to be 3.0). There is no telling when the new data collection implementation will arrive, and even so, it will be part of |
@NirobNabil Just curious, did you try this change with Thanks for the PR! |
I haven't yet. I'll do a test at night and let you know update |
While I like the direct access this PR provides to model vars, it will take up more space since |
@NirobNabil would you like to continue working on this PR? |
This PR has become stale, closing for now. |
As discussed in the issue, changed
model_vars[var]
in the datacollector from list to dictionary to keep thestep
column inget_model_vars_dataframe()
andget_agent_vars_dataframe()
synchronized.Changed the
test_datacollector.py
accordingly to fit it to the new dictionary structure.One point I'd need some suggestion is,
Previously in the
step_assertion
function oftest_datacollector.py
, this line was checking if the index of the currently selected element is less than 4. But actually theindex()
function returns the first occurrence of an item in the list. So because themodel_var
list actually contains 5 consecutive 10s theindex()
function always returns 0 forelement=10
but if i understand right, line 133 is supposed to run only for 4 iterations but due to theindex()
function always returning zero Line 133 runs for 5 consecutive iterations.I assumed this was unintentional and lline 133 should actually run for 5 iterations so i wrote my test file accordingly. If my assumption was wrong or i need to make any modifications to the code please do let me know.