Skip to content

Commit 88ef467

Browse files
committed
Release v0.3.5
1 parent 4860c0c commit 88ef467

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ml",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"main": [
55
"dist/ml.js",
66
"dist/ml.min.js"

dist/ml.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* ml - Machine learning tools
3-
* @version v0.3.4
3+
* @version v0.3.5
44
* @link https://github.com/mljs/ml
55
* @license MIT
66
*/
@@ -44,8 +44,7 @@ NN.SOM = require('ml-som');
4444
/*
4545
Array Utils
4646
*/
47-
var AU = exports.AU = exports.ArrayUtils = {};
48-
AU.ArrayUtils = require('ml-array-utils');
47+
var ArrayUtils = exports.ArrayUtils = exports.AU = require('ml-array-utils');
4948

5049
},{"ml-array-utils":4,"ml-distance":57,"ml-kmeans":58,"ml-matrix":67,"ml-som":69,"ml-stat/array":72,"ml-stat/matrix":73,"ml-svm":74}],2:[function(require,module,exports){
5150
'use strict';
@@ -231,6 +230,7 @@ module.exports = {
231230
'use strict';
232231

233232
/**
233+
*
234234
* Function that returns a Number array of equally spaced numberOfPoints
235235
* containing a representation of intensities of the spectra arguments x
236236
* and y.
@@ -239,18 +239,18 @@ module.exports = {
239239
* from: starting point
240240
* to: last point
241241
* numberOfPoints: number of points between from and to
242-
* variant: "slot" or "smooth"
242+
* variant: "slot" or "smooth" - smooth is the default option
243243
*
244244
* The slot variant consist that each point in the new array is calculated
245245
* averaging the existing points between the slot that belongs to the current
246246
* value. The smooth variant is the same but takes the integral of the range
247-
* of the slot and divide by the step size between two points in the new
248-
* array.
247+
* of the slot and divide by the step size between two points in the new array.
249248
*
250249
* @param x
251250
* @param y
252251
* @param options
253252
* @returns {Array} new array with the equally spaced data.
253+
*
254254
*/
255255
function getEquallySpacedData(x, y, options) {
256256

@@ -262,8 +262,13 @@ function getEquallySpacedData(x, y, options) {
262262

263263
var from = options.from === undefined ? x[0] : options.from;
264264
var to = options.to === undefined ? x[x.length - 1] : options.to;
265-
if(from > to)
266-
throw new RangeError("from option must be less or equal that the to argument.");
265+
266+
var reverse = from > to;
267+
if(reverse) {
268+
var temp = from;
269+
from = to;
270+
to = temp;
271+
}
267272

268273
var numberOfPoints = options.numberOfPoints === undefined ? 100 : options.numberOfPoints;
269274
if(numberOfPoints < 1)
@@ -363,7 +368,7 @@ function getEquallySpacedData(x, y, options) {
363368
updateParameters();
364369
}
365370

366-
return output;
371+
return reverse ? output.reverse() : output;
367372
}
368373
/**
369374
* Function that calculates the integral of the line between two

dist/ml.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ml.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ml",
3-
"version": "0.3.4",
3+
"version": "0.3.5",
44
"description": "Machine learning tools",
55
"main": "src/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)