Skip to content

Greatly speed up the Bayesian Blocks

Matthew Pitkin requested to merge faster_bb into sky_shifting

The Bayesian Blocks calculation in the HeterodynedData class is particularly slow. It turns out that this is due to checks for whether the arrays pass to it are all zero or not. The np.any and np.all functions to not "short circuit" (i.e., they check all values and don't exit early if the criterion is not fullfilled. So, following the answer here, I've created a Numba-ified short circuited function that checks if all values are zero. This speeds up the Bayesian Blocks, and therefore the initialisation of a HeterodynedData object, by a huge amount.

I did try cythonizing this, but it turns out to be slower that the Numba-ified find_change_points function.

Merge request reports