Skip to main content

Zero Latency Whitening Utilities

Project description

zlw — Zero‑Latency Whitening utilities

Pipeline Status Coverage Python Version

zlw is a focused package for zero‑latency whitening in gravitational‑wave data analysis. It provides rigorous tools for:

  • Whitening Kernels: Computing Minimum‑Phase (MP) filters that whiten data without introducing acausal latency.
  • Perturbative Corrections: Geometric drift correction terms for the MP–MP scheme. These calculate the precise timing ($dt$) and phase ($d\phi$) biases introduced when the template PSD differs slightly from the real noise PSD.

Installation

pip install zlw

Structure

  • zlw.kernels: Construction of MP whitening filters and frequency response utilities.
  • zlw.corrections: Perturbative MP–MP correction terms (PerturbativeMPCorrection).
  • zlw.fourier, zlw.window: FFT and windowing backend helpers.
  • zlw.bin: Simulation and QA scripts.

Part 3: Example 1 (Whitening Filters)

Quick Examples

1. Computing a Whitening Filter

from zlw.kernels import MPWhiteningFilter

# psd: One‑sided PSD array (Hz^-1)
# fs: Sampling rate (Hz)
# n_fft: FFT length (e.g., 4 * fs)
wf = MPWhiteningFilter(psd, fs, n_fft)

# Get the one‑sided complex frequency response
# This response is minimum-phase (causal)
Wf = wf.frequency_response()

2. Computing Perturbative Corrections

If your template PSD (psd2) differs from the actual noise PSD (psd1), you can calculate the resulting geometric drift corrections.

import numpy as np
from zlw.corrections import PrtPsdDriftCorrection

# freqs:  One‑sided frequency grid
# psd1:   Realization/Noise PSD (The truth)
# psd2:   Template PSD (The model)
# htilde: Template waveform (frequency domain)

corr = PrtPsdDriftCorrection(
    freqs=freqs,
    psd1=psd1,
    psd2=psd2,
    htilde=htilde,
    fs=4096.0
)

# Calculate first-order geometric corrections
results = corr.correction()

print(f"Time Drift: {results.dt1:.4e} s")
print(f"SNR Loss:   {results.dsnr1:.4f}")

Development

To install development dependencies and run the test suite (requires lalsuite):

# Install in editable mode with dev dependencies
pip install -e .[dev]

# Run tests
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zlw-0.2.0.tar.gz (75.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zlw-0.2.0-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file zlw-0.2.0.tar.gz.

File metadata

  • Download URL: zlw-0.2.0.tar.gz
  • Upload date:
  • Size: 75.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for zlw-0.2.0.tar.gz
Algorithm Hash digest
SHA256 af477e46ab71d04e114f02380a40ced8a73a968a323d3d24569b2c8b0af3cb13
MD5 27ee58fa7392196ae128ddfa5e110d67
BLAKE2b-256 ed233574ccd9f39e130eb2d900df60bdb8de14dc83fc5c0853be1ada652b72e7

See more details on using hashes here.

File details

Details for the file zlw-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zlw-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for zlw-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81fc33fd6ce29f17e3cb847361d18bfa900c53b910b443c79c5e2a114b189b2b
MD5 7cdbc9ce5204ca3345d4c4ca17c82102
BLAKE2b-256 61e788e041afd58cab46a1042afa61965871f9eb0acbd7616491ad349c5fc8f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page