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

Aegean Exception class #169

Closed
tjgalvin opened this issue Jan 19, 2022 · 0 comments
Closed

Aegean Exception class #169

tjgalvin opened this issue Jan 19, 2022 · 0 comments
Assignees
Labels
fixed in dev Issue has been fixed in the development (dev) branch.

Comments

@tjgalvin
Copy link
Contributor

I had an instance recently where lmfit was raising exceptions to highlight NaNs in either the data or model output when performing optimisation. It turned out that sometimes during optimisation that parameters were set to NaN as they were passed to the residual function, which in turn generates a model made up of all NaNs. This was a little bit of a pain to track down as aegean correctly masks all NaNs in the data to begin with.

Although one could capture the ValueError raised by lmfit, a ValueError is an awfully broad exception and might be a little painful to test against during the exception handling, I thought the better approach would be to have a class AgeanError class that we can subclass to better handle these strange errors.

In #168 I have made an AegeanNaNModelError that is raised in the residual function if there are any NaNs, and is capture in the non-priorised fitting routine in sourcefinder.py. This, I think, lets us better handle the cases where there are errors we do not care about, and still correctly raise new ones we don't currently know about.

Happy to discuss further

@PaulHancock PaulHancock self-assigned this Jul 15, 2022
@PaulHancock PaulHancock added the fixed in dev Issue has been fixed in the development (dev) branch. label Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in dev Issue has been fixed in the development (dev) branch.
Projects
None yet
Development

No branches or pull requests

2 participants