-
Notifications
You must be signed in to change notification settings - Fork 21
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
Vectorize flatten #56
Comments
Hi, thanks for this idea. I have personally iterated over all of the Kepler light curves and had no performance issues. Can you describe the use case in more detail? |
It is quite a different case. A camera with only ~2000 pixels, based on photomultipliers, and a huge field of view. The detector is segmented and in addition, the characteristics of individual pixels varies in time. Therefore standard flat fielding + treating the detector as a whole is not the best choice. The pixels have a very large field of view, which with small PSF makes it reasonable to treat each pixel separately - flatten it separately. And here we come to looping over >2000 pixels, many times. |
I see two requirements here:
I can add a loop "inside" wotan (in it's Python part) which would solve (1) but not (2). Most of wotan's algorithms are written in numba or C and quite fast in itself - no gain from vectorization. One could gain a factor of a few from parallelization (n threads), one for each of the light curves. In most use cases, the Python overhead (compared to the actual calculations) should be small. Which of wotan's algorithms do you use? Can you supply a piece of code for benchmarking? I'd like to understand if there is a way to speed it up, and if so, how. |
Sorry for the late reply. I use flatten(). I must say that the looping overhead is much smaller than what I initially benchmarked a few months ago, but still non-negligible. I attach the file to benchmark (strange extension because .py is not accepted by github). I will use this opportunity to make some other remarks:
And, finally, not very constructive but... I stumbled upon wotan when looking for a replacement for a Cern ROOT TSpectrum class and its Background() function (https://root.cern.ch/root/html532/TSpectrum.html). I think wotan biweight in flatten() results in what I need more than the Background() of TSpectrum, however, the Background() is perhaps ~50% faster than flatten(), while it may be performing more computations. Initially, I thought that I get the time gain with Bakcground() because I am calling it while looping over pixels in C part of the code, but probably that is not the case. |
If you're working with XY+brightness pixel data, then wotan is not the right tool. It's build for time series data (time, flux, errors). Try this function instead.
|
I am working with time series data, separate for each pixel. I need to do what Wotan does - flatten a curve for each pixel. That's what is happening in the example that I gave you. The only difference from the standard astronomical cases are the flux units (single photons, can be 0), timescale (either integer ordinal numbers or microseconds) and the number of curves (separate for each pixel, as each pixel is an independent detector).
|
You could shift your light curves so that they center around one? |
I could, this is not a problem. However, it is easier to just get the trend and subtract from the data. I just thought that perhaps the original lightcurve - trend is used somewhere in the calculations. |
Hello,
As far as I understand, currently, wotan can flatten only a single curve. However, there are cases (like mine), where there are multiple curves with the same time axis. In such a case, it would be nice if wotan could accept a 2D array of values instead of a single vector. Of course, one can loop wotan over all the curves, but especially in Python, this is very inefficient.
The text was updated successfully, but these errors were encountered: