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

Correct AttributeError from Conditional Statements (k1._has_jitter) #143

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

exowanderer
Copy link

[terms.py: Line 221] raises an AttributeError for kernels lacking the _has_jitter flag attribute.

Not all kernels include the flag attribute _has_jitter; and therefore, when multiplying 2 kernels that do not include the _has_jitter flag, the original version of this condition if k1._has_jitter or k2._has_jitter raises an AttributeError: "k1 does not have the attribute _has_jitter" (paraphrased).

By checking if the kernel k1 or k2 has the attribute _has_jitter at all, before checking if it will return True/False mitigates this AttributeError.

[terms.py: Line 221] raises an AttributeError for kernels lacking the `_has_jitter` flag attribute.

Not all kernels include the flag attribute `_has_jitter`; and therefore, when multiplying 2 kernels that do not include the `_has_jitter` flag, the original version of this condition `if k1._has_jitter or k2._has_jitter` raises an AttributeError: "`k1` does not have the attribute `_has_jitter`" (paraphrased).

By checking if the kernel `k1` or `k2` has the attribute `_has_jitter` at all, before checking if it will return True/False mitigates this AttributeError.
@dfm
Copy link
Owner

dfm commented Oct 7, 2020

I know it's been forever, but .....

Which terms wouldn't have that attribute? It's implemented as part of the base class: https://github.com/dfm/celerite/blob/main/celerite/terms.py#L35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants