# ml-rolling-ball-baseline

> Rolling ball baseline correction

Latest version **3.0.0** (published 2026-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install ml-rolling-ball-baseline
pnpm add ml-rolling-ball-baseline
yarn add ml-rolling-ball-baseline
bun add ml-rolling-ball-baseline
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2026-04-18 |
| First published | 2020-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kevin M. Jablonka |
| Maintainers | mljs-bot |

## Links

- npm: https://www.npmjs.com/package/ml-rolling-ball-baseline
- Repository: https://github.com/mljs/rolling-ball-baseline
- Homepage: https://github.com/mljs/rolling-ball-baseline#readme
- Issues: https://github.com/mljs/rolling-ball-baseline/issues
- npm.io page: https://npm.io/package/ml-rolling-ball-baseline

## Dependencies (2)

- [is-any-array](https://npm.io/package/is-any-array.md) ^3.0.0
- [ml-spectra-processing](https://npm.io/package/ml-spectra-processing.md) ^14.28.1

## Recent versions

- 3.0.0 (latest) — 2026-04-18
- 2.0.4 — 2026-04-16
- 2.0.3 — 2024-03-07
- 2.0.2 — 2023-08-22
- 2.0.1 — 2023-03-24
- 2.0.0 — 2022-12-23
- 1.1.0 — 2022-04-01
- 1.0.0 — 2021-03-24
- 0.1.0 — 2020-11-17

## README

# ml-rolling-ball-baseline

[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![npm download][download-image]][download-url]

Rolling ball baseline correction. The algorithm was initially described in [[1]](#ref1).

<a name="ref1"></a> 1. [Kneen, M. A.; Annegarn, H. J. Algorithm for Fitting XRF, SEM and PIXE X-Ray Spectra Backgrounds. Nuclear Instruments and Methods in Physics Research Section B: Beam Interactions with Materials and Atoms 1996, 109–110, 209–213.](<https://doi.org/10.1016/0168-583X(95)00908-6>)

<a name="ref3"></a> 2. [Liland KH, Almøy T, Mevik B (2010).
“Optimal Choice of Baseline Correction for Multivariate Calibration of Spectra.”
Applied Spectroscopy, 64, 1007-1016.](https://cran.r-project.org/web/packages/baseline/baseline.pdf)

## Installation

`$ npm i ml-rolling-ball-baseline`

## Usage

```js
import { rollingBall } from 'ml-rolling-ball-baseline';

// spectrum is an array
const spectrum=[1, 2, 1, ...];

// you need to provide and array with the data and
// two numbers indicating the "size" of the balls,
// i.e., the maximization/minimization and the smoothing window.
const baseline = rollingBall(spectrum, 200, 400);
```

## [API Documentation](https://mljs.github.io/rolling-ball-baseline/)

## License

[MIT](./LICENSE)

[npm-image]: https://img.shields.io/npm/v/ml-rolling-ball-baseline.svg
[npm-url]: https://www.npmjs.com/package/ml-rolling-ball-baseline
[ci-image]: https://github.com/mljs/rolling-ball-baseline/workflows/Node.js%20CI/badge.svg?branch=main
[ci-url]: https://github.com/mljs/rolling-ball-baseline/actions?query=workflow%3A%22Node.js+CI%22
[download-image]: https://img.shields.io/npm/dm/ml-rolling-ball-baseline.svg
[download-url]: https://www.npmjs.com/package/ml-rolling-ball-baseline

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