OxES / k2sc

K2 systematics correction using Gaussian processes
https://oxes.github.io/k2sc/
GNU General Public License v3.0
17 stars 11 forks source link

Linear algebra error crashes detrender #30

Open amcody opened 3 years ago

amcody commented 3 years ago

k2sc runs successfully on most of my light curves, but I am finding that for a percent or two of them, it returns an error in the section of gp.py that calls scipy.linalg.cho_factor.

https://github.com/OxES/k2sc/blob/33eedb929e0bc6524a81b41e52d8c4463f9a1c72/src/gp.py#L83-L84

The particular error message is numpy.linalg.LinAlgError: 943-th leading minor of the array is not positive definite (though the number 943 changes from light curve to light curve), and it causes a fatal crash. I don't understand why this is happening, as the offending light curves do not have any obvious defects.

amcody commented 3 years ago

Update: I just noticed that the problem must be related to some changes that were implemented in the last year or so, because I'm now getting these crashes where I did not use to. In other words, I successfully ran k2sc on some "AMC format" files last year and output fits files. I am redoing them now because I found that the output cadences were wrong (16 bit vs 32 bit). But when I go to redo them, a small fraction fail and I'm stuck with the old output.

benjaminpope commented 3 years ago

Hi @amcody,

I'm sorry I'm only getting to this now. Do you have an example where it braks? I can try and figure it out.

All the best,

Ben