<commit_before>import { DoubleArray } from 'cheminfo-types';

export function isEquallySpaced(x: DoubleArray): boolean {
  let tmp: number;
  let maxDx = 0;
  let minDx = Number.MAX_SAFE_INTEGER;
  for (let i = 0; i < x.length - 1; ++i) {
    tmp = Math.abs(x[i + 1] - x[i]);
    if (tmp < minDx) {
      minDx = tmp;
    }
    if (tmp > maxDx) {
      maxDx = tmp;
    }
  }
  return (maxDx - minDx) / maxDx < 0.05;
}
<commit_msg>chore: rename variables in isEquallySpaced<commit_after>import { DoubleArray } from 'cheminfo-types';

/**
 * We check that the maximal slot with is not larger that 5% of the minimal slot width
 * @param x
 * @returns
 */
export function isEquallySpaced(x: DoubleArray): boolean {
  let maxDx = 0;
  let minDx = Number.MAX_SAFE_INTEGER;
  for (let i = 0; i < x.length - 1; ++i) {
    let absoluteDifference = Math.abs(x[i + 1] - x[i]);
    if (absoluteDifference < minDx) {
      minDx = absoluteDifference;
    }
    if (absoluteDifference > maxDx) {
      maxDx = absoluteDifference;
    }
  }
  return (maxDx - minDx) / maxDx < 0.05;
}

{'fraction_non_alphanumeric': 0.13271028037383178, 'fraction_numerical': 0.014018691588785047, 'mean_word_length': 2.825, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3075353', 'n_tokens_mistral': 426, 'n_tokens_neox': 411, 'n_words': 112}