Skip to content
Back to skills

Gradient Event Boundary Detection

ASecurity

Detect event start/end boundaries in time series by finding extrema of the first derivative (steepest gradient points)

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
developmentpythongo

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill gradient-event-boundary-detection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gradient Event Boundary Detection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gradient Event Boundary Detection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-gradient-event-boundary-detection/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-gradient-event-boundary-detection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: timeseries-gradient-event-boundary-detection
description: Detect event start/end boundaries in time series by finding extrema of the first derivative (steepest gradient points)
domain: timeseries
---

# Gradient Event Boundary Detection

## Overview

For events with gradual onset and offset (transits, dips, ramps), locate boundaries by computing the first derivative and finding its extrema. The steepest descent marks event start (ingress); steepest ascent marks event end (egress). Works without threshold tuning.

## Quick Start

```python
import numpy as np

def detect_event_boundaries(signal, search_start=None, search_end=None):
    """Find event ingress/egress via gradient extrema.
    
    Args:
        signal: 1D array of the time series
        search_start/end: optional tuple (lo, hi) to constrain search region
    Returns:
        (ingress_idx, egress_idx)
    """
    event_min = np.argmin(signal)
    # Search for steepest descent before minimum
    pre = signal[:event_min]
    grad_pre = np.gradient(pre)
    ingress = np.argmin(grad_pre)  # most negative gradient
    # Search for steepest ascent after minimum
    post = signal[event_min:]
    grad_post = np.gradient(post)
    egress = np.argmax(grad_post) + event_min
    return ingress, egress
```

## Key Decisions

- **Split at minimum**: separates ingress search (before) from egress search (after)
- **No threshold needed**: uses argmin/argmax of gradient — self-calibrating
- **Smooth first**: apply Savitzky-Golay or rolling mean before gradient if signal is noisy
- **Generalizable**: works for any dip/peak event — not just astronomical transits

## References

- Source: [ariel-only-correlation](https://www.kaggle.com/code/sergeifironov/ariel-only-correlation)
- Competition: NeurIPS - Ariel Data Challenge 2024

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…