Skip to content

Commit

Permalink
trying again
Browse files Browse the repository at this point in the history
  • Loading branch information
coltleese17 committed Jul 28, 2024
1 parent e4ee6e0 commit 8ebca1d
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fiscalsim_us.model_api import *

import numpy as np

class co_state_supplement_eligible(Variable):
value_type = bool
Expand All @@ -15,15 +15,16 @@ def formula(person, period, parameters):
age = person("age", period)
p = parameters(period).gov.states.co.ssa.state_supplement

# Handle potential None or NaN values
ssi_eligible = np.nan_to_num(ssi_eligible, nan=False)
is_disabled = np.nan_to_num(is_disabled, nan=False)
is_blind = np.nan_to_num(is_blind, nan=False)
# Convert to boolean arrays and handle potential None or NaN values
ssi_eligible = np.array(ssi_eligible).astype(bool)
is_disabled = np.array(is_disabled).astype(bool)
is_blind = np.array(is_blind).astype(bool)

disabled_or_blind = is_disabled | is_blind
in_age_range = p.age_range.calc(age)

# Handle potential None or NaN in in_age_range
in_age_range = np.nan_to_num(in_age_range, nan=False)

return disabled_or_blind & ssi_eligible & in_age_range
# Convert in_age_range to boolean array
in_age_range = np.array(in_age_range).astype(bool)

# Use bitwise & for the final operation
return disabled_or_blind & ssi_eligible & in_age_range

0 comments on commit 8ebca1d

Please sign in to comment.