# SGN-TS

SGN-TS extends the [SGN](https://docs.ligo.org/greg/sgn/) streaming pipeline
framework with time-series data types: precise offset-based timing, uniformly
sampled buffers, frame alignment across multiple channels, and a library of
signal processing elements.

## Installation

```bash
pip install sgn-ts
```

For PyTorch-accelerated operations (resampling, array backends):

```bash
pip install sgn-ts[torch]
```

## Quick Example

Generate a sine wave, amplify it, and collect the output:

```python notest
from sgn import Pipeline
from sgnts.sources import FakeSeriesSource
from sgnts.transforms import Amplify
from sgnts.sinks import TSFrameCollectSink

src = FakeSeriesSource(
    name="src",
    source_pad_names=["out"],
    signal_type="sin",
    rate=2048,
    duration=2,
)
amp = Amplify(name="amp", factor=3.0)
snk = TSFrameCollectSink(name="snk")

Pipeline().connect(src, amp).connect(amp, snk).run()

for frame in snk.data["out"]:
    print(frame.offset, len(frame.buffers))
```

## Documentation

Full documentation is available at
[docs.ligo.org/greg/sgn-ts](https://docs.ligo.org/greg/sgn-ts/).

## Related Libraries

- [`sgn`](https://docs.ligo.org/greg/sgn/): Base streaming pipeline framework
- [`sgn-ligo`](https://git.ligo.org/greg/sgn-ligo): LIGO-specific utilities for SGN
