Source code for feets.extractors.ext_con
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2024, Cabral, Juan
# Copyright (c) 2025, QuatroPe; ClariĆ”, Felipe
# License: MIT
# Full Text:
# https://github.com/quatrope/feets/blob/master/LICENSE
# =============================================================================
# DOC
# =============================================================================
"""Con extractor."""
# =============================================================================
# IMPORTS
# =============================================================================
import numpy as np
from .extractor import Extractor
from ..libs import doctools
# =============================================================================
# EXTRACTOR CLASS
# =============================================================================
[docs]
class Con(Extractor):
r"""Con extractor.
**Con**
Index introduced for the selection of variable stars from the OGLE
database (Wozniak 2000). To calculate Con, we count the number of three
consecutive data points that are brighter or fainter than :math:`2\sigma`
and normalize the number by :math:`N-2`.
For a normal distribution and by considering just one star, Con should
take values close to :math:`0.045`.
Parameters
----------
consecutive_star : int, optional (default=3)
Number of consecutive data points to consider.
References
----------
.. [kim2011quasi] Kim, D. W., Protopapas, P., Byun, Y. I., Alcock, C.,
Khardon, R., & Trichas, M. (2011). Quasi-stellar object selection
algorithm using time variability and machine learning: Selection of
1620 quasi-stellar object candidates from MACHO Large Magellanic Cloud
database. The Astrophysical Journal, 735(2), 68.
Doi:10.1088/0004-637X/735/2/68.
Examples
--------
Con of a normal time series:
>>> fs = feets.FeatureSpace(only=["Con"], consecutive_star=1)
>>> features = fs.extract(**lc_normal)
>>> features[0]
{'Con': 0.042}
"""
features = ["Con"]
def __init__(self, consecutive_star=3):
self.consecutive_star = consecutive_star