← 返回 Skills 市场
wu-uk

matched-filtering

作者 wu-uk · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ 安全检测通过
78
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gravitational-wave-detection-matched-filtering
功能描述
Matched filtering techniques for gravitational wave detection. Use when searching for signals in detector data using template waveforms, including both time-...
使用说明 (SKILL.md)

Matched Filtering for Gravitational Wave Detection

Matched filtering is the primary technique for detecting gravitational wave signals in noisy detector data. It correlates known template waveforms with the detector data to find signals with high signal-to-noise ratio (SNR).

Overview

Matched filtering requires:

  1. Template waveform (expected signal shape)
  2. Conditioned detector data (preprocessed strain)
  3. Power spectral density (PSD) of the noise
  4. SNR calculation and peak finding

PyCBC supports both time-domain and frequency-domain approaches.

Time-Domain Waveforms

Generate templates in time domain using get_td_waveform:

from pycbc.waveform import get_td_waveform
from pycbc.filter import matched_filter

# Generate time-domain waveform
hp, hc = get_td_waveform(
    approximant='IMRPhenomD',  # or 'SEOBNRv4_opt', 'TaylorT4'
    mass1=25,                  # Primary mass (solar masses)
    mass2=20,                  # Secondary mass (solar masses)
    delta_t=conditioned.delta_t,  # Must match data sampling
    f_lower=20                 # Lower frequency cutoff (Hz)
)

# Resize template to match data length
hp.resize(len(conditioned))

# Align template: cyclic shift so merger is at the start
template = hp.cyclic_time_shift(hp.start_time)

# Perform matched filtering
snr = matched_filter(
    template,
    conditioned,
    psd=psd,
    low_frequency_cutoff=20
)

# Crop edges corrupted by filtering
# Remove 4 seconds for PSD + 4 seconds for template length at start
# Remove 4 seconds at end for PSD
snr = snr.crop(4 + 4, 4)

# Find peak SNR
import numpy as np
peak_idx = np.argmax(abs(snr).numpy())
peak_snr = abs(snr[peak_idx])

Why Cyclic Shift?

Waveforms from get_td_waveform have the merger at time zero. For matched filtering, we typically want the merger aligned at the start of the template. cyclic_time_shift rotates the waveform appropriately.

Frequency-Domain Waveforms

Generate templates in frequency domain using get_fd_waveform:

from pycbc.waveform import get_fd_waveform
from pycbc.filter import matched_filter

# Calculate frequency resolution
delta_f = 1.0 / conditioned.duration

# Generate frequency-domain waveform
hp, hc = get_fd_waveform(
    approximant='IMRPhenomD',
    mass1=25,
    mass2=20,
    delta_f=delta_f,           # Frequency resolution (must match data)
    f_lower=20                 # Lower frequency cutoff (Hz)
)

# Resize template to match PSD length
hp.resize(len(psd))

# Perform matched filtering
snr = matched_filter(
    hp,
    conditioned,
    psd=psd,
    low_frequency_cutoff=20
)

# Find peak SNR
import numpy as np
peak_idx = np.argmax(abs(snr).numpy())
peak_snr = abs(snr[peak_idx])

Key Differences: Time vs Frequency Domain

Time Domain (get_td_waveform)

  • Pros: Works for all approximants, simpler to understand
  • Cons: Can be slower for long waveforms
  • Use when: Approximant doesn't support frequency domain, or you need time-domain manipulation

Frequency Domain (get_fd_waveform)

  • Pros: Faster for matched filtering, directly in frequency space
  • Cons: Not all approximants support it (e.g., SEOBNRv4_opt may not be available)
  • Use when: Approximant supports it and you want computational efficiency

Approximants

Common waveform approximants:

# Phenomenological models (fast, good accuracy)
'IMRPhenomD'      # Good for most binary black hole systems
'IMRPhenomPv2'    # More accurate for precessing systems

# Effective One-Body models (very accurate, slower)
'SEOBNRv4_opt'    # Optimized EOB model (time-domain only typically)

# Post-Newtonian models (approximate, fast)
'TaylorT4'        # Post-Newtonian expansion

Note: Some approximants may not be available in frequency domain. If get_fd_waveform fails, use get_td_waveform instead.

Matched Filter Parameters

low_frequency_cutoff

  • Should match your high-pass filter cutoff (typically 15-20 Hz)
  • Templates are only meaningful above this frequency
  • Lower values = more signal, but more noise

Template Resizing

  • Time domain: hp.resize(len(conditioned)) - match data length
  • Frequency domain: hp.resize(len(psd)) - match PSD length
  • Critical for proper correlation

Crop Amounts

After matched filtering, crop edges corrupted by:

  • PSD filtering: 4 seconds at both ends
  • Template length: Additional 4 seconds at start (for time-domain)
  • Total: snr.crop(8, 4) for time-domain, snr.crop(4, 4) for frequency-domain

Best Practices

  1. Match sampling/frequency resolution: Template delta_t/delta_f must match data
  2. Resize templates correctly: Time-domain → data length, Frequency-domain → PSD length
  3. Crop after filtering: Always crop edges corrupted by filtering
  4. Use abs() for SNR: Matched filter returns complex SNR; use magnitude
  5. Handle failures gracefully: Some approximants may not work for certain mass combinations

Common Issues

Problem: "Approximant not available" error

  • Solution: Try time-domain instead of frequency-domain, or use different approximant

Problem: Template size mismatch

  • Solution: Ensure template is resized to match data length (TD) or PSD length (FD)

Problem: Poor SNR even with correct masses

  • Solution: Check that PSD low_frequency_cutoff matches your high-pass filter, verify data conditioning

Problem: Edge artifacts in SNR time series

  • Solution: Increase crop amounts or verify filtering pipeline order

Dependencies

pip install pycbc numpy

References

安全使用建议
This is a coherent, instruction-only PyCBC matched-filtering guide. Before using it: 1) verify you trust the (unknown) source or run the instructions in an isolated environment; 2) be prepared to install PyCBC and its native dependencies (pip install pycbc may require system libraries and can be non-trivial); 3) ensure you provide correctly preprocessed 'conditioned' data and 'psd' objects — the skill assumes those exist but does not show how to compute them; and 4) because the skill contains executable Python snippets, review them for correctness before running on real data.
功能分析
Type: OpenClaw Skill Name: gravitational-wave-detection-matched-filtering Version: 0.1.0 The skill bundle provides legitimate documentation and Python code snippets for gravitational wave detection using the PyCBC library. The content in SKILL.md and _meta.json is strictly focused on scientific data analysis (matched filtering, waveform generation, and SNR calculation) and contains no indicators of malicious intent, data exfiltration, or unauthorized system access.
能力评估
Purpose & Capability
Name and description match the SKILL.md content. The instructions rely on PyCBC and numpy (explicitly mentioned) which are the expected dependencies for this task; no unrelated credentials, binaries, or config paths are requested.
Instruction Scope
The SKILL.md contains concrete code snippets for time- and frequency-domain matched filtering and only references domain-specific objects (e.g., conditioned, psd). It does assume the agent/environment provides preconditioned detector data and PSD objects but does not instruct reading unrelated files, environment variables, or exfiltration. The guide is prescriptive but omits how to obtain or compute 'conditioned' and 'psd' (this is a domain gap, not a security issue).
Install Mechanism
No install spec in the registry; the document recommends installing PyCBC and numpy via pip, which is appropriate and low risk. There are no download URLs or custom installers that would introduce high-risk arbitrary code retrieval.
Credentials
The skill requests no environment variables, credentials, or config paths. The requested scope (none) is proportional to an instruction-only data-processing guide.
Persistence & Privilege
always is false, and the skill does not request persistent system presence or modify other skills or system settings. Autonomous invocation is allowed by default but is not combined with other concerning privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gravitational-wave-detection-matched-filtering
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gravitational-wave-detection-matched-filtering 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Bulk publish from all-task-skills-dedup
元数据
Slug gravitational-wave-detection-matched-filtering
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

matched-filtering 是什么?

Matched filtering techniques for gravitational wave detection. Use when searching for signals in detector data using template waveforms, including both time-... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 78 次。

如何安装 matched-filtering?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gravitational-wave-detection-matched-filtering」即可一键安装,无需额外配置。

matched-filtering 是免费的吗?

是的,matched-filtering 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

matched-filtering 支持哪些平台?

matched-filtering 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 matched-filtering?

由 wu-uk(@wu-uk)开发并维护,当前版本 v0.1.0。

💬 留言讨论