> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elata.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Analysis Models

> Alpha bump detection, alpha peak tracking, and calmness scoring

## WasmAlphaBumpDetector

Detects alpha bumps, which are transient increases in alpha band power that indicate state transitions.

```typescript theme={null}
import { initEegWasm, WasmAlphaBumpDetector } from "@elata-biosciences/eeg-web";

await initEegWasm();

const detector = new WasmAlphaBumpDetector();

// Feed samples and check for bumps
const bumpDetected = detector.process(samples, sampleRateHz);
```

***

## WasmAlphaPeakModel

Tracks the individual alpha peak frequency (typically 8-13 Hz) which varies per person.

```typescript theme={null}
import { WasmAlphaPeakModel } from "@elata-biosciences/eeg-web";

const model = new WasmAlphaPeakModel();

// Feed EEG data to refine peak estimate
model.process(samples, sampleRateHz);
const peakHz = model.peak_frequency();
```

***

## WasmCalmnessModel

Computes a calmness score based on the ratio of alpha to beta power. Higher alpha relative to beta generally indicates a more relaxed state.

```typescript theme={null}
import { WasmCalmnessModel } from "@elata-biosciences/eeg-web";

const model = new WasmCalmnessModel();

model.process(samples, sampleRateHz);
const score = model.score(); // 0.0 to 1.0
```

***

## AthenaWasmDecoder

Decodes raw Athena protocol packets from Muse S (Athena firmware) headbands. Used as a factory parameter for `BleTransport`:

```typescript theme={null}
import { AthenaWasmDecoder } from "@elata-biosciences/eeg-web";

const decoder = new AthenaWasmDecoder();

decoder.reset();
decoder.set_use_device_timestamps(true);
decoder.set_clock_kind("monotonic");
decoder.set_reorder_window_ms(50);

const output = decoder.decode(rawBytes);
```

The Athena decoder is typically not used directly. It is passed as a factory to [`BleTransport`](/sdk/eeg-web-ble/getting-started):

```typescript theme={null}
import { BleTransport } from "@elata-biosciences/eeg-web-ble";
import { AthenaWasmDecoder } from "@elata-biosciences/eeg-web";

const transport = new BleTransport({
  deviceOptions: {
    athenaDecoderFactory: () => new AthenaWasmDecoder(),
  },
});
```

***

## Next

<CardGroup cols={2}>
  <Card title="Signal Processing" icon="wave-square" iconType="light" href="/sdk/eeg-web/signal-processing">
    Band powers, FFT, spectrum analysis
  </Card>

  <Card title="Headband Transport" icon="signal-stream" iconType="light" href="/sdk/eeg-web/headband-transport">
    Frame schema and transport interface
  </Card>
</CardGroup>
