0.0.15 • Published 6 years ago

ripser v0.0.15

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

JavaScript Library for Ripser

Ripserjs offers an easy to use API for computing and visualizing Vietoris-Rips persistence barcodes.

Compatibility

Ripserjs uses WebAssembly and only works on browsers that support WebAssembly.

Tested and working browser are: Chrome, Firefox and Edge 41

Not working browser(s): IE

Usage

Install using NPM:

npm install --save d3 ripser

Import using script tags (import d3 first):

<script src="/node_modules/d3/build/d3.min.js"></script>
<script src="/node_modules/ripser/dist/ripser.js"></script>

Or Import using ES6 Syntax:

import * as d3 from "d3";
import * as Ripser from "ripser";

Examples

http://leanderg.gitlab.io/ripserjs_examples/

API

TODO

Ripser.run(data, selector[, options]);

data

The data argument can be either a string or a 2D-Array. Supported formats are lower-distance matrix, upper-distance matrix, distance matrix and point-cloud. The string will be passed to Ripser as is.

selector

The selector in which the diagram(s) will be put. Most of the time you want to use an id that references a div. Example: "#div1"

It can also be an array of selectors like ["#header","#dim0","#dim1","#dim2"]. Each Diagram will be put in a different div. Length of the array needs to be maxDim - minDim + 1

Example:

HTML:

<div id="diagram"></div>

JS:

Ripser.run(data,"#diagram");

options

Optional.

NameTypeValue(s)Description
outputTypeString"PersistenceBarCodes" Default, "PersistenceDiagram", "CSVExporter"Type of the output.
formatString"lower-distance" Default, "upper-distance", "distance", "point-cloud"Format of the data argument
minDimIntegergreater or equal to 0 DefaultMinimum dimension to be displayed
maxDimIntegergreater or equal to minDim, 2 DefaultMaximum dimension to be displayed
thresholdFloatInfinity Default or greater than 0Compute Rips complexes up to diameter t
callbackFunctionGets called after computation is done

How to compile

  1. (Optional) Compile Ripser from https://github.com/Ripser/ripser/tree/live-webassembly using Emscripten and the following command:
Emscripten with emcc -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -Wall --bind --memory-init-file 0 -std=c++11 -o emscripten/ripser.js -O3 -D NDEBUG ripser.cpp

Replace src/emscripten/ripser.wasm with the newly compiled file.

In the file ripser.js remove var Module; from the beginning and copy the content into the loadWASM function in src/ripser.worker.js. TODO: Find a solution that doesn't require modifying ripser.js

  1. Run npm install (requires the Node Package Manager)
  2. Run webpack to compile

Known Issues

  • If Ripser runs out of memory it crashes with nothing but a console error.
  • File size is a bit large with 736 KB (not gzipped) and 230 KB (gzipped).
0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago