Skip to content

Commit

Permalink
Merge pull request #767 from PolicyEngine/MaxGhenis/issue766
Browse files Browse the repository at this point in the history
Unpin numpy
  • Loading branch information
nikhilwoodruff authored Oct 9, 2023
2 parents 9ff9d03 + 9babdef commit 0cf69c3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 22 deletions.
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
removed:
- numpy pin.
2 changes: 1 addition & 1 deletion policyengine_uk/variables/gov/dwp/tax_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def formula(benunit, period, parameters):
"property_income",
]
income = add(benunit, period, STEP_1_COMPONENTS)
income = amount_over(income, TC.means_test.non_earned_disregard)
income = max_(income - TC.means_test.non_earned_disregard, 0)
STEP_2_COMPONENTS = [
"employment_income",
"self_employment_income",
Expand Down
9 changes: 2 additions & 7 deletions policyengine_uk/variables/gov/dwp/universal_credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,8 @@ def formula(benunit, period, parameters):
rent = benunit("benunit_rent", period)
max_housing_costs = select(
[
np.isin(
tenure_type,
[
TenureType.RENT_FROM_COUNCIL,
tenure_type == TenureType.RENT_FROM_HA,
],
),
(tenure_type == TenureType.RENT_FROM_COUNCIL)
| (tenure_type == TenureType.RENT_FROM_HA),
tenure_type == TenureType.RENT_PRIVATELY,
],
[rent, min_(benunit("LHA_cap", period), rent)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ def formula(person, period, parameters):
CB_received = person.benunit("child_benefit", period)
CB_HITC = parameters(period).gov.hmrc.income_tax.charges.CB_HITC
percentage = (
amount_over(
person("adjusted_net_income", period),
CB_HITC.phase_out_start,
max_(
person("adjusted_net_income", period)
- CB_HITC.phase_out_start,
0,
)
# HITC is specified as a percent of Child Benefit recollected for
# every £1,000 over the phase-out threshold.
Expand Down
13 changes: 7 additions & 6 deletions policyengine_uk/variables/gov/hmrc/national_insurance/class_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def formula(person, period, parameters):
* WEEKS_IN_YEAR
/ MONTHS_IN_YEAR,
)
add_earnings = amount_over(
earnings,
class_1.thresholds.upper_earnings_limit
add_earnings = max_(
earnings
- class_1.thresholds.upper_earnings_limit
* WEEKS_IN_YEAR
/ MONTHS_IN_YEAR,
0,
)
main_charge = class_1.rates.employee.main * main_earnings
add_charge = class_1.rates.employee.additional * add_earnings
Expand Down Expand Up @@ -71,9 +72,9 @@ class employer_NI_class_1(Variable):
def formula(person, period, parameters):
class_1 = parameters(period).gov.hmrc.national_insurance.class_1
earnings = person("employment_income", period)
main_earnings = amount_over(
earnings,
class_1.thresholds.secondary_threshold * WEEKS_IN_YEAR,
main_earnings = max_(
earnings - class_1.thresholds.secondary_threshold * WEEKS_IN_YEAR,
0,
)
return class_1.rates.employer * main_earnings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def formula(person, period, parameters):
class_4.thresholds.lower_profits_limit,
class_4.thresholds.upper_profits_limit,
)
add_amount = amount_over(
profits, class_4.thresholds.upper_profits_limit
)
add_amount = max_(profits - class_4.thresholds.upper_profits_limit, 0)
main_charge = main_amount * class_4.rates.main
add_charge = add_amount * class_4.rates.additional
return main_charge + add_charge
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
"gif[plotly]>=3.0.0",
"inquirer>=2.7.0",
"microdf_python>=0.3.0",
"numpy<1.22",
"pandas",
"plotly>=4.14.3",
"PolicyEngine-Core>=2.1,<3",
"PolicyEngine-Core>=2.8.1,<3",
"pyyaml>=5.3.1",
"pytest",
"requests>=2.25.1",
Expand Down

0 comments on commit 0cf69c3

Please sign in to comment.