# Time-Series Detrender AI Agent Connect

> Time-Series Detrender MCP handles the heavy lifting of cleaning astronomical time-series data. It lets your AI agent strip away instrumental drift or stellar activity from flux and magnitude measurements. You can model complex trends using polynomials or running medians, ensuring that the astrophysical events you actually care about stay intact and uncorrupted.

## Overview
- **Category:** data-science
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_KbIc7KRIU3Lf2KXElbWRtDxcvnRjnsCQg5Xco0eP/ai-agent-connect
- **Tags:** astronomy, time-series, detrending, signal-processing, astrophysics

## Description

You can use this MCP to clean up noisy astronomical datasets without manually coding each filter. When you're dealing with flux or magnitude time series, systematic trends like instrumental drift or stellar activity often hide the real signal. This MCP gives your AI agent the math needed to model those baselines and subtract them. You can choose from several methods like polynomial fits, splines, or running medians to match the specific nature of your data. If you have specific events you want to protect from being smoothed out, you can provide masking intervals to keep the fit focused on the background. Once the baseline is removed, you'll have a clean signal ready for light curve analysis or transit detection. It also handles the validation side, letting your agent check the statistical quality of the results to make sure the detrending didn't eat the signal you're looking for.

## Tools

### analyze_residuals
This tool evaluates the statistical quality of your detrending results. It checks if the process preserved the signal correctly.

### detrend_series
This tool subtracts the fitted baseline from your original data. It produces the clean astrophysical signal you need for analysis.

### fit_baseline
This tool determines the mathematical shape of the underlying trend. You can use polynomial, spline, or running median methods, and you should provide masking intervals to ignore specific events.

### get_audit_report
This tool generates a summary of your normalization and parameter settings. It provides a clear record of how the data was processed.

## Prompt Examples

**Prompt:** 
```
Can you detrend this flux data using a polynomial fit of degree 3, ignoring the interval between 150 and 200?
```

**Response:** 
```
The baseline has been calculated using a 3rd-degree polynomial, excluding the specified interval. The detrended flux values are now available for analysis.
```

**Prompt:** 
```
Use a running median with a window size of 50 to remove the trend from my time series.
```

**Response:** 
```
The running median baseline has been applied. The resulting residuals show the stochastic noise and potential astrophysical signals.
```

**Prompt:** 
```
Check the statistical quality of the residuals from my last detrending operation.
```

**Response:** 
```
The residual analysis shows a signal-to-noise ratio of 15.2 and an event preservation score of 0.98, indicating high-quality detrending.
```

## Capabilities

### Trend Modeling
Your agent uses polynomial, spline, or running median methods to define the baseline.

### Signal Isolation
The MCP subtracts the modeled trend to reveal the underlying astrophysical signal.

### Event Masking
You can define specific intervals to prevent the baseline fit from being biased by the events you want to study.

### Statistical Validation
Your agent checks the quality of the detrending through residual analysis.

### Process Auditing
The MCP provides reports on normalization and parameter settings used during processing.

## Use Cases

### Exoplanet Transit Detection
Clean stellar variability to make planetary transit signals more visible.

### Instrumental Drift Correction
Remove long-term trends caused by telescope or detector changes over time.

### Stellar Activity Mitigation
Subtract periodic stellar signals to focus on specific astrophysical events.

### Signal Integrity Auditing
Verify that the detrending process didn't distort the data using residual analysis.

## Benefits

- Removes systematic noise like instrumental drift without manual coding.
- Protects astrophysical signals using custom masking intervals.
- Provides statistical verification of the detrending quality.
- Offers multiple mathematical modeling methods for different data types.

## How It Works

The process moves from trend modeling to signal extraction and finally to validation.

1. Connect your AI client to the Vinkius-hosted MCP.
2. Define the baseline shape using a chosen mathematical method.
3. Apply masking intervals to protect specific data segments.
4. Subtract the baseline to isolate the clean signal.
5. Run statistical checks to confirm the quality of the results.

## Frequently Asked Questions

**How does this MCP handle instrumental drift?**
It uses tools like fit_baseline to model the drift as a mathematical trend, which is then subtracted from the original signal.

**Can I prevent the detrending from smoothing out my target signal?**
Yes, you can provide masking intervals to ensure the baseline fit ignores the specific time segments where your signal of interest is located.

**What mathematical methods are supported for fitting the baseline?**
The MCP supports polynomial fits, splines, running medians, and comparison-star methods.

**How do I know if the detrending was successful?**
You can use the analyze_residuals tool to evaluate the statistical quality of the process and ensure signal integrity.

**Which AI clients can use this MCP?**
Any MCP-compatible client like Claude, Cursor, Windsurf, or VS Code can use this MCP once connected via Vinkius.

**How do I prevent a planetary transit from being removed during detrending?**
You should use the `maskingIntervals` parameter in the `fit_baseline` tool. By defining the start and end timestamps of the transit, the algorithm will ignore those data points when calculating the baseline trend.

**What is the difference between polynomial and spline fitting?**
Polynomial fitting uses a single mathematical curve of a specific degree, while spline fitting uses piecewise polynomials to create a smoother, more flexible fit across different segments of the data.

**How can I verify the quality of my detrended signal?**
Use the `analyze_residuals` tool to evaluate the signal-to-noise ratio and the event preservation score, ensuring the astrophysical signal remains intact.
