0.0.0 • Published 10 years ago

histc v0.0.0

Weekly downloads
1
License
-
Repository
github
Last release
10 years ago

HISTC

One-dimensional histogram calculation.

Examples

var histc = require( 'histc' ),
	edges, minEdge, maxEdge, binWidth, numEdges,
	data = new Array( 1000 ),
	counts;

// Parameters:
minEdge = -0.025;
maxEdge = -1.025;
binWidth = 0.05;

numEdges = Math.floor( ( maxEdge-minEdge ) / binWidth ) + 1;

// Create a 1d edge array...
edges = new Array( numEdges );
for ( var i = 0; i < numEdges; i++ ) {
	edges[ i ] = minEdge + i*binWidth;
}

// Simulate some data:
for ( var j = 0; j < 1000; j++ ) {
	data[ j ] = Math.random();
}

// Compute the histogram:
counts = histc( data, edges );

Tests

Unit tests use the Mocha test framework with Chai assertions.

Assuming you have installed Mocha, execute the following command in the top-level application directory to run the tests:

$ mocha

All new feature development should have corresponding unit tests to validate correct functionality.

License

MIT license.


Copyright

Copyright © 2014. Athan Reines.