Skip to content

Commit

Permalink
Update condition for expression
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainipp committed Feb 11, 2025
1 parent 065e316 commit 9b5b624
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openfisca_survey_manager/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def set_target_margin(self, variable, target):
for var in list_var:
expr_categ = var + '[ ]*[<>=]+'
true_var = simulation.tax_benefit_system.variables[var]
if var != list_var and true_var.value_type == Enum or true_var.unit in ['years', 'months']:
assert len(re.findall(expr_categ, var)) > 0, "A categorical variable is used in an expression without direct condition on its value. Please use inequality operator to transform it into float"
if (var != list_var) and true_var.value_type == Enum or true_var.unit in ['years', 'months']:
assert len(re.findall(expr_categ, variable)) > 0, "A categorical variable is used in an expression without direct condition on its value. Please use inequality operator to transform it into float"
if categorical_variable:
value = simulation.calculate(variable, period = period)
filtered_value = value if (filter_by == numpy.array(1.0) or all(filter_by)) else value[filter_by.astype(bool)]
Expand Down Expand Up @@ -267,7 +267,7 @@ def set_calibrated_weights(self):
# Delete other entites already computed weigths
# to ensure that this weights a recomputed if they derive from
# the calibrated weight variable
if weight_variable.formulas:
elif weight_variable.formulas:
simulation.delete_arrays(weight_variable.name, period)

def summary(self):
Expand Down

0 comments on commit 9b5b624

Please sign in to comment.