bahamas_data¶
BAHAMAS Data Generation Script This script is part of the BAHAMAS project, which focuses on simulating gravitational wave signals. It is designed to generate synthetic data for gravitational wave detection and analysis. The script includes functionalities for signal processing, Power Spectral Density (PSD) analysis, and data simulation. It uses the BAHAMAS library for signal processing and data generation.
- Class: SignalProcessor
This class handles the signal processing, PSD analysis, and data simulation. It includes methods for computing frequency grids, simulating data, saving data to HDF5 files, and plotting the Power Spectral Density (PSD) of the generated signal.
- Usage:
The script can be run from the command line with the following arguments: –config: Path to the YAML file containing mission properties. –sources: Path to the YAML file containing source parameters.
- bahamas.bahamas_data.GP_freq(freqs, dt, psd, seed=42, time=False)¶
Generates a stationary Gaussian process using the inverse FFT method.
- Parameters:
freqs (array) – Frequency array.
dt (float) – Time step.
psd (array) – Power spectral density.
seed (int) – Random seed.
time (bool or str) – If True, returns time-domain signal. If ‘both’, returns both time and frequency domain.
- Returns:
Frequency and Fourier coefficients, or time and signal, or both.
- Return type:
tuple
- class bahamas.bahamas_data.SignalProcessor(config, sources)¶
Bases:
object
A class to handle signal processing, PSD analysis, and data simulation.
- SNR2(Sh, Sn)¶
Compute the squared Signal-to-Noise Ratio (SNR).
Parameters: - Sh (array): Signal PSD. - Sn (array): Noise PSD.
Returns: - float: Squared SNR.
- compute_SNR()¶
Compute and log the Signal-to-Noise Ratio (SNR) for each source.
- compute_frequency_grid()¶
Compute the frequency grid for the signal.
- compute_response(freqs)¶
Compute the response for the given frequencies.
Parameters: - freqs (array): Frequency grid.
Returns: - tuple: Response arrays.
- handle_series()¶
Handle the series based on configuration (chunks, or full resolution).
- plot_psd()¶
Plot the Power Spectral Density (PSD) of the generated signal.
- save_data()¶
Save the simulated data and responses to HDF5 files.
- simulate_data()¶
Simulate data based on the configuration and sources.
- bahamas.bahamas_data.average_chunks(freqs, data, response, chunk_size)¶
Averages data in chunks.
- Parameters:
freqs (array) – Frequency array.
data (array) – Data array.
response (array) – Response array.
chunk_size (int) – Size of each chunk.
- Returns:
Averaged frequency, data, and response arrays.
- Return type:
tuple
- bahamas.bahamas_data.average_log_chunks(freqs, data, response, num_bins=50)¶
Averages data in logarithmic bins.
- Parameters:
freqs (array) – Frequency array.
data (array) – Data array.
response (array) – Response array.
num_bins (int) – Number of bins.
- Returns:
Averaged frequency, data, response, and count arrays.
- Return type:
tuple