Skip to content
Back to skills

Flux Snr Weighted Features

ASecurity

Engineer SNR-derived features from irregular time series — flux ratio squared, error-weighted mean flux, and normalized amplitude/range features

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
datapython

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill flux-snr-weighted-features --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flux Snr Weighted Features?

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

Security grade badge for Flux Snr Weighted Features
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-flux-snr-weighted-features/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-flux-snr-weighted-features)

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-flux-snr-weighted-features
description: Engineer SNR-derived features from irregular time series — flux ratio squared, error-weighted mean flux, and normalized amplitude/range features
domain: timeseries
---

# Flux SNR-Weighted Features

## Overview

For irregular time series with measurement errors (e.g. astronomical light curves, sensor data with noise estimates), engineer signal-to-noise features that weight observations by their reliability. Compute (flux/flux_err)^2 as SNR weight, then derive error-weighted mean flux, normalized amplitude, and range-over-mean ratios. These features are far more predictive than raw flux statistics for noisy data.

## Quick Start

```python
import numpy as np

def flux_snr_features(df, id_col='object_id'):
    """Engineer SNR-weighted features from flux + flux_err columns."""
    df['flux_ratio_sq'] = np.power(df['flux'] / df['flux_err'], 2.0)
    df['flux_by_flux_ratio_sq'] = df['flux'] * df['flux_ratio_sq']
    
    aggs = {
        'flux': ['min', 'max', 'mean', 'median', 'std', 'skew'],
        'flux_err': ['min', 'max', 'mean', 'std'],
        'flux_ratio_sq': ['sum', 'skew'],
        'flux_by_flux_ratio_sq': ['sum', 'skew'],
    }
    result = df.groupby(id_col).agg(aggs)
    result.columns = ['_'.join(x) for x in result.columns]
    
    # Error-weighted mean flux
    result['flux_w_mean'] = (
        result['flux_by_flux_ratio_sq_sum'] / result['flux_ratio_sq_sum'])
    # Normalized dynamic range
    result['flux_dif2'] = (
        (result['flux_max'] - result['flux_min']) / result['flux_mean'])
    result['flux_dif3'] = (
        (result['flux_max'] - result['flux_min']) / result['flux_w_mean'])
    return result
```

## Key Decisions

- **SNR weighting**: (flux/flux_err)^2 gives inverse-variance weight — standard in astronomy
- **Per-passband**: apply separately per frequency band for multi-band data
- **Skewness of SNR**: captures asymmetry in observation quality distribution
- **Normalized amplitude**: range/mean is scale-invariant across objects

## References

- Source: [simple-neural-net-for-time-series-classification](https://www.kaggle.com/code/meaninglesslives/simple-neural-net-for-time-series-classification)
- Competition: PLAsTiCC Astronomical Classification

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.