Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7800.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid formula warnings in North Carolina TANF, Pennsylvania TANF, and Vermont military retirement exemption calculations.
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@
nc_tanf_household_size: 0
output:
nc_tanf_income_eligible: false

- name: Demographically eligible household with 0 household size is still ineligible.
period: 2024
input:
state_code: NC
nc_tanf_reduced_need_standard: 72 * 12
nc_tanf_household_size: 0
nc_demographic_tanf_eligible: true
output:
nc_tanf_income_eligible: false
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ def formula(spm_unit, period, parameters):
household_size = spm_unit("nc_tanf_household_size", period)
reduced_need_standard = spm_unit("nc_tanf_reduced_need_standard", period)

need_standard_fraction = reduced_need_standard / household_size
need_standard_fraction = np.divide(
reduced_need_standard,
household_size,
out=np.zeros_like(reduced_need_standard, dtype=float),
where=household_size != 0,
)
difference_threshold = (
p.average_reduced_need_standard_threshold * MONTHS_IN_YEAR
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def formula(spm_unit, period, parameters):
gross_earned_income = add(spm_unit, period, ["tanf_gross_earned_income"])
has_earned_income = gross_earned_income > 0
wer_amount = where(
~p.deduction_applies & has_earned_income,
(not p.deduction_applies) & has_earned_income,
p.reimbursement,
0,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ def formula(tax_unit, period, parameters):
agi_below_threshold = max_(p.partial_exemption_threshold - agi, 0)

# Use mask to avoid division by zero
valid_threshold_difference = threshold_difference != 0
partial_exemption_amount = where(
valid_threshold_difference,
tax_unit_military_retirement_pay
* agi_below_threshold
/ threshold_difference,
0,
valid_threshold_difference = thresholds_are_finite & (threshold_difference != 0)
partial_exemption_amount = np.divide(
tax_unit_military_retirement_pay * agi_below_threshold,
threshold_difference,
out=np.zeros_like(agi, dtype=float),
where=valid_threshold_difference,
)

# Calculate exemption amounts for each case
Expand Down
Loading