Skip to content

Commit

Permalink
Migrate pcp.js
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Dec 30, 2020
1 parent 23fe478 commit a1fafcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export { meantranspose, meancolumns } from './mean';
export { optimal_leaf_order } from './optimal_leaf_order';
export { order } from './order';
export { pca1d, pca_order } from './pca_order';
//export {
//} from '';
export {
array_to_dicts,
dicts_to_array,
pcp,
parcoords
} from './pcp';
//export {
//} from '';
16 changes: 4 additions & 12 deletions src/pcp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function array_to_dicts(data, axes) {
export function array_to_dicts(data, axes) {
if (arguments.length < 2)
axes = reorder.range(data[0].length);
var ret = [], row, dict, i, j;
Expand All @@ -13,9 +13,7 @@ function array_to_dicts(data, axes) {
return ret;
}

reorder.array_to_dicts = array_to_dicts;

function dicts_to_array(dicts, keys) {
export function dicts_to_array(dicts, keys) {
if (arguments.length < 2)
keys = Object.keys(dicts[0]);
var n = keys.length,
Expand All @@ -31,8 +29,6 @@ function dicts_to_array(dicts, keys) {
return array;
}

reorder.dicts_to_array = dicts_to_array;

function abs_matrix(x) {
return x.map(function(y) { return y.map(Math.abs); });
}
Expand Down Expand Up @@ -60,7 +56,7 @@ function pcp_flip_axes(perm, naxes, pcor) {
return signs;
}

function pcp(data, axes) {
export function pcp(data, axes) {
if (! axes)
axes = reorder.range(data[0].length);

Expand All @@ -81,9 +77,7 @@ function pcp(data, axes) {
return [ndata, perm, naxes, signs, pcor];
}

reorder.pcp = pcp;

function parcoords(p) {
export function parcoords(p) {
p.detectDimensions()
.autoscale();

Expand Down Expand Up @@ -132,5 +126,3 @@ function parcoords(p) {
dimensions = discarded.reverse().concat(dimensions); // put back string columns
return p.dimensions(dimensions);
}

reorder.parcoords = parcoords;

0 comments on commit a1fafcd

Please sign in to comment.