# Installation

Use the npm command in order to install the bh-noise module:

```bash
npm install [--save] bh-noise
```

# bh-noise

The bh-noise module allows to easily find noise area in a signal. It uses linear regression.

## Usage

getNoise parameters:
  - levels: array of levels (no format specified for one level)
  - yKey: key in level to access to coordinate value
  - sampleSize: size of a sample (used for regression and recovery)
  - threshold: threshold for regression acceptation

```js
const BHNoise = require('bh-noise');

var result = BHNoise.getNoises([
  {y: 0},
  {y: 200},
  {y: 0},
  {y: 200},
  {y: 0},
  {y: 10},
  {y: 20},
  {y: 30},
  {y: 40},
  {y: 50},
  {y: 60}
], 'y', 4, 75);

Assert.deepEqual([
  {
    edges: {
      outside: {
        start: null,
        end: {
          ok: true,
          edges: {
            start: {y: 0},
            end: {y: 30}
          }
        }
      },
      inside: {
        start: {
          ok: false,
          edges: {
            start: {y: 0},
            end: {y: 200}
          }
        },
        end: {
          ok: false,
          edges: {
            start: {y: 200},
            end: {y: 20}
          }
        }
      }
    }
  }
], result);
```
