ekaterinailin / AltaiPony

Find flares in Kepler and TESS light curves. Notebooks for quickstart inside.
https://altaipony.readthedocs.io
MIT License
26 stars 10 forks source link

An error in the criteria? #66

Closed keyuxing closed 3 years ago

keyuxing commented 3 years ago

What needs to be created or improved?

There might be something wrong with the definition of T2.

Can you provide an example?

The criteria is defined in altai.py as below:

T0 = flux - median  # excursion should be positive #"N0"
T1 = np.abs(flux - median) / sigma  # N1
T2 = np.abs(flux - median + error) / sigma  # N2
pass_thresholds = np.where((T0 > 0) & (T1 > N1) & (T2 > N2))

In your doc, N2 is regarded as the more restrictive criterion, and should be less than N1. However, if we assume error is positive, T2 is always greater than T1, and N1 becomes the more restrictive one. If we pass the _fluxerr to sigma, it is choosing N1=3 and N2=4 that check for the same criterion, not N2=2.

As you mentioned in the doc, the flare candidate definition follows the criteria in Chang et al. (2015). But in this paper, according to the equation (3a)

截屏2021-04-20 下午2 10 09

the data points refer to magnitude, not flux. Therefore, the "+ error" makes sense here

截屏2021-04-20 下午2 14 17

but should be "- error" when it comes to flux.

What is the goal / expected behaviour?

T2 should be defined as below:

T2 = np.abs(flux - median - error) / sigma  # N2
ekaterinailin commented 3 years ago

Fully agree, thanks for pointing it our! Something went wrong at some point in the development (the original function in Appaloos does it the right way). Changed it!