detection

This module contains functions for processing and analyzing light curve data, including detecting common periods across different bands and simulating damped oscillations in light curves.

Differences between process1_new and process1

Both process1_new and process1 are designed to process and analyze light curve data to detect common periods across different light curve bands. However, there are several key differences in how the two functions operate and return results:

  1. Return Format: - `process1_new`: Returns a list of dictionaries. Each dictionary contains comprehensive information about detected periods, errors, significance, and sampling rates. This structured format is more user-friendly for data manipulation, especially in formats like JSON or Pandas DataFrames. - `process1`: Returns a NumPy array. This format is more compact and efficient but provides only numerical data without the metadata (e.g., object IDs and sampling rates). It is ideal for computational efficiency but less flexible for detailed data analysis.

  2. Result Compilation: - `process1_new`: The results are returned as dictionaries that contain metadata such as object IDs and sampling rates. This format is more useful for tasks requiring additional context, visualization, or exporting to files. - `process1`: Focuses on returning numerical data (such as period values and errors), making it more suitable for tasks that require a straightforward, efficient output.

  3. Data Structure: - `process1_new`: Provides structured data in the form of dictionaries, where each detected period is associated with the band pair it was detected in, making it easier to interpret. - `process1`: Returns a NumPy array without explicit labels, requiring the user to know the order of values returned, which may complicate interpretation.

  4. Usability: - `process1_new`: Best for detailed and flexible data manipulation, such as exporting results or visualization. - `process1`: Best for cases where computational performance is more important than having detailed, structured data.

In summary, process1_new is ideal for tasks requiring detailed output and flexible data handling, while process1 is optimized for efficient numerical processing.

process1tiktok

The process1tiktok function is an experimental function that processes and analyzes light curve data while simulating damped oscillations. This function is useful for testing how these injected signals are detected and how damping factors affect the detected periods.

This function simulates a signal with damping factors applied to both its amplitude and frequency. It can inject this simulated signal into real light curve data and attempt to detect periods using wavelet techniques.

### Parameters

  • data_manager : object The data manager that handles access to the dataset.

  • set1 : int Identifier representing the dataset to be processed.

  • initial_period : float The initial period of the signal injected into the light curve data.

  • damping_factor_amplitude : float Damping factor that modifies the amplitude of the injected signal over time.

  • damping_factor_frequency : float Damping factor that modifies the frequency of the injected signal over time.

  • snr : float, optional Signal-to-noise ratio of the injected signal. Default is None.

  • inject_signal : bool, optional If True, the function will inject the damped oscillating signal into the light curve data. Default is False.

  • ntau : int, optional Number of time delays for wavelet analysis. Default is None.

  • ngrid : int, optional Number of grid points for wavelet analysis. Default is None.

  • minfq : float, optional Minimum frequency for the wavelet analysis. If None, it is estimated from the data.

  • maxfq : float, optional Maximum frequency for the wavelet analysis. If None, it is estimated from the data.

  • parallel : bool, optional If True, the function will enable parallel processing to speed up calculations. Default is False.

### Returns

A NumPy array containing the detected common periods and related data across the light curves. The array has the following structure:

  • set1 (int): Identifier of the object.

  • sampling_i (float): Sampling rate for the first band in the pair.

  • sampling_j (float): Sampling rate for the second band in the pair.

  • period (float): The detected common period, or 0 if no period was detected.

  • upper_error (float): The upper bound of the period’s error, or 0 if no period was detected.

  • lower_error (float): The lower bound of the period’s error, or 0 if no period was detected.

  • significance (float): The statistical significance of the detected period, or 0 if no period was detected.

  • label (int): A label identifying the pair of light curves.

### Example Usage

This example shows how to use the process1tiktok function to simulate a damped oscillation and detect its period:

results = process1tiktok(data_manager, '1384142', initial_period=5.0, damping_factor_amplitude=0.2, damping_factor_frequency=0.1, snr=30, inject_signal=True)
np.savetxt('light_curve_tiktok_analysis.csv', results, delimiter=',')
QhX.detection.process1(data_manager, set1, ntau=None, ngrid=None, provided_minfq=None, provided_maxfq=None, include_errors=True, parallel=False)[source]

Processes and analyzes data related to light curves of a single object to detect common periods across different light curves.

Parameters:
  • set1 (int) – Identifier representing the dataset to be processed.

  • ntau (int, optional) – Number of time delays in the wavelet analysis.

  • ngrid (int, optional) – Number of grid points in the wavelet analysis.

  • provided_minfq (float, optional) – Period corresponding to the Minimum frequency for analysis, default is calculated from data.

  • provided_maxfq (float, optional) – Period corresponding to the Maximum frequency for analysis, default is calculated from data.

  • include_errors (bool, optional) – Flag to include magnitude errors in analysis, defaults to True.

Returns:

An array containing common periods and related data across light curves. This includes information on the periods detected in multiple bands, their errors, and significance levels. The focus is on identifying periods that do not differ more than 10% when detected in different bands, with emphasis on numerical values of periods, errors, and significance for a baseline band for comparison.

Return type:

np.ndarray

Notes

The function involves several steps:

  • Verifying the existence of the dataset.

  • Retrieving and processing light curve data from different bands.

  • Applying hybrid wavelet techniques to each band’s data.

  • Comparing periods detected in different bands to find common periods, ensuring they do not differ more than 10%.

  • Compiling results into a structured format, including periods, errors, and significance for the baseline comparison band.

QhX.detection.process1_new(data_manager, set1, ntau=None, ngrid=None, provided_minfq=None, provided_maxfq=None, include_errors=True, parallel=False)[source]

Processes and analyzes light curve data from a single object to detect common periods across different bands. The process involves: - Verifying the existence of the dataset. - Retrieving and processing light curve data for different bands. - Applying hybrid wavelet techniques to each band’s light curve data. - Comparing periods detected in different bands to find common periods, if they do not differ more than 10%. - Compiling the results, including period values, errors, and significance, into a structured format. :param set1: An identifier representing the dataset to be processed. :type set1: int :param ntau: Number of time delays in the wavelet analysis. :type ntau: int, optional :param ngrid: Number of grid points in the wavelet analysis. :type ngrid: int, optional :param provided_minfq: Period corresponding to the Minimum frequency for analysis, default is calculated from data. :type provided_minfq: float, optional :param provided_maxfq: Period corresponding to the Maximum frequency for analysis, default is calculated from data. :type provided_maxfq: float, optional :param include_errors: Include magnitude errors in analysis. Defaults to True. :type include_errors: bool, optional

Returns:

  • objectid (int): Identifier of the object ID.

  • sampling_i (float): Mean sampling rate in the first band of the pair where a common period is detected.

  • sampling_j (float): Mean sampling rate in the second band in the pair.

  • period (float): Detected common period between the two bands. NaN if no period is detected.

  • upper_error (float): Upper error of the detected period. NaN if no period is detected.

  • lower_error (float): Lower error of the detected period. NaN if no period is detected.

  • significance (float): Measure of the statistical significance of the detected period. NaN if no period is detected.

  • label (str): Label identifying the pair of bands where the period was detected (e.g., ‘0-1’, ‘1-2’).

Return type:

A list of dictionaries representing the results of the analysis performed on light curve data. Each dictionary contains

QhX.detection.process1tiktok(data_manager, set1, initial_period, damping_factor_amplitude, damping_factor_frequency, snr=None, inject_signal=False, ntau=None, ngrid=None, minfq=None, maxfq=None, parallel=False)[source]
QhX.detection.same_periods(r_periods0, r_periods1, up0, low0, up1, low1, peaks0, hh0, tt0, yy0, peaks1, hh1, tt1, yy1, ntau, ngrid, minfq, maxfq)[source]

Analyzes and identifies common periods between two sets of light curve data, assessing their consistency and statistical significance based on a relative tolerance.