-
Notifications
You must be signed in to change notification settings - Fork 67
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
cache_call messes up likelihood if more than one CW source is added #214
Comments
This seems to be a problem with the way that I think I can fix this. Let me ask though, are you using a branch or fork? In enterprise_extensions master and dev, |
I was using a fork, but now it's in master of Not sure how related it is, but once we look at how CW parameters are handled, maybe we would also want to look at how the pulsar term parameters are handled if multiple CWs are present? As in this issue: #199 |
Fixes this issue: nanograv#214 And related problems when using Deterministic signals other than CWs
Hi @bencebecsy and @vallis, Unfortunately, I've found that this likelihood error can occur in much broader situations and that many people may have been unknowingly affected. The issue can occur when you use multiple Deterministic signals. For example solar wind, exponential dips, DM annual. This is of course a significant problem but even moreso because once the likelihood calculation breaks it can stay broken, unnoticed, for a while. It can clearly manifest if the likelihood happens to be erroneously too large, which would make the PTMCMC chain get stuck (yet those using a nested sampler can continue on, unfortunately). The fix I have is to set Once the I'm keen to get your thoughts on the underlying cause, @vallis . If the fixes make sense I can make a pull request. |
Ah! @vallis the issue existed in the version of enterprise in my conda environment, which was the version used for the NANOGrav 15yr analysis, but it does not exist in the most recent version. This bug fix for deterministic_signals solves it! Does it make sense that setting limit=1 as above also made the symptoms disappear? |
TLDR: It looks like cache_call does something funky if the PTA object has more than one CW signal in it and the likelihood is called multiple times (which, of course, happens always in MCMCs). For now, I have a workaround of changing the default limit to 1 in cache call (here: https://github.com/nanograv/enterprise/blob/master/enterprise/signals/signal_base.py#L853), but it would be nice if someone familiar with cache_call could look into this and figure out how to solve this properly.
Details:
I ran on Linux, with an enterprise version sometime from earlier this year. I set up my PTA object like this:
Then, I calculate the likelihood difference when moving a bit away from a given point:
When I run it first, I get the right answer:
The second time I run the same code, I get different values:
If I change the limit to 1 in cache_call as described above, I get the same results anytime I call this test which is identical to the one I get the first time.
The text was updated successfully, but these errors were encountered: