code: function createTree (X, Y, from, to, minWindow, threshold) {
                  minWindow = minWindow || 0.16;
                  threshold = threshold || 0.01;
                  if ((to - from) < minWindow)
                      return undefined;
                  var sum = 0;
                  for (var i = 0; X[i] < to; i++) {
                      if (X[i] > from)
                          sum += Y[i];
                  }
                  if (sum < threshold) {
                      return undefined;
                  }
                  var center = 0;
                  for (var j = 0; X[j] < to; j++) {
                      if (X[i] > from)
                          center += X[j] * Y[j];
                  }
                  center = center / sum;
                  if (((center - from) < 10e-6) || ((to - center) < 10e-6)) return undefined;
                  if ((center - from) < (minWindow /4)) {
                      return createTree(X, Y, center, to, minWindow, threshold);
                  }
                  else {
                      if ((to - center) < (minWindow / 4)) {
                          return createTree(X, Y, from, center, minWindow, threshold);
                      }
                      else {
                          return {
                              'sum': sum,
                              'center': center,
                              'left': createTree(X, Y, from, center, minWindow, threshold),
                              'right': createTree(X, Y, center, to, minWindow, threshold)
                          };
                      }
                  }
              }
docs: Function that creates the tree
  @param {Array <number>} X - chemical shifts of the signal
  @param {Array <number>} Y - intensity of the signal
  @param {number} from - the low limit of x
  @param {number} to - the top limit of x
  @param {number} minWindow - smallest range to accept in x
  @param {number} threshold - smallest range to accept in y
  @returns {{sum: number, center: number, left: {json}, right: {json}}}
  left and right have the same structure than the parent, or have a
  undefined value if are leafs