barentsen / dave

Discovery And Vetting of K2 Exoplanets
MIT License
6 stars 3 forks source link

Modshift fails with error " Model is all flat! Exiting..." #10

Closed fergalm closed 8 years ago

fergalm commented 8 years ago

212302211, in C6, raised an exception IOError('FAIL: modshift returned error: Model is all flat! Exiting...\n')

I checked the contents of clip.trapFit.bestFitModel, which is the input model to trap fit, and it is decidedly non-zero. Jeff, can you take a look?

JeffLCoughlin commented 8 years ago

When I run clip.unsetexception I get:

----> 1 clip.unsetexception

/home/jeff/KeplerJob/DAVE/GIT/dave/pipeline/clipboard.pyc in getattr(self, keyString) 122 return self.get(keyString) 123 except KeyError: --> 124 return object.getattr(keyString) 125 126 def setstate(self, data):

AttributeError: type object 'object' has no attribute 'getattr'

JeffLCoughlin commented 8 years ago

When running: ----> 1 clip.__get

I get: /home/jeff/KeplerJob/DAVE/GIT/dave/pipeline/clipboard.pyc in getattr(self, keyString) 122 return self.get(keyString) 123 except KeyError: --> 124 return object.getattr(keyString) 125 126 def setstate(self, data):

AttributeError: type object 'object' has no attribute 'getattr'

JeffLCoughlin commented 8 years ago

Okay resolved. clip.unsetException() works. Diagnosing the main problem now...

JeffLCoughlin commented 8 years ago

Looks like this was failing when it went to compute the strength of the odd-only transits, but worked when all the data was used.

I ended up changing the code so that in the case of no in-transit points it will just exit the function that it's in, not the whole program. I also added default values to the outputs of 0 or 1. (0's for the sigmas, 1's for the errors and Fred, so it avoids any divide-by-zero errors).

This means that when there are no in-transit points for the odd- or even- only, it will just default to a odd-even statistic of zero (default pass). The code will run normally for the light curve as a whole. Also, if there are no in-transit points for the entire light curve, as we've seen for a few other systems, then it should gracefully return default values of 0.0 for sig_pri. Right now that should make it fail in vetting (as something with no points in transit probably should), but we can change that in the vetting code if we want it to pass.