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

Automatic period adjustment #119

Merged
merged 6 commits into from
Oct 4, 2023
Merged

Conversation

nikhilwoodruff
Copy link
Contributor

This PR adds a few features that greatly speed up the process of monthlyising variables in country packages. Specifically:

  • Variables defined for years or months automatically cope when input values are set for periods that are contained or contain them. E.g. setting a monthly employment income variable to £30k over the year will divide appropriately.
  • Variables automatically are calculated up or down if requested for sub or super periods. E.g. asking for yearly employment income in June will divide down.

I've also widened the default error threshold condition in tests very slightly to 1e-3.

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (98576a6) 83.69% compared to head (3079c6e) 83.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
- Coverage   83.69%   83.38%   -0.32%     
==========================================
  Files         182      182              
  Lines        8711     8686      -25     
  Branches     1082     1079       -3     
==========================================
- Hits         7291     7243      -48     
- Misses       1176     1191      +15     
- Partials      244      252       +8     
Files Coverage Δ
policyengine_core/holders/holder.py 68.59% <100.00%> (-2.84%) ⬇️
policyengine_core/tools/test_runner.py 73.36% <100.00%> (+0.12%) ⬆️
policyengine_core/variables/variable.py 85.76% <100.00%> (-0.52%) ⬇️
tests/core/test_calculate_output.py 100.00% <ø> (ø)
tests/core/test_countries.py 98.46% <ø> (-0.31%) ⬇️
tests/core/test_holders.py 100.00% <ø> (ø)
tests/core/test_reforms.py 98.96% <ø> (-0.05%) ⬇️
policyengine_core/simulations/simulation.py 54.39% <52.38%> (-1.12%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nikhilwoodruff nikhilwoodruff merged commit 87cd38a into master Oct 4, 2023
4 of 6 checks passed
@nikhilwoodruff nikhilwoodruff deleted the automatic-period-adjustment branch October 4, 2023 19:05
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

Successfully merging this pull request may close these issues.

1 participant