-
Notifications
You must be signed in to change notification settings - Fork 76
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
Introduce simulation generators #604
Conversation
tests/core/simulation_generator.py
Outdated
adults = [0] + sorted(random.sample(xrange(1, nb_persons), nb_groups - 1)) | ||
|
||
members_entity_id = np.empty(nb_persons, dtype = int) | ||
members_legacy_role = np.empty(nb_persons, dtype = int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be helpful to write a reminder of the legacy_role
indexes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment to explain what legacy roles are
tests/core/simulation_generator.py
Outdated
|
||
def make_simulation(tax_benefit_system, nb_persons, nb_groups, **kwargs): | ||
""" | ||
Generate a simulation containing nb_persons persons spread in nb_groups groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would an example (or a link to one) would be useful for fist time users ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an example
tests/core/simulation_generator.py
Outdated
|
||
def randomly_init_variable(simulation, variable_name, period, max_value, condition = None): | ||
""" | ||
Initialise a variable with random values (from 0 to max_value) for the given period. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would an example (or a link to one) would be useful for fist time users ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an example
As for the directory, would openfisca_core/tools/script be more appropriate ? |
7b31f87
to
c761e48
Compare
c761e48
to
daa52b6
Compare
a9261b9
to
37b310a
Compare
Introduce a helper function to generate arbitrarily big populations.
I used it a lot to investigate performances, and it could be reused. I put in in tests, but there may be a better spot.
This is clearly low priority