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

Raise a more informative error message. #352

Open
mo2561057 opened this issue Apr 30, 2020 · 1 comment
Open

Raise a more informative error message. #352

mo2561057 opened this issue Apr 30, 2020 · 1 comment
Labels
documentation good-first-issue These are issues which can be tackled by new users and contributors. priority-low

Comments

@mo2561057
Copy link
Member

respy/respy/solve.py

Lines 74 to 88 in fd580c3

for i, choice in enumerate(optim_paras["choices"]):
if f"wage_{choice}" in optim_paras:
wage_columns = optim_paras[f"wage_{choice}"].index
log_wage = np.dot(
states[wage_columns].to_numpy(dtype=COVARIATES_DOT_PRODUCT_DTYPE),
optim_paras[f"wage_{choice}"].to_numpy(),
)
wages[:, i] = np.exp(log_wage)
if f"nonpec_{choice}" in optim_paras:
nonpec_columns = optim_paras[f"nonpec_{choice}"].index
nonpecs[:, i] = np.dot(
states[nonpec_columns].to_numpy(dtype=COVARIATES_DOT_PRODUCT_DTYPE),
optim_paras[f"nonpec_{choice}"].to_numpy(),
)

This is a part of the code that will frequently throw errors due when dealing with large models.
If there is a small spelling mistake or a corrupted row in the params file there will be a key error here.
I think we could provide the user with a more informative message indicating that this is probably due to a variable that is misspelled or not in the covariates.

@mo2561057 mo2561057 added documentation good-first-issue These are issues which can be tackled by new users and contributors. priority-low labels Apr 30, 2020
@tobiasraabe
Copy link
Member

Very good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good-first-issue These are issues which can be tackled by new users and contributors. priority-low
Projects
None yet
Development

No branches or pull requests

2 participants