# fftshift

> Cyclic rotation for phase-zero windowing

Latest version **1.0.1** (published 2017-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install fftshift
pnpm add fftshift
yarn add fftshift
bun add fftshift
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-03-17 |
| First published | 2017-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | danigb |
| Maintainers | danigb |
| Keywords | fftshift, dsp, window, windowing, fourier, fft, phase-zero, dsp-kit |

## Links

- npm: https://www.npmjs.com/package/fftshift
- Repository: https://github.com/oramics/fftshift/fftshift
- Homepage: https://github.com/oramics/fftshift/fftshift/#readme
- Issues: https://github.com/oramics/fftshift/issues
- npm.io page: https://npm.io/package/fftshift

## Recent versions

- 1.0.1 (latest) — 2017-03-17
- 1.0.0 — 2017-03-17

## README

## fftshift

> Cyclic rotation for phase-zero windowing

[![npm install fftshift](https://nodei.co/npm/fftshift.png?mini=true)](https://npmjs.org/package/fftshift/)

```js
import { fftshift, ifftshift } from 'fftshift'

// given a signal (an array)
fftshift(signal) // => in-place rotation. 0 is now at the center of the array
ifftshift(signal) // => in-place rotation. Signal is now as before fftshift
```


## Usage

Install via `npm`:

```bash
npm install fftshift
```

Require in your code:

**Example**  
```js
// ES6 syntax
import { fftshift, ifftshift } from 'fftshift'

// ES5 syntax
var shift = require('fftshift')
shift.fftshift(signal)
shift.ifftshift(signal)
```

## API

### fftshift(buffer) ⇒ <code>Array</code>
Zero-phase windowing alignment

__CAUTION__: this function mutates the array

Perform a cyclic shifting (rotation) to set the first sample at the middle
of the buffer (it reorder buffer samples from (0:N-1) to [(N/2:N-1) (0:(N/2-1))])

Named by the same function in mathlab: `fftshift`

**Returns**: <code>Array</code> - the same buffer (with the data rotated)  

| Param | Type |
| --- | --- |
| buffer | <code>Array</code> |


### ifftshift(buffer) ⇒ <code>Array</code>
Inverse of zero-phase windowing alignment

__CAUTION__: this function mutates the array

**Kind**: static method of <code>[fftshift](#module_fftshift)</code>  
**Returns**: <code>Array</code> - the same buffer (with the data rotated)  
**See**: fftshift  

| Param | Type |
| --- | --- |
| buffer | <code>Array</code> |

## License

MIT License

---
_Source: https://npm.io/package/fftshift · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
