npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ripser

v0.0.15

Published

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

Downloads

20

Readme

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.

| Name | Type | Value(s) | Description | |-------------|----------|------------------------------------------------------------------------|-----------------------------------------| | outputType | String | "PersistenceBarCodes" [Default], "PersistenceDiagram", "CSVExporter" | Type of the output. | | format | String | "lower-distance" [Default], "upper-distance", "distance", "point-cloud"| Format of the data argument | | minDim | Integer | greater or equal to 0 [Default] | Minimum dimension to be displayed | | maxDim | Integer | greater or equal to minDim, 2 [Default] | Maximum dimension to be displayed | | threshold | Float | Infinity [Default] or greater than 0 | Compute Rips complexes up to diameter t | | callback | Function | | Gets 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).