Skip to content

Commit

Permalink
Updated docs generation to support new es6 module syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
pwstegman committed May 15, 2020
1 parent 577e852 commit c7e356e
Show file tree
Hide file tree
Showing 84 changed files with 10,293 additions and 4,007 deletions.
627 changes: 550 additions & 77 deletions docs/docs/api.md

Large diffs are not rendered by default.

43 changes: 20 additions & 23 deletions docs/docs/data_loadCSV.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3 class="reference-title">



<h3 id="global-nav">Global</h3><ul><li><a href="global.html#calculateAdaptiveWeights">calculateAdaptiveWeights</a></li><li><a href="global.html#computeQ">computeQ</a></li><li><a href="global.html#dpss">dpss</a></li><li><a href="global.html#multitaper">multitaper</a></li><li><a href="global.html#taper">taper</a></li><li><a href="global.html#welch">welch</a></li></ul>
<h3>Classes</h3><ul><li id="oscStream-nav"><a href="oscStream_oscStream.html">oscStream</a></li></ul><h3>Modules</h3><ul><li id="bcijs-nav"><a href="module-bcijs.html">bcijs</a><ul class='methods'><li data-type="method" id="bcijs-accuracy-nav"><a href="module-bcijs.html#.accuracy">accuracy</a></li><li data-type="method" id="bcijs-balancedAccuracy-nav"><a href="module-bcijs.html#.balancedAccuracy">balancedAccuracy</a></li><li data-type="method" id="bcijs-bandpower-nav"><a href="module-bcijs.html#.bandpower">bandpower</a></li><li data-type="method" id="bcijs-confusionMatrix-nav"><a href="module-bcijs.html#.confusionMatrix">confusionMatrix</a></li><li data-type="method" id="bcijs-cspLearn-nav"><a href="module-bcijs.html#.cspLearn">cspLearn</a></li><li data-type="method" id="bcijs-cspProject-nav"><a href="module-bcijs.html#.cspProject">cspProject</a></li><li data-type="method" id="bcijs-f1-nav"><a href="module-bcijs.html#.f1">f1</a></li><li data-type="method" id="bcijs-fastICA-nav"><a href="module-bcijs.html#.fastICA">fastICA</a></li><li data-type="method" id="bcijs-generateSignal-nav"><a href="module-bcijs.html#.generateSignal">generateSignal</a></li><li data-type="method" id="bcijs-ldaClassify-nav"><a href="module-bcijs.html#.ldaClassify">ldaClassify</a></li><li data-type="method" id="bcijs-ldaLearn-nav"><a href="module-bcijs.html#.ldaLearn">ldaLearn</a></li><li data-type="method" id="bcijs-ldaProject-nav"><a href="module-bcijs.html#.ldaProject">ldaProject</a></li><li data-type="method" id="bcijs-loadCSV-nav"><a href="module-bcijs.html#.loadCSV">loadCSV</a></li><li data-type="method" id="bcijs-loadEDF-nav"><a href="module-bcijs.html#.loadEDF">loadEDF</a></li><li data-type="method" id="bcijs-mcc-nav"><a href="module-bcijs.html#.mcc">mcc</a></li><li data-type="method" id="bcijs-nextpow2-nav"><a href="module-bcijs.html#.nextpow2">nextpow2</a></li><li data-type="method" id="bcijs-oscCollect-nav"><a href="module-bcijs.html#.oscCollect">oscCollect</a></li><li data-type="method" id="bcijs-oscHeaderScan-nav"><a href="module-bcijs.html#.oscHeaderScan">oscHeaderScan</a></li><li data-type="method" id="bcijs-partition-nav"><a href="module-bcijs.html#.partition">partition</a></li><li data-type="method" id="bcijs-periodogram-nav"><a href="module-bcijs.html#.periodogram">periodogram</a></li><li data-type="method" id="bcijs-precision-nav"><a href="module-bcijs.html#.precision">precision</a></li><li data-type="method" id="bcijs-prompt-nav"><a href="module-bcijs.html#.prompt">prompt</a></li><li data-type="method" id="bcijs-recall-nav"><a href="module-bcijs.html#.recall">recall</a></li><li data-type="method" id="bcijs-round-nav"><a href="module-bcijs.html#.round">round</a></li><li data-type="method" id="bcijs-saveCSV-nav"><a href="module-bcijs.html#.saveCSV">saveCSV</a></li><li data-type="method" id="bcijs-specificity-nav"><a href="module-bcijs.html#.specificity">specificity</a></li><li data-type="method" id="bcijs-subscript-nav"><a href="module-bcijs.html#.subscript">subscript</a></li><li data-type="method" id="bcijs-toFixed-nav"><a href="module-bcijs.html#.toFixed">toFixed</a></li><li data-type="method" id="bcijs-toTable-nav"><a href="module-bcijs.html#.toTable">toTable</a></li><li data-type="method" id="bcijs-transpose-nav"><a href="module-bcijs.html#.transpose">transpose</a></li><li data-type="method" id="bcijs-wait-nav"><a href="module-bcijs.html#.wait">wait</a></li><li data-type="method" id="bcijs-welch-nav"><a href="module-bcijs.html#.welch">welch</a></li><li data-type="method" id="bcijs-windowApply-nav"><a href="module-bcijs.html#.windowApply">windowApply</a></li></ul></li></ul>
</nav>

<div id="main">
Expand All @@ -97,36 +97,33 @@ <h1 class="page-title">

<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.loadCSV = loadCSV;

var _csvtojson = _interopRequireDefault(require("csvtojson"));

function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
<pre class="prettyprint source linenums"><code>import csv from 'csvtojson';

/**
* Loads a CSV file into an array
* &lt;p>This method is exclusive to Node.js&lt;/p>
* @memberof module:bcijs
* @function
* @name loadCSV
* @param {string} filePath - The path to the CSV file
* @returns {Promise} A promise object which resolves to the CSV data array
*/
function loadCSV(filePath) {
return new Promise(function (resolve, reject) {
var data = [];
(0, _csvtojson.default)({
noheader: true
}).fromFile(filePath).on('csv', function (row) {
data.push(row.map(Number));
}).on('done', function (error) {
if (error) reject(error);else resolve(data);
});
});
}</code></pre>
export function loadCSV(filePath) {
return new Promise(function (resolve, reject) {
var data = [];

csv({ noheader: true })
.fromFile(filePath)
.on('csv', (row) => {
data.push(row.map(Number));
})
.on('done', (error) => {
if (error) reject(error);
else resolve(data);
});
});
}
</code></pre>
</article>
</section>

Expand Down
74 changes: 34 additions & 40 deletions docs/docs/data_loadEDF.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3 class="reference-title">



<h3 id="global-nav">Global</h3><ul><li><a href="global.html#calculateAdaptiveWeights">calculateAdaptiveWeights</a></li><li><a href="global.html#computeQ">computeQ</a></li><li><a href="global.html#dpss">dpss</a></li><li><a href="global.html#multitaper">multitaper</a></li><li><a href="global.html#taper">taper</a></li><li><a href="global.html#welch">welch</a></li></ul>
<h3>Classes</h3><ul><li id="oscStream-nav"><a href="oscStream_oscStream.html">oscStream</a></li></ul><h3>Modules</h3><ul><li id="bcijs-nav"><a href="module-bcijs.html">bcijs</a><ul class='methods'><li data-type="method" id="bcijs-accuracy-nav"><a href="module-bcijs.html#.accuracy">accuracy</a></li><li data-type="method" id="bcijs-balancedAccuracy-nav"><a href="module-bcijs.html#.balancedAccuracy">balancedAccuracy</a></li><li data-type="method" id="bcijs-bandpower-nav"><a href="module-bcijs.html#.bandpower">bandpower</a></li><li data-type="method" id="bcijs-confusionMatrix-nav"><a href="module-bcijs.html#.confusionMatrix">confusionMatrix</a></li><li data-type="method" id="bcijs-cspLearn-nav"><a href="module-bcijs.html#.cspLearn">cspLearn</a></li><li data-type="method" id="bcijs-cspProject-nav"><a href="module-bcijs.html#.cspProject">cspProject</a></li><li data-type="method" id="bcijs-f1-nav"><a href="module-bcijs.html#.f1">f1</a></li><li data-type="method" id="bcijs-fastICA-nav"><a href="module-bcijs.html#.fastICA">fastICA</a></li><li data-type="method" id="bcijs-generateSignal-nav"><a href="module-bcijs.html#.generateSignal">generateSignal</a></li><li data-type="method" id="bcijs-ldaClassify-nav"><a href="module-bcijs.html#.ldaClassify">ldaClassify</a></li><li data-type="method" id="bcijs-ldaLearn-nav"><a href="module-bcijs.html#.ldaLearn">ldaLearn</a></li><li data-type="method" id="bcijs-ldaProject-nav"><a href="module-bcijs.html#.ldaProject">ldaProject</a></li><li data-type="method" id="bcijs-loadCSV-nav"><a href="module-bcijs.html#.loadCSV">loadCSV</a></li><li data-type="method" id="bcijs-loadEDF-nav"><a href="module-bcijs.html#.loadEDF">loadEDF</a></li><li data-type="method" id="bcijs-mcc-nav"><a href="module-bcijs.html#.mcc">mcc</a></li><li data-type="method" id="bcijs-nextpow2-nav"><a href="module-bcijs.html#.nextpow2">nextpow2</a></li><li data-type="method" id="bcijs-oscCollect-nav"><a href="module-bcijs.html#.oscCollect">oscCollect</a></li><li data-type="method" id="bcijs-oscHeaderScan-nav"><a href="module-bcijs.html#.oscHeaderScan">oscHeaderScan</a></li><li data-type="method" id="bcijs-partition-nav"><a href="module-bcijs.html#.partition">partition</a></li><li data-type="method" id="bcijs-periodogram-nav"><a href="module-bcijs.html#.periodogram">periodogram</a></li><li data-type="method" id="bcijs-precision-nav"><a href="module-bcijs.html#.precision">precision</a></li><li data-type="method" id="bcijs-prompt-nav"><a href="module-bcijs.html#.prompt">prompt</a></li><li data-type="method" id="bcijs-recall-nav"><a href="module-bcijs.html#.recall">recall</a></li><li data-type="method" id="bcijs-round-nav"><a href="module-bcijs.html#.round">round</a></li><li data-type="method" id="bcijs-saveCSV-nav"><a href="module-bcijs.html#.saveCSV">saveCSV</a></li><li data-type="method" id="bcijs-specificity-nav"><a href="module-bcijs.html#.specificity">specificity</a></li><li data-type="method" id="bcijs-subscript-nav"><a href="module-bcijs.html#.subscript">subscript</a></li><li data-type="method" id="bcijs-toFixed-nav"><a href="module-bcijs.html#.toFixed">toFixed</a></li><li data-type="method" id="bcijs-toTable-nav"><a href="module-bcijs.html#.toTable">toTable</a></li><li data-type="method" id="bcijs-transpose-nav"><a href="module-bcijs.html#.transpose">transpose</a></li><li data-type="method" id="bcijs-wait-nav"><a href="module-bcijs.html#.wait">wait</a></li><li data-type="method" id="bcijs-welch-nav"><a href="module-bcijs.html#.welch">welch</a></li><li data-type="method" id="bcijs-windowApply-nav"><a href="module-bcijs.html#.windowApply">windowApply</a></li></ul></li></ul>
</nav>

<div id="main">
Expand All @@ -97,23 +97,15 @@ <h1 class="page-title">

<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.loadEDF = loadEDF;

var _fs = _interopRequireDefault(require("fs"));

var _edfjs = _interopRequireDefault(require("edfjs"));

function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
<pre class="prettyprint source linenums"><code>import fs from 'fs';
import edfjs from 'edfjs';

/**
* Load data from an EDF file
* &lt;p>This method is exclusive to Node.js&lt;/p>
* @memberof module:bcijs
* @function
* @name loadEDF
* @param {string} filename - Path to the EDF file
* @returns {Object} An object with the following parameters:
* &lt;br>
Expand All @@ -129,36 +121,38 @@ <h1 class="page-title">
* &lt;br> physical_dimension [string] - The units for each channel (ex: uV)
* &lt;br> samples [number[]] - An array of samples from the channel
*/
function loadEDF(filename) {
var file = _fs.default.readFileSync(filename);

var edf = _edfjs.default.EDF();

edf.read_buffer(file.buffer, false);
var subject = edf.pid;
var recording = edf.rid;
var starttime = edf.startdatetime;
var channels = edf.channels.map(function (channel) {
var samples = new Array(channel.blob.length);

for (var i = 0; i &lt; channel.blob.length; i++) {
samples[i] = channel.blob[i];
}
export function loadEDF(filename){
let file = fs.readFileSync(filename);
let edf = edfjs.EDF();
edf.read_buffer(file.buffer, false);

let subject = edf.pid;
let recording = edf.rid;
let starttime = edf.startdatetime;

let channels = edf.channels.map(channel => {

let samples = new Array(channel.blob.length);
for(let i = 0; i &lt; channel.blob.length; i++){
samples[i] = channel.blob[i];
}

return {
'label': channel.label,
'sample_rate': channel.sampling_rate,
'physical_dimension': channel.physical_dimension,
'samples': samples
}
});

return {
'label': channel.label,
'sample_rate': channel.sampling_rate,
'physical_dimension': channel.physical_dimension,
'samples': samples
subject: subject,
recording: recording,
start_time: starttime,
channels: channels,
};
});
return {
subject: subject,
recording: recording,
start_time: starttime,
channels: channels
};
}</code></pre>
}
</code></pre>
</article>
</section>

Expand Down
45 changes: 19 additions & 26 deletions docs/docs/data_partition.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h3 class="reference-title">



<h3 id="global-nav">Global</h3><ul><li><a href="global.html#calculateAdaptiveWeights">calculateAdaptiveWeights</a></li><li><a href="global.html#computeQ">computeQ</a></li><li><a href="global.html#dpss">dpss</a></li><li><a href="global.html#multitaper">multitaper</a></li><li><a href="global.html#taper">taper</a></li><li><a href="global.html#welch">welch</a></li></ul>
<h3>Classes</h3><ul><li id="oscStream-nav"><a href="oscStream_oscStream.html">oscStream</a></li></ul><h3>Modules</h3><ul><li id="bcijs-nav"><a href="module-bcijs.html">bcijs</a><ul class='methods'><li data-type="method" id="bcijs-accuracy-nav"><a href="module-bcijs.html#.accuracy">accuracy</a></li><li data-type="method" id="bcijs-balancedAccuracy-nav"><a href="module-bcijs.html#.balancedAccuracy">balancedAccuracy</a></li><li data-type="method" id="bcijs-bandpower-nav"><a href="module-bcijs.html#.bandpower">bandpower</a></li><li data-type="method" id="bcijs-confusionMatrix-nav"><a href="module-bcijs.html#.confusionMatrix">confusionMatrix</a></li><li data-type="method" id="bcijs-cspLearn-nav"><a href="module-bcijs.html#.cspLearn">cspLearn</a></li><li data-type="method" id="bcijs-cspProject-nav"><a href="module-bcijs.html#.cspProject">cspProject</a></li><li data-type="method" id="bcijs-f1-nav"><a href="module-bcijs.html#.f1">f1</a></li><li data-type="method" id="bcijs-fastICA-nav"><a href="module-bcijs.html#.fastICA">fastICA</a></li><li data-type="method" id="bcijs-generateSignal-nav"><a href="module-bcijs.html#.generateSignal">generateSignal</a></li><li data-type="method" id="bcijs-ldaClassify-nav"><a href="module-bcijs.html#.ldaClassify">ldaClassify</a></li><li data-type="method" id="bcijs-ldaLearn-nav"><a href="module-bcijs.html#.ldaLearn">ldaLearn</a></li><li data-type="method" id="bcijs-ldaProject-nav"><a href="module-bcijs.html#.ldaProject">ldaProject</a></li><li data-type="method" id="bcijs-loadCSV-nav"><a href="module-bcijs.html#.loadCSV">loadCSV</a></li><li data-type="method" id="bcijs-loadEDF-nav"><a href="module-bcijs.html#.loadEDF">loadEDF</a></li><li data-type="method" id="bcijs-mcc-nav"><a href="module-bcijs.html#.mcc">mcc</a></li><li data-type="method" id="bcijs-nextpow2-nav"><a href="module-bcijs.html#.nextpow2">nextpow2</a></li><li data-type="method" id="bcijs-oscCollect-nav"><a href="module-bcijs.html#.oscCollect">oscCollect</a></li><li data-type="method" id="bcijs-oscHeaderScan-nav"><a href="module-bcijs.html#.oscHeaderScan">oscHeaderScan</a></li><li data-type="method" id="bcijs-partition-nav"><a href="module-bcijs.html#.partition">partition</a></li><li data-type="method" id="bcijs-periodogram-nav"><a href="module-bcijs.html#.periodogram">periodogram</a></li><li data-type="method" id="bcijs-precision-nav"><a href="module-bcijs.html#.precision">precision</a></li><li data-type="method" id="bcijs-prompt-nav"><a href="module-bcijs.html#.prompt">prompt</a></li><li data-type="method" id="bcijs-recall-nav"><a href="module-bcijs.html#.recall">recall</a></li><li data-type="method" id="bcijs-round-nav"><a href="module-bcijs.html#.round">round</a></li><li data-type="method" id="bcijs-saveCSV-nav"><a href="module-bcijs.html#.saveCSV">saveCSV</a></li><li data-type="method" id="bcijs-specificity-nav"><a href="module-bcijs.html#.specificity">specificity</a></li><li data-type="method" id="bcijs-subscript-nav"><a href="module-bcijs.html#.subscript">subscript</a></li><li data-type="method" id="bcijs-toFixed-nav"><a href="module-bcijs.html#.toFixed">toFixed</a></li><li data-type="method" id="bcijs-toTable-nav"><a href="module-bcijs.html#.toTable">toTable</a></li><li data-type="method" id="bcijs-transpose-nav"><a href="module-bcijs.html#.transpose">transpose</a></li><li data-type="method" id="bcijs-wait-nav"><a href="module-bcijs.html#.wait">wait</a></li><li data-type="method" id="bcijs-welch-nav"><a href="module-bcijs.html#.welch">welch</a></li><li data-type="method" id="bcijs-windowApply-nav"><a href="module-bcijs.html#.windowApply">windowApply</a></li></ul></li></ul>
</nav>

<div id="main">
Expand All @@ -97,40 +97,33 @@ <h1 class="page-title">

<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.partition = partition;

/**
<pre class="prettyprint source linenums"><code>/**
* Partitions an array into multiple arrays
* Can be used to split data into training and testing sets
* @memberof module:bcijs
* @function
* @name partition
* @param {Array} array - The array to be partitioned
* @param {...number[]} divisions - The size of each partition, each value should range from 0 to 1
* @example
* partition([1, 2, 3, 4], 0.25, 0.75); // returns [[1], [2, 3, 4]]
* @returns {Array.&lt;Array>} Array of subarrays which are the partitons
*/
function partition(array) {
var parts = [];
var lastDivision = 0;
var runningSum = 0;

for (var _len = arguments.length, divisions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key &lt; _len; _key++) {
divisions[_key - 1] = arguments[_key];
}

divisions.forEach(function (division) {
runningSum += division;
var end = Math.round(runningSum * array.length);
parts.push(array.slice(lastDivision, end));
lastDivision = end;
});
return parts;
}</code></pre>
export function partition(array, ...divisions) {
var parts = [];

var lastDivision = 0;
var runningSum = 0;
divisions.forEach(division => {
runningSum += division;
var end = Math.round(runningSum * array.length);
parts.push(array.slice(lastDivision, end));
lastDivision = end;
});

return parts;
}
</code></pre>
</article>
</section>

Expand Down
Loading

0 comments on commit c7e356e

Please sign in to comment.