ENTERPRISE (Enhanced Numerical Toolbox Enabling a Robust PulsaR Inference SuitE) is a pulsar timing analysis code, aimed at noise analysis, gravitational-wave searches, and timing model analysis.
This bug will cause the wrong delays to be returned when signals.deterministic_signals.Deterministic.get_delay() is called repeatedly with the same parameters (e.g., when computing finite-difference partial derivatives). It wouldn't be a problem when every set of parameters is new, as in MCMC sampling.
one finds that yyret != xxret (correct) but xxret2 = yyret (wrong!).
Cause: that signals.deterministic_signals.Deterministic computes the delay and stores it in an instance variable, then the caching mechanism (signal.cache_call) saves a reference to the instance variable. So the second call (get_delay(yy)) ends up modifying the cached value for xx.
Cure: The fix is for get_delay to return a new array whenever it's called (this won't prevent caching to function correctly).
In general, any Signal that uses caching must return new numpy arrays if these are functions of the parameters. It's only OK to return references to instance variables for arrays that never change.
This bug will cause the wrong delays to be returned when signals.deterministic_signals.Deterministic.get_delay() is called repeatedly with the same parameters (e.g., when computing finite-difference partial derivatives). It wouldn't be a problem when every set of parameters is new, as in MCMC sampling.
Reproducible symptom: when issuing the sequence
one finds that
yyret != xxret
(correct) butxxret2 = yyret
(wrong!).Cause: that
signals.deterministic_signals.Deterministic
computes the delay and stores it in an instance variable, then the caching mechanism (signal.cache_call
) saves a reference to the instance variable. So the second call (get_delay(yy)
) ends up modifying the cached value forxx
.Cure: The fix is for
get_delay
to return a new array whenever it's called (this won't prevent caching to function correctly). In general, anySignal
that uses caching must return new numpy arrays if these are functions of the parameters. It's only OK to return references to instance variables for arrays that never change.