Source code for feets.extractors.ext_dmdt
#!/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
# =============================================================================
"""Delta m and Delta t extractor."""
# =============================================================================
# IMPORTS
# =============================================================================
import copy
import numpy as np
from .extractor import Extractor
from ..libs import doctools
__all__ = ["DeltamDeltat"]
# =============================================================================
# CONSTANTS
# =============================================================================
DEFAULT_DT_BINS = np.hstack([0.0, np.logspace(-3.0, 3.5, num=23)])
DEFAULT_DM_BINS = np.hstack(
[-1.0 * np.logspace(1, -1, num=12), 0, np.logspace(-1, 1, num=12)]
)
# =============================================================================
# EXTRACTOR CLASS
# =============================================================================
[docs]
class DeltamDeltat(Extractor):
r"""Delta m and Delta t extractor.
**DeltamDeltat**
The 2D histogram of the differences in magnitude (Delta m) and time
(Delta t) between all pairs of observations in a light curve.
Parameters
----------
dt_bins : array-like, optional
The bins for the time differences.
dm_bins : array-like, optional
The bins for the magnitude differences.
References
----------
.. [astro-ph.IM] Mahabal, A. A., Sheth, K., Gieseke, F., Pai, A.,
Djorgovski, S. G., Drake, A. J., & Graham, M. J. (2017). Deep-learnt
classification of light curves. 2017 IEEE Symposium Series on
Computational Intelligence (SSCI), 1-8.
Examples
--------
>>> fs = feets.FeatureSpace(only=["DeltamDeltat"])
>>> features = fs.extract(**lc_normal)
>>> features[0]
{'DeltamDeltat': {'dt_0_dm_0': np.int64(0),
'dt_1_dm_0': np.int64(0),
...
'dt_22_dm_23': np.int64(0)}}
"""
features = ["DeltamDeltat"]
def __init__(self, dt_bins=None, dm_bins=None):
self.dt_bins = np.asarray(
copy.deepcopy(DEFAULT_DT_BINS) if dt_bins is None else dt_bins
)
self.dm_bins = np.asarray(
copy.deepcopy(DEFAULT_DM_BINS) if dm_bins is None else dm_bins
)