From 78475be9ff40f9b8df2fe0718d6fa58757ff506d Mon Sep 17 00:00:00 2001 From: Luc Patiny Date: Fri, 19 Jun 2026 22:01:16 +0200 Subject: [PATCH] docs: improve JSDoc across spectra-processing functions Add missing @returns/@param descriptions and normalize phrasing across matrix, reim, utils, x, xy, xyArray, and xyObject modules. --- src/matrix/matrixAbsoluteMedian.ts | 2 +- src/matrix/matrixApplyNumericalEncoding.ts | 6 ++-- src/matrix/matrixCheckRanges.ts | 4 +-- src/matrix/matrixCholeskySolver.ts | 8 ++--- src/matrix/matrixClone.ts | 2 +- src/matrix/matrixCreateEmpty.ts | 2 +- src/matrix/matrixGetSubMatrix.ts | 6 ++-- src/matrix/matrixHistogram.ts | 2 +- src/matrix/matrixMedian.ts | 2 +- src/matrix/matrixNoiseStandardDeviation.ts | 4 +-- src/matrix/matrixNumericalDecoding.ts | 6 ++-- src/matrix/matrixSetSubMatrix.ts | 2 +- src/matrix/matrixToArray.ts | 2 +- src/matrix/matrixZPivotRescale.ts | 2 +- src/matrix/matrixZRescale.ts | 2 +- src/matrix/matrixZRescalePerColumn.ts | 2 +- src/reim/reimAbsolute.ts | 8 ++--- src/reim/reimAutoPhaseCorrection.ts | 36 +++++++++---------- src/reim/reimFFT.ts | 4 +-- src/reim/reimPhaseCorrection.ts | 8 ++--- src/reim/reimZeroFilling.ts | 2 +- src/reimMatrix/reimMatrixPhaseCorrection.ts | 8 ++--- src/utils/addWeights.ts | 8 ++--- src/utils/calculateAdaptiveWeights.ts | 8 ++--- src/utils/createFromToArray.ts | 4 +-- src/utils/createRandomArray.ts | 4 +-- src/utils/createStepArray.ts | 4 +-- src/utils/createSystemMatrix.ts | 6 ++-- src/utils/getCombinations.ts | 6 ++-- src/utils/getCombinationsIterator.ts | 4 +-- src/utils/isPowerOfTwo.ts | 2 +- src/utils/nextPowerOfTwo.ts | 2 +- src/utils/recursiveRemoveEmptyAndNull.ts | 16 ++++----- src/utils/recursiveResolve.ts | 4 +-- src/utils/recursiveUntypeArrays.ts | 4 +-- src/utils/stringify.ts | 8 ++--- src/x/utils/erfcinv.ts | 24 ++++++------- src/x/utils/simpleNormInv.ts | 12 +++---- src/x/xAutoCorrelation.ts | 2 +- src/x/xBinning.ts | 6 ++-- src/x/xBoxPlot.ts | 5 ++- src/x/xCheck.ts | 4 +-- src/x/xCheckLengths.ts | 4 +-- src/x/xCostMatrix.ts | 8 ++--- src/x/xCrossCorrelation.ts | 2 +- src/x/xDistributionStats.ts | 5 ++- src/x/xDotProduct.ts | 4 +-- src/x/xFindClosestIndex.ts | 8 ++--- src/x/xGetFromToIndex.ts | 2 +- src/x/xHilbertTransform.ts | 24 ++++++------- src/x/xHistogram.ts | 6 ++-- src/x/xIsEquallySpaced.ts | 4 +-- src/x/xMassCenterVectorSimilarity.ts | 8 ++--- src/x/xMedian.ts | 6 ++-- src/x/xMedianAbsoluteDeviation.ts | 2 +- src/x/xMinMaxDelta.ts | 2 +- src/x/xMinMaxValues.ts | 2 +- src/x/xMode.ts | 4 +-- src/x/xNoiseSanPlot.ts | 38 ++++++++++----------- src/x/xNoiseStandardDeviation.ts | 4 +-- src/x/xNormed.ts | 6 ++-- src/x/xRobustDistributionStats.ts | 5 ++- src/x/xSampling.ts | 12 +++---- src/x/xSum.ts | 6 ++-- src/x/xWhittakerSmoother.ts | 20 +++++------ src/xreim/xreimSortX.ts | 2 +- src/xreim/xreimZeroFilling.ts | 2 +- src/xy/__tests__/xyBinning.test.ts | 3 +- src/xy/utils/equallySpacedSlot.ts | 12 +++---- src/xy/utils/equallySpacedSmooth.ts | 12 +++---- src/xy/utils/integral.ts | 8 ++--- src/xy/xyAlign.ts | 7 ++-- src/xy/xyBinning.ts | 6 ++-- src/xy/xyCheck.ts | 6 ++-- src/xy/xyCovariance.ts | 6 ++-- src/xy/xyEnsureFloat64.ts | 5 +++ src/xy/xyEnsureGrowingX.ts | 3 +- src/xy/xyExtract.ts | 6 ++-- src/xy/xyFilterTopYValues.ts | 6 ++-- src/xy/xyFilterXPositive.ts | 2 +- src/xy/xyFromInterleaved.ts | 2 +- src/xy/xyGetNMaxY.ts | 6 ++-- src/xy/xyGrowingX.ts | 3 +- src/xy/xyIntegral.ts | 6 ++-- src/xy/xyIntegration.ts | 6 ++-- src/xy/xyInterpolateLinear.ts | 6 ++-- src/xy/xyJoinX.ts | 6 ++-- src/xy/xyMassCenter.ts | 5 +-- src/xy/xyMassCenterVector.ts | 6 ++-- src/xy/xyMaxClosestYPoint.ts | 6 ++-- src/xy/xyMaxY.ts | 6 ++-- src/xy/xyMaxYPoint.ts | 5 +-- src/xy/xyMaximaY.ts | 6 ++-- src/xy/xyMedianY.ts | 4 +-- src/xy/xyMedianYAtXs.ts | 6 ++-- src/xy/xyMinClosestYPoint.ts | 6 ++-- src/xy/xyMinYPoint.ts | 4 +-- src/xy/xyMinimaY.ts | 6 ++-- src/xy/xyPeakInfo.ts | 6 ++-- src/xy/xyRealMaxYPoint.ts | 6 ++-- src/xy/xyRealMinYPoint.ts | 6 ++-- src/xy/xyReduce.ts | 14 ++++---- src/xy/xyReduceNonContinuous.ts | 6 ++-- src/xy/xyRollingCircleTransform.ts | 4 +-- src/xy/xySetYValue.ts | 8 ++--- src/xy/xySortX.ts | 2 +- src/xy/xyToInterleaved.ts | 2 +- src/xy/xyToXYObject.ts | 4 +-- src/xy/xyUniqueX.ts | 16 ++++----- src/xyArray/utils/getSlots.ts | 4 +-- src/xyArray/utils/getSlotsToFirst.ts | 4 +-- src/xyArray/xyArrayAlign.ts | 2 +- src/xyArray/xyArrayMerge.ts | 2 +- src/xyArray/xyArrayWeightedMerge.ts | 8 ++--- src/xyObject/xyObjectBestPoints.ts | 4 +-- src/xyObject/xyObjectCheck.ts | 4 +-- src/xyObject/xyObjectJoinX.ts | 6 ++-- src/xyObject/xyObjectMaxXPoint.ts | 2 +- src/xyObject/xyObjectMaxYPoint.ts | 4 +-- src/xyObject/xyObjectMinMaxValues.ts | 4 +-- src/xyObject/xyObjectMinXPoint.ts | 2 +- src/xyObject/xyObjectMinYPoint.ts | 2 +- src/xyObject/xyObjectNormedY.ts | 6 ++-- src/xyObject/xyObjectSlotX.ts | 6 ++-- src/xyObject/xyObjectSortX.ts | 4 +-- src/xyObject/xyObjectSumY.ts | 2 +- src/xyObject/xyObjectToXY.ts | 4 +-- 127 files changed, 384 insertions(+), 376 deletions(-) diff --git a/src/matrix/matrixAbsoluteMedian.ts b/src/matrix/matrixAbsoluteMedian.ts index ed4a3bea..dd3b2722 100644 --- a/src/matrix/matrixAbsoluteMedian.ts +++ b/src/matrix/matrixAbsoluteMedian.ts @@ -4,7 +4,7 @@ import { xMedian } from '../x/index.ts'; /** * Returns the median of the absolute matrix. - * @param matrix + * @param matrix - input matrix. */ export function matrixAbsoluteMedian(matrix: DoubleMatrix): number { const nbColumns = matrix[0].length; diff --git a/src/matrix/matrixApplyNumericalEncoding.ts b/src/matrix/matrixApplyNumericalEncoding.ts index b4a9c9fa..7991a7ae 100644 --- a/src/matrix/matrixApplyNumericalEncoding.ts +++ b/src/matrix/matrixApplyNumericalEncoding.ts @@ -4,9 +4,9 @@ import { matrixCreateEmpty } from './matrixCreateEmpty.ts'; /** * Numerically encodes the strings in the matrix with an encoding dictionary. - * @param matrixInitial - Original matrix before encoding. - * @param dictionary - Dictionary against which to do the encoding. - * @returns - Encoded matrix. + * @param matrixInitial - original matrix before encoding. + * @param dictionary - dictionary against which to do the encoding. + * @returns encoded matrix. */ export function matrixApplyNumericalEncoding( matrixInitial: Array>, diff --git a/src/matrix/matrixCheckRanges.ts b/src/matrix/matrixCheckRanges.ts index bb1b1b66..8284d1d5 100644 --- a/src/matrix/matrixCheckRanges.ts +++ b/src/matrix/matrixCheckRanges.ts @@ -21,8 +21,8 @@ export interface SubmatrixBoundaries { /** * Checks if the specified submatrix boundaries are within the valid range of the given matrix. - * @param matrix - The matrix to check the boundaries against. - * @param boundaries - The boundaries of the submatrix. + * @param matrix - the matrix to check the boundaries against. + * @param boundaries - the boundaries of the submatrix. * @throws {RangeError} If any of the specified boundaries are out of the matrix's range. */ export function matrixCheckRanges( diff --git a/src/matrix/matrixCholeskySolver.ts b/src/matrix/matrixCholeskySolver.ts index 0a3732a5..bd8d415e 100644 --- a/src/matrix/matrixCholeskySolver.ts +++ b/src/matrix/matrixCholeskySolver.ts @@ -27,10 +27,10 @@ import type { NumberArray } from 'cheminfo-types'; /** * Solves a system of linear equations using the Cholesky decomposition method. * It is a direct conversion to TS from {@link https://github.com/scijs/cholesky-solve} - * @param nonZerosArray - The matrix in triplet form (array of arrays), where each sub-array contains three elements: row index, column index, and value. - * @param dimension - The order of the matrix (number of rows/columns). - * @param permutationEncoded - Optional permutation array. If provided, it will be used to permute the matrix. - * @returns A function that takes a right-hand side vector `b` and returns the solution vector `x`, or `null` if the decomposition fails. + * @param nonZerosArray - the matrix in triplet form (array of arrays), where each sub-array contains three elements: row index, column index, and value. + * @param dimension - the order of the matrix (number of rows/columns). + * @param permutationEncoded - optional permutation array. If provided, it will be used to permute the matrix. + * @returns a function that takes a right-hand side vector `b` and returns the solution vector `x`, or `null` if the decomposition fails. */ export function matrixCholeskySolver( nonZerosArray: NumberArray[], diff --git a/src/matrix/matrixClone.ts b/src/matrix/matrixClone.ts index b8feae64..d2c9ca31 100644 --- a/src/matrix/matrixClone.ts +++ b/src/matrix/matrixClone.ts @@ -1,6 +1,6 @@ /** * Clone a matrix. - * @param matrix + * @param matrix - input matrix. */ export function matrixClone(matrix: ValueType[][]): ValueType[][] { return matrix.map((row) => row.slice(0)); diff --git a/src/matrix/matrixCreateEmpty.ts b/src/matrix/matrixCreateEmpty.ts index 9e7d95dc..2469caf1 100644 --- a/src/matrix/matrixCreateEmpty.ts +++ b/src/matrix/matrixCreateEmpty.ts @@ -35,7 +35,7 @@ export interface MatrixCreateEmptyOptions< /** * Create a new matrix based on the size of the current one or by using specific dimensions. - * @param options + * @param options - options. */ export function matrixCreateEmpty< ArrayConstructorType extends NumberArrayConstructor = Float64ArrayConstructor, diff --git a/src/matrix/matrixGetSubMatrix.ts b/src/matrix/matrixGetSubMatrix.ts index 514ac568..e636d201 100644 --- a/src/matrix/matrixGetSubMatrix.ts +++ b/src/matrix/matrixGetSubMatrix.ts @@ -30,9 +30,9 @@ export interface MatrixGetSubMatrixOptions { /** * Get a subMatrix from matrix, the function checks if the subMatrix * lies within the dimensions of the matrix. - * @param matrix - The original matrix from which the subMatrix will be extracted. - * @param options - Options to define the subMatrix boundaries and duplication behavior. - * @returns The subMatrix extracted from the original matrix. + * @param matrix - the original matrix from which the subMatrix will be extracted. + * @param options - options to define the subMatrix boundaries and duplication behavior. + * @returns the subMatrix extracted from the original matrix. */ export function matrixGetSubMatrix( matrix: Float64Array[], diff --git a/src/matrix/matrixHistogram.ts b/src/matrix/matrixHistogram.ts index 18e1ff69..b5e1a3f3 100644 --- a/src/matrix/matrixHistogram.ts +++ b/src/matrix/matrixHistogram.ts @@ -56,7 +56,7 @@ export interface MatrixHistogramOptions { * Calculates a histogram of defined number of slots. * @param matrix - matrix [rows][cols]. * @param options - options - * @returns - Result of the histogram. + * @returns result of the histogram. */ export function matrixHistogram( matrix: DoubleMatrix, diff --git a/src/matrix/matrixMedian.ts b/src/matrix/matrixMedian.ts index 260330ee..511876e7 100644 --- a/src/matrix/matrixMedian.ts +++ b/src/matrix/matrixMedian.ts @@ -6,7 +6,7 @@ import { matrixToArray } from './matrixToArray.ts'; /** * Returns the median of the matrix. - * @param matrix + * @param matrix - input matrix. */ export function matrixMedian(matrix: DoubleMatrix): number { return xMedian(matrixToArray(matrix)); diff --git a/src/matrix/matrixNoiseStandardDeviation.ts b/src/matrix/matrixNoiseStandardDeviation.ts index c68012a0..97014b65 100644 --- a/src/matrix/matrixNoiseStandardDeviation.ts +++ b/src/matrix/matrixNoiseStandardDeviation.ts @@ -8,8 +8,8 @@ import { matrixToArray } from './matrixToArray.ts'; * Determine noise level using MAD https://en.wikipedia.org/wiki/Median_absolute_deviation * Constant to convert mad to sd calculated using https://www.wolframalpha.com/input?i=sqrt%282%29+inverse+erf%280.5%29 * This assumes a gaussian distribution of the noise. - * @param matrix - * @returns Noise level corresponding to one standard deviation. + * @param matrix - input matrix. + * @returns noise level corresponding to one standard deviation. */ export function matrixNoiseStandardDeviation(matrix: DoubleMatrix) { return xNoiseStandardDeviation(matrixToArray(matrix)); diff --git a/src/matrix/matrixNumericalDecoding.ts b/src/matrix/matrixNumericalDecoding.ts index 4c737255..d0beaa90 100644 --- a/src/matrix/matrixNumericalDecoding.ts +++ b/src/matrix/matrixNumericalDecoding.ts @@ -2,9 +2,9 @@ import { matrixClone } from './matrixClone.ts'; /** * Numerically decodes the matrix using the dictionary. - * @param matrixInitial - * @param dictionary - dictionary against which to do the encoding - * @returns - decoded matrix + * @param matrixInitial - original matrix to decode. + * @param dictionary - dictionary against which to do the encoding. + * @returns decoded matrix. */ export function matrixNumericalDecoding( matrixInitial: number[][], diff --git a/src/matrix/matrixSetSubMatrix.ts b/src/matrix/matrixSetSubMatrix.ts index 9ddd7b11..ded3bbb0 100644 --- a/src/matrix/matrixSetSubMatrix.ts +++ b/src/matrix/matrixSetSubMatrix.ts @@ -9,7 +9,7 @@ import { matrixCheckRanges } from './matrixCheckRanges.ts'; * @param subMatrix - matrix with equal or less size than matrix. * @param startRow - row index in matrix for the first row in subMatrix. * @param startColumn - column index in matrix for the first column in subMatrix. - * @returns The modified `matrix`. + * @returns the modified `matrix`. */ export function matrixSetSubMatrix( matrix: DoubleMatrix, diff --git a/src/matrix/matrixToArray.ts b/src/matrix/matrixToArray.ts index 7bb3be8e..40ed172c 100644 --- a/src/matrix/matrixToArray.ts +++ b/src/matrix/matrixToArray.ts @@ -4,7 +4,7 @@ import { matrixCheck } from './matrixCheck.ts'; /** * Convert a matrix to a flat Float64Array. - * @param matrix + * @param matrix - input matrix. */ export function matrixToArray(matrix: DoubleMatrix): Float64Array { matrixCheck(matrix); diff --git a/src/matrix/matrixZPivotRescale.ts b/src/matrix/matrixZPivotRescale.ts index 618cad0d..2d11ca81 100644 --- a/src/matrix/matrixZPivotRescale.ts +++ b/src/matrix/matrixZPivotRescale.ts @@ -27,7 +27,7 @@ export interface MatrixZPivotRescaleOptions< /** * Rescale a matrix around 0 taking into account the absolute max value. * @param matrix - matrix [rows][cols]. - * @param options - Options. + * @param options - options. */ export function matrixZPivotRescale< ArrayConstructorType extends NumberArrayConstructor = Float64ArrayConstructor, diff --git a/src/matrix/matrixZRescale.ts b/src/matrix/matrixZRescale.ts index f510127b..d95676d8 100644 --- a/src/matrix/matrixZRescale.ts +++ b/src/matrix/matrixZRescale.ts @@ -33,7 +33,7 @@ export interface MatrixZRescaleOptions< /** * Rescale a matrix between min and max values. * @param matrix - matrix [rows][cols]. - * @param options - Options. + * @param options - options. */ export function matrixZRescale< ArrayConstructorType extends DoubleArrayConstructor = Float64ArrayConstructor, diff --git a/src/matrix/matrixZRescalePerColumn.ts b/src/matrix/matrixZRescalePerColumn.ts index 64d1562d..950b8a43 100644 --- a/src/matrix/matrixZRescalePerColumn.ts +++ b/src/matrix/matrixZRescalePerColumn.ts @@ -19,7 +19,7 @@ export interface MatrixZRescalePerColumnOptions { /** * Rescale the matrix per column for which we get the min and max values. * @param matrix - matrix [rows][cols]. - * @param options - Options. + * @param options - options. */ export function matrixZRescalePerColumn( matrix: DoubleMatrix, diff --git a/src/reim/reimAbsolute.ts b/src/reim/reimAbsolute.ts index b9420d60..f49089d8 100644 --- a/src/reim/reimAbsolute.ts +++ b/src/reim/reimAbsolute.ts @@ -4,10 +4,10 @@ import type { DataReIm } from '../types/index.ts'; /** * Calculates reimAbsolute value of a complex spectrum. - * @param data - complex spectrum - * @param options - * @param options.output - * @returns - reimAbsolute value + * @param data - complex spectrum. + * @param options - options. + * @param options.output - optional output array. + * @returns absolute value array. */ export function reimAbsolute( data: DataReIm, diff --git a/src/reim/reimAutoPhaseCorrection.ts b/src/reim/reimAutoPhaseCorrection.ts index f8772b26..41c73ecd 100644 --- a/src/reim/reimAutoPhaseCorrection.ts +++ b/src/reim/reimAutoPhaseCorrection.ts @@ -165,11 +165,11 @@ interface AutoPhaseRegionResult { } /** - * AutoPhaseRegion. - * @param re - Array of Number. - * @param im - Array of Number. - * @param x0 - Number. - * @returns Region. + * Finds the best phase angle for a region by minimizing the negative area. + * @param re - array of number. + * @param im - array of number. + * @param x0 - number. + * @returns region. */ function autoPhaseRegion( re: DoubleArray, @@ -210,9 +210,9 @@ function autoPhaseRegion( } /** - * Holoborodko. - * @param s - Array of float. - * @returns Array of float. + * Applies the Holoborodko smoothing derivative filter. + * @param s - array of float. + * @returns array of float. */ function holoborodko(s: DoubleArray): Float64Array { const dk = new Float64Array(s.length); @@ -236,12 +236,12 @@ function holoborodko(s: DoubleArray): Float64Array { } /** - * RobustBaseLineRegionsDetection. - * @param s - * @param options - * @param options.magnitudeMode - * @param options.maxDistanceToJoin - * @param options.factorNoise + * Detects baseline regions using robust iterative noise estimation. + * @param s - input signal array. + * @param options - detection options. + * @param options.magnitudeMode - whether to use magnitude mode. + * @param options.maxDistanceToJoin - max distance to join nearby regions. + * @param options.factorNoise - noise factor for cutoff. */ function robustBaseLineRegionsDetection( s: DoubleArray, @@ -292,10 +292,10 @@ function robustBaseLineRegionsDetection( } /** - * WeightedLinearRegression. - * @param x - * @param y - * @param w + * Computes a weighted linear regression and returns [slope, intercept]. + * @param x - x values. + * @param y - y values. + * @param w - weights. */ function weightedLinearRegression( x: DoubleArray, diff --git a/src/reim/reimFFT.ts b/src/reim/reimFFT.ts index 8c2380ba..ee7a057a 100644 --- a/src/reim/reimFFT.ts +++ b/src/reim/reimFFT.ts @@ -15,8 +15,8 @@ export interface ReimFFTOptions { } /** - * ReimFFT. - * @param data - complex spectrum + * Computes the FFT of a complex spectrum. + * @param data - complex spectrum. * @param options - options. * @returns FFT of complex spectrum. */ diff --git a/src/reim/reimPhaseCorrection.ts b/src/reim/reimPhaseCorrection.ts index a7fd49b5..ca452e0c 100644 --- a/src/reim/reimPhaseCorrection.ts +++ b/src/reim/reimPhaseCorrection.ts @@ -16,10 +16,10 @@ export interface ReimPhaseCorrectionOptions { /** * Phase correction filter. * @param data - complex spectrum - * @param phi0 - Angle in radians for zero order phase correction - * @param phi1 - Angle in radians for first order phase correction - * @param options - * @returns - returns a new object {re:[], im:[]} unless inPlace=true + * @param phi0 - angle in radians for zero order phase correction. + * @param phi1 - angle in radians for first order phase correction. + * @param options - options. + * @returns a new object {re:[], im:[]} unless inPlace=true. */ export function reimPhaseCorrection( data: DataReIm, diff --git a/src/reim/reimZeroFilling.ts b/src/reim/reimZeroFilling.ts index 34f75337..340b6b03 100644 --- a/src/reim/reimZeroFilling.ts +++ b/src/reim/reimZeroFilling.ts @@ -8,7 +8,7 @@ import { createDoubleArray } from '../utils/createArray.ts'; * This function make a zero filling to re and im part. * @param data - object of kind {re:[], im:[]} * @param totalLength - final number of points - * @returns - New DataReIm object with zero-filled, + * @returns new DataReIm object with zero-filled, * truncated arrays if totalLength is smaller current length or * the same input if totalLength is equal that current length */ diff --git a/src/reimMatrix/reimMatrixPhaseCorrection.ts b/src/reimMatrix/reimMatrixPhaseCorrection.ts index db30a9ae..6340b7e5 100644 --- a/src/reimMatrix/reimMatrixPhaseCorrection.ts +++ b/src/reimMatrix/reimMatrixPhaseCorrection.ts @@ -14,10 +14,10 @@ export interface ReimMatrixPhaseCorrectionOptions { * Apply phase correction to a complex matrix along rows or columns. * All rows must have the same length. * @param data - complex matrix with re and im arrays of Float64Array rows - * @param phi0 - Angle in radians for zero order phase correction - * @param phi1 - Angle in radians for first order phase correction - * @param options - options including direction ('rows' or 'columns', default 'rows') - * @returns - complex matrix with corrected rows or columns + * @param phi0 - angle in radians for zero order phase correction. + * @param phi1 - angle in radians for first order phase correction. + * @param options - options including direction ('rows' or 'columns', default 'rows'). + * @returns complex matrix with corrected rows or columns. */ export function reimMatrixPhaseCorrection( data: DataReImMatrix, diff --git a/src/utils/addWeights.ts b/src/utils/addWeights.ts index 6edec4bf..da541ec6 100644 --- a/src/utils/addWeights.ts +++ b/src/utils/addWeights.ts @@ -4,10 +4,10 @@ import type { NumberArray } from 'cheminfo-types'; * add the provided weights to a particular given system matrix (lD'D) in the triplet form and y data. This function is not general * it assumes that diagonal coefficients are in the even indexes, it is the case of the matrix generated by createSystemMatrix function. * It simulates the matrix operation W + lD'D and Wy. - * @param leftHandSide - The original system matrix to be updated, a lower triangular non-zeros of the system matrix (lambda D'D). - * @param rightHandSide - The original vector to be updated. - * @param weights - The weights to apply to the system matrix and vector. - * @returns An object that contains the news left and right hand-side of the system. + * @param leftHandSide - the original system matrix to be updated, a lower triangular non-zeros of the system matrix (lambda D'D). + * @param rightHandSide - the original vector to be updated. + * @param weights - the weights to apply to the system matrix and vector. + * @returns an object that contains the new left and right hand-side of the system. */ export function addWeights( leftHandSide: number[][], diff --git a/src/utils/calculateAdaptiveWeights.ts b/src/utils/calculateAdaptiveWeights.ts index 2b4cade6..48aee44c 100644 --- a/src/utils/calculateAdaptiveWeights.ts +++ b/src/utils/calculateAdaptiveWeights.ts @@ -38,10 +38,10 @@ export interface CalculateAdaptiveWeightsOptions extends WeightsAndControlPoints * MAD (Median Absolute Deviation) is more robust to outliers and * the factor (1.4826) makes MAD scaled to be equivalent to the standard deviation for * normal distributions. {@link https://en.m.wikipedia.org/wiki/Median_absolute_deviation}. - * @param yData - The original data. - * @param baseline - The new baseline calculated. - * @param weights - The current weights to be updated. - * @param options - Options for updating weights. + * @param yData - the original data. + * @param baseline - the new baseline calculated. + * @param weights - the current weights to be updated. + * @param options - options for updating weights. * @returns new array of weights. */ diff --git a/src/utils/createFromToArray.ts b/src/utils/createFromToArray.ts index 91320be3..4e78cf9d 100644 --- a/src/utils/createFromToArray.ts +++ b/src/utils/createFromToArray.ts @@ -38,8 +38,8 @@ export interface CreateFromToArrayOptions { /** * Create an array with numbers between "from" and "to" of length "length" - * @param options - options - * @returns - array of distributed numbers between "from" and "to" + * @param options - options. + * @returns array of distributed numbers between "from" and "to". */ export function createFromToArray( options: CreateFromToArrayOptions = {}, diff --git a/src/utils/createRandomArray.ts b/src/utils/createRandomArray.ts index 22253f40..6ed81c09 100644 --- a/src/utils/createRandomArray.ts +++ b/src/utils/createRandomArray.ts @@ -41,8 +41,8 @@ export interface CreateRandomArrayOptions { /** * Create a random array of numbers of a specific length. - * @param options - * @returns - array of random floats normally distributed + * @param options - options. + * @returns array of random floats normally distributed. */ export function createRandomArray( options: CreateRandomArrayOptions = {}, diff --git a/src/utils/createStepArray.ts b/src/utils/createStepArray.ts index 5115bebd..69f71949 100644 --- a/src/utils/createStepArray.ts +++ b/src/utils/createStepArray.ts @@ -20,8 +20,8 @@ export interface CreateStepArrayOptions { /** * Create an array with numbers starting from "from" with step "step" of length "length". - * @param options - options - * @returns - array of distributed numbers with step "step" from "from" + * @param options - options. + * @returns array of distributed numbers with step "step" from "from". */ export function createStepArray( options: CreateStepArrayOptions = {}, diff --git a/src/utils/createSystemMatrix.ts b/src/utils/createSystemMatrix.ts index a8b1bf90..570d0e17 100644 --- a/src/utils/createSystemMatrix.ts +++ b/src/utils/createSystemMatrix.ts @@ -8,9 +8,9 @@ export interface SystemMatrix { * Generates a lower triangular non-zeros of the first order smoother matrix (lambda D'D) where D is the derivate of the identity matrix * this function in combination with addWeights function can obtain (Q = W + lambda D'D) a penalized least square of Whittaker smoother, * it also generates a permutation encoded array. - * @param dimension - The number of points in the matrix. - * @param lambda - The factor of smoothness . - * @returns An object containing the lower triangular non-zero elements of the matrix + * @param dimension - the number of points in the matrix. + * @param lambda - the factor of smoothness. + * @returns an object containing the lower triangular non-zero elements of the matrix * and the permutation encoded array. * @property lowerTriangularNonZeros - The lower triangular non-zero elements of the matrix in triplet form. * @property permutationEncodedArray - The permutation encoded array generated using the Cuthill-McKee algorithm. diff --git a/src/utils/getCombinations.ts b/src/utils/getCombinations.ts index 46a071d5..1a7986f0 100644 --- a/src/utils/getCombinations.ts +++ b/src/utils/getCombinations.ts @@ -1,8 +1,8 @@ /** * Generate all combinations of choosing k items from n items. - * @param n - Total number of items. - * @param k - Number of items to choose. - * @returns Array of combinations, where each combination is an array of indices. + * @param n - total number of items. + * @param k - number of items to choose. + * @returns array of combinations, where each combination is an array of indices. */ export function getCombinations(n: number, k: number): number[][] { if (k === 0) return [[]]; diff --git a/src/utils/getCombinationsIterator.ts b/src/utils/getCombinationsIterator.ts index 0e2b1161..eb523b61 100644 --- a/src/utils/getCombinationsIterator.ts +++ b/src/utils/getCombinationsIterator.ts @@ -1,8 +1,8 @@ /** * Generate all combinations of choosing k items from n items as an iterator. * Useful for large combination sets to avoid storing all combinations in memory. - * @param n - Total number of items. - * @param k - Number of items to choose. + * @param n - total number of items. + * @param k - number of items to choose. * @yields Each combination as an array of indices. */ diff --git a/src/utils/isPowerOfTwo.ts b/src/utils/isPowerOfTwo.ts index bb149c4c..e16bf0c5 100644 --- a/src/utils/isPowerOfTwo.ts +++ b/src/utils/isPowerOfTwo.ts @@ -1,6 +1,6 @@ /** * Check if a number is a power of two. - * @param n + * @param n - input number. */ export function isPowerOfTwo(n: number): boolean { return n !== 0 && (n & (n - 1)) === 0; diff --git a/src/utils/nextPowerOfTwo.ts b/src/utils/nextPowerOfTwo.ts index e9b2b1e6..67127464 100644 --- a/src/utils/nextPowerOfTwo.ts +++ b/src/utils/nextPowerOfTwo.ts @@ -1,6 +1,6 @@ /** * Get the size of the next power of two. - * @param n + * @param n - input number. */ export function nextPowerOfTwo(n: number): number { if (n === 0) return 1; diff --git a/src/utils/recursiveRemoveEmptyAndNull.ts b/src/utils/recursiveRemoveEmptyAndNull.ts index 237217e7..f2046edf 100644 --- a/src/utils/recursiveRemoveEmptyAndNull.ts +++ b/src/utils/recursiveRemoveEmptyAndNull.ts @@ -44,8 +44,8 @@ interface RecursiveRemoveEmptyAndNullOptions { /** * Recursively removes empty values from an object. This will also remove empty object or empty array. * @param object - the object being cleaned - * @param options - Optional object with options for cleaning - * @returns the cleaned object + * @param options - optional object with options for cleaning. + * @returns the cleaned object. */ export function recursiveRemoveEmptyAndNull( object: unknown, @@ -69,7 +69,7 @@ export function recursiveRemoveEmptyAndNull( * Uses a `WeakMap` to keep track of objects that have been visited while recursively cleaning * an object to prevent infinite recursive calls. * @param object - the object to be cleaned - * @param propertiesToRemove - Optional key to remove from `object`. If not specified, the default + * @param propertiesToRemove - optional key to remove from `object`. If not specified, the default * behavior is to remove "empty" values from `object`. A value is considered to be empty if it * is one of the following: * - empty strings @@ -77,8 +77,8 @@ export function recursiveRemoveEmptyAndNull( * - empty objects * - values that are null * - values that are undefined - * @param removeProperty - * @param options + * @param removeProperty - key to remove from the object. + * @param options - options. */ function cleanCyclicObject( object: any, @@ -205,7 +205,7 @@ function isNull(arg: unknown): arg is null { /** * Check if the argument is undefined. * @param {} arg - unknown function argument - * @returns Returns true if `arg` is of type Undefined, false otherwise + * @returns returns true if `arg` is of type Undefined, false otherwise. */ function isUndefined(arg: unknown): arg is undefined { return arg === undefined; @@ -214,9 +214,9 @@ function isUndefined(arg: unknown): arg is undefined { /** * Check if the argument is null, undefined, an empty string, array, or object. * @param {} arg - unknown function argument - * @returns Returns true if `arg` is an empty string, + * @returns returns true if `arg` is an empty string, * array, or object. Also returns true is `arg` is null or - * undefined. Returns true otherwise. + * undefined. Returns false otherwise. */ function isEmpty(arg: unknown): boolean { return ( diff --git a/src/utils/recursiveResolve.ts b/src/utils/recursiveResolve.ts index e70554c2..fe3faad7 100644 --- a/src/utils/recursiveResolve.ts +++ b/src/utils/recursiveResolve.ts @@ -1,8 +1,8 @@ /** * Resolves all promises in an object recursively. The promise with be replaced by the resolved value. * The changes are therefore done in-place ! - * @param object - * @returns + * @param object - object to resolve. + * @returns the resolved object. */ export async function recursiveResolve(object: unknown) { if (typeof object !== 'object') return object; diff --git a/src/utils/recursiveUntypeArrays.ts b/src/utils/recursiveUntypeArrays.ts index 701cd39f..93417e5c 100644 --- a/src/utils/recursiveUntypeArrays.ts +++ b/src/utils/recursiveUntypeArrays.ts @@ -3,8 +3,8 @@ import type { NumberArray } from 'cheminfo-types'; /** * Recursively change the typed arrays to normal arrays * The changes are done in-place ! - * @param object - * @returns + * @param object - object to transform. + * @returns the transformed object. */ export function recursiveUntypeArrays(object: unknown) { if (typeof object !== 'object') return object; diff --git a/src/utils/stringify.ts b/src/utils/stringify.ts index 50f64a6e..d48eb624 100644 --- a/src/utils/stringify.ts +++ b/src/utils/stringify.ts @@ -4,10 +4,10 @@ import type { NumberArray } from 'cheminfo-types'; /** * Stringify an object and convert all typed arrays to arrays - * @param object - * @param replacer - * @param space - * @returns + * @param object - object to stringify. + * @param replacer - optional replacer function. + * @param space - optional indentation. + * @returns JSON string. */ export function stringify( object: any, diff --git a/src/x/utils/erfcinv.ts b/src/x/utils/erfcinv.ts index a0e18026..3f0d3ac4 100644 --- a/src/x/utils/erfcinv.ts +++ b/src/x/utils/erfcinv.ts @@ -109,10 +109,10 @@ const Q5 = [ ]; /** - * Polyval. - * @param c - Array of Number. - * @param x - Number. - * @returns Number. + * Evaluates a polynomial at x using Horner's method. + * @param c - array of polynomial coefficients. + * @param x - evaluation point. + * @returns polynomial value. */ function polyval(c: number[], x: number): number { let p = 0; @@ -125,12 +125,12 @@ function polyval(c: number[], x: number): number { /** * Calculates a rational approximation. * @private - * @param x - Number. - * @param v - Number. - * @param P - Array of polynomial coefficients. - * @param Q - Array of polynomial coefficients. - * @param Y - Number. - * @returns Rational approximation. + * @param x - input value. + * @param v - shift value. + * @param P - array of numerator polynomial coefficients. + * @param Q - array of denominator polynomial coefficients. + * @param Y - scale factor. + * @returns rational approximation. */ function calc( x: number, @@ -147,8 +147,8 @@ function calc( /** * Evaluates the complementary inverse error function for an input value. * @private - * @param x - Input value. - * @returns Evaluated complementary inverse error function. + * @param x - input value. + * @returns evaluated complementary inverse error function. */ export default function erfcinv(x: number): number { let sign = false; diff --git a/src/x/utils/simpleNormInv.ts b/src/x/utils/simpleNormInv.ts index ad0ea231..c6aa653e 100644 --- a/src/x/utils/simpleNormInv.ts +++ b/src/x/utils/simpleNormInv.ts @@ -13,9 +13,9 @@ interface SimpleNormInvOptions { /** * Applies a simple normalization inverse transformation to the input data. - * @param data - The input array of numbers to be transformed. - * @param options - Optional parameters for the transformation. - * @returns A new Float64Array containing the transformed data. + * @param data - the input array of numbers to be transformed. + * @param options - optional parameters for the transformation. + * @returns a new Float64Array containing the transformed data. */ export function simpleNormInv( data: NumberArray, @@ -38,9 +38,9 @@ export function simpleNormInv( /** * Convenience wrapper for single number processing by simpleNormInv function. - * @param data - The number to be normalized. - * @param options - The options for the normalization process. - * @returns The normalized number. + * @param data - the number to be normalized. + * @param options - the options for the normalization process. + * @returns the normalized number. */ export function simpleNormInvNumber( data: number, diff --git a/src/x/xAutoCorrelation.ts b/src/x/xAutoCorrelation.ts index 63f4a2c0..62963432 100644 --- a/src/x/xAutoCorrelation.ts +++ b/src/x/xAutoCorrelation.ts @@ -19,7 +19,7 @@ export interface XAutoCorrelationOptions { /** * Calculates the auto-correlation of an array * @param A - the array for which to calculate the auto-correlation - * @param options - Options + * @param options - options. */ export function xAutoCorrelation( A: NumberArray, diff --git a/src/x/xBinning.ts b/src/x/xBinning.ts index 039b668c..ddbe6012 100644 --- a/src/x/xBinning.ts +++ b/src/x/xBinning.ts @@ -28,9 +28,9 @@ export interface XBinningOptions { /** * Downsample an array by averaging consecutive non-overlapping points (binning). * Either specify a fixed `binSize` or a target `numberOfPoints`. - * @param array - Input array. - * @param options - Options. - * @returns Downsampled array. + * @param array - input array. + * @param options - options. + * @returns downsampled array. */ export function xBinning( array: NumberArray, diff --git a/src/x/xBoxPlot.ts b/src/x/xBoxPlot.ts index 34d34d87..e3786578 100644 --- a/src/x/xBoxPlot.ts +++ b/src/x/xBoxPlot.ts @@ -21,9 +21,8 @@ export interface XBoxPlot { /** * Calculating the box plot of the array * This function will interpolate the values and use the inclusive algorithm - * @param array - data - * @param options - * @returns - q1, median, q3, min, max + * @param array - data. + * @returns q1, median, q3, min, max. */ export function xBoxPlot(array: NumberArray): XBoxPlot { xCheck(array); diff --git a/src/x/xCheck.ts b/src/x/xCheck.ts index 0ce3afd7..8370bd3b 100644 --- a/src/x/xCheck.ts +++ b/src/x/xCheck.ts @@ -12,8 +12,8 @@ export interface XCheckOptions { /** * Checks if the input is a non-empty array of numbers. * Only checks the first element. - * @param input - Array to check. - * @param options - Additional checks. + * @param input - array to check. + * @param options - additional checks. */ export function xCheck( input?: NumberArray, diff --git a/src/x/xCheckLengths.ts b/src/x/xCheckLengths.ts index 675e9ebc..76a97773 100644 --- a/src/x/xCheckLengths.ts +++ b/src/x/xCheckLengths.ts @@ -2,8 +2,8 @@ import type { NumberArray } from 'cheminfo-types'; /** * Check that two arrays have the same length. - * @param array1 - First array. - * @param array2 - Second array. + * @param array1 - first array. + * @param array2 - second array. */ export function xCheckLengths(array1: NumberArray, array2: NumberArray) { if (array1.length !== array2.length) { diff --git a/src/x/xCostMatrix.ts b/src/x/xCostMatrix.ts index b8612655..41ca2dee 100644 --- a/src/x/xCostMatrix.ts +++ b/src/x/xCostMatrix.ts @@ -13,10 +13,10 @@ interface XCostMatrixOptions { /** * Generate a cost matrix from two set of values using the function passed. by default it * generate the cost matrix of absolute value of differences. - * @param rowsArray - Array of values that will represent the rows of the cost matrix. - * @param columnsArray - Array of values that will represent the columns of the cost matrix. - * @param options - * @returns - A matrix instance with dimensions rowsArray.length x columnsArray.length + * @param rowsArray - array of values that will represent the rows of the cost matrix. + * @param columnsArray - array of values that will represent the columns of the cost matrix. + * @param options - options. + * @returns a matrix instance with dimensions rowsArray.length x columnsArray.length. */ export function xCostMatrix( rowsArray: NumberArray, diff --git a/src/x/xCrossCorrelation.ts b/src/x/xCrossCorrelation.ts index a2170904..cc8e5b96 100644 --- a/src/x/xCrossCorrelation.ts +++ b/src/x/xCrossCorrelation.ts @@ -20,7 +20,7 @@ export interface XCrossCorrelationOptions { * Calculates the cross-correlation between 2 arrays * @param A - fixed array * @param B - sweeping array - * @param options - Options + * @param options - options. */ export function xCrossCorrelation( A: NumberArray, diff --git a/src/x/xDistributionStats.ts b/src/x/xDistributionStats.ts index cb7e279f..73c1bdf5 100644 --- a/src/x/xDistributionStats.ts +++ b/src/x/xDistributionStats.ts @@ -16,9 +16,8 @@ export interface XDistributionStats extends XBoxPlotWithOutliers { * This ensure that the statistics are calculated in the same way in all the packages * If the array is empty it will throw an error * If the array has a length of 1, sd will be NaN (unbiased calculation of sd) - * @param array - data - * @param options - * @returns - q1, median, q3, min, max + * @param array - data. + * @returns q1, median, q3, min, max. */ export function xDistributionStats(array: NumberArray): XDistributionStats { return { diff --git a/src/x/xDotProduct.ts b/src/x/xDotProduct.ts index 61e6dcd7..6f2e9f42 100644 --- a/src/x/xDotProduct.ts +++ b/src/x/xDotProduct.ts @@ -4,8 +4,8 @@ import { xMultiply } from './xMultiply.ts'; /** * Dot product between two arrays. - * @param A - First array. - * @param B - Second array. + * @param A - first array. + * @param B - second array. */ export function xDotProduct(A: NumberArray, B: NumberArray): number { const g = xMultiply(A, B); diff --git a/src/x/xFindClosestIndex.ts b/src/x/xFindClosestIndex.ts index f9d2199c..44c9d125 100644 --- a/src/x/xFindClosestIndex.ts +++ b/src/x/xFindClosestIndex.ts @@ -10,10 +10,10 @@ export interface XFindClosestIndexOptions { /** * Returns the closest index of a `target` - * @param array - array of numbers - * @param target - target - * @param options - * @returns - closest index + * @param array - array of numbers. + * @param target - target value. + * @param options - options. + * @returns closest index. */ export function xFindClosestIndex( array: NumberArray, diff --git a/src/x/xGetFromToIndex.ts b/src/x/xGetFromToIndex.ts index ef8b7fc2..e4d4c296 100644 --- a/src/x/xGetFromToIndex.ts +++ b/src/x/xGetFromToIndex.ts @@ -31,7 +31,7 @@ export interface XGetFromToIndexOptions { /** * Returns an object with {fromIndex, toIndex} for a specific from / to * @param x - array of numbers - * @param options - Options + * @param options - options. */ export function xGetFromToIndex( x: NumberArray, diff --git a/src/x/xHilbertTransform.ts b/src/x/xHilbertTransform.ts index 11a79e36..c9a64d00 100644 --- a/src/x/xHilbertTransform.ts +++ b/src/x/xHilbertTransform.ts @@ -12,9 +12,9 @@ export interface XHilbertTransformOptions { /** * Performs the Hilbert transform * @link https://en.wikipedia.org/wiki/Hilbert_transform - * @param array - Array containing values - * @param options - * @returns A new vector with 90 degree shift regarding the phase of the original function + * @param array - array containing values. + * @param options - options. + * @returns a new vector with 90 degree shift regarding the phase of the original function. */ export function xHilbertTransform( @@ -38,8 +38,8 @@ export function xHilbertTransform( /** * Performs the discrete Hilbert transform using fast Fourier transform - * @param array - Array containing values - * @returns A new vector with 90 degree shift regarding the phase of the original function + * @param array - array containing values. + * @returns a new vector with 90 degree shift regarding the phase of the original function. * @see DOI: 10.1109/TAU.1970.1162139 "Discrete Hilbert transform" */ function hilbertTransformWithFFT(array: NumberArray) { @@ -80,10 +80,10 @@ function hilbertTransformWithFFT(array: NumberArray) { /** * Performs the discrete Hilbert transform - * @param array - Array containing values - * @param options - * @param options.inClockwise - * @returns A new vector with 90 degree shift regarding the phase of the original function + * @param array - array containing values. + * @param options - options. + * @param options.inClockwise - whether to apply clockwise rotation. + * @returns a new vector with 90 degree shift regarding the phase of the original function. */ function hilbertTransform( array: NumberArray, @@ -111,9 +111,9 @@ function hilbertTransform( /** * Performs resampling of an input array to the desired length employing linear interpolation. - * @param array - Array containing values. - * @param length - The length of the resulting array. - * @returns It returns a new array of the desired length. + * @param array - array containing values. + * @param length - the length of the resulting array. + * @returns a new array of the desired length. * @link https://en.wikipedia.org/wiki/Sample-rate_conversion */ function resampling( diff --git a/src/x/xHistogram.ts b/src/x/xHistogram.ts index e1bfac81..a3b3ebee 100644 --- a/src/x/xHistogram.ts +++ b/src/x/xHistogram.ts @@ -59,9 +59,9 @@ export interface XHistogramOptions { /** * Calculates a histogram of defined number of slots - * @param array - Array containing values - * @param options - options - * @returns - result of the histogram + * @param array - array containing values. + * @param options - options. + * @returns result of the histogram. */ export function xHistogram( array: NumberArray, diff --git a/src/x/xIsEquallySpaced.ts b/src/x/xIsEquallySpaced.ts index 3afd1c78..6ac8feaf 100644 --- a/src/x/xIsEquallySpaced.ts +++ b/src/x/xIsEquallySpaced.ts @@ -10,8 +10,8 @@ export interface XIsEquallySpacedOptions { /** * Check if the values are separated always by the same difference - * @param array - Monotone growing array of number - * @param options + * @param array - monotone growing array of number. + * @param options - options. */ export function xIsEquallySpaced( array: NumberArray, diff --git a/src/x/xMassCenterVectorSimilarity.ts b/src/x/xMassCenterVectorSimilarity.ts index aa7cd954..6daa06a4 100644 --- a/src/x/xMassCenterVectorSimilarity.ts +++ b/src/x/xMassCenterVectorSimilarity.ts @@ -16,10 +16,10 @@ interface XMassCenterVectorSimilarityOptions { /** * Check the similarity between array created by xyMassCenterVector - * @param array1 - * @param array2 - * @param options - * @returns + * @param array1 - first mass center vector. + * @param array2 - second mass center vector. + * @param options - options. + * @returns similarity score between 0 and 1. */ export function xMassCenterVectorSimilarity( array1: NumberArray, diff --git a/src/x/xMedian.ts b/src/x/xMedian.ts index 7f60f520..99bcc9ff 100644 --- a/src/x/xMedian.ts +++ b/src/x/xMedian.ts @@ -12,9 +12,9 @@ interface XMedianOptions { /** * Calculates the median of an array. - * @param input - Array containing values - * @param options - * @returns - median + * @param input - array containing values. + * @param options - options. + * @returns median. */ export function xMedian( input: NumberArray, diff --git a/src/x/xMedianAbsoluteDeviation.ts b/src/x/xMedianAbsoluteDeviation.ts index 8c8fb66b..e77b0cec 100644 --- a/src/x/xMedianAbsoluteDeviation.ts +++ b/src/x/xMedianAbsoluteDeviation.ts @@ -17,7 +17,7 @@ export interface XMedianAbsoluteDeviationResult { /** * This function calculates the median absolute deviation (MAD). * https://en.wikipedia.org/wiki/Median_absolute_deviation - * @param array + * @param array - array of numbers. */ export function xMedianAbsoluteDeviation( array: NumberArray, diff --git a/src/x/xMinMaxDelta.ts b/src/x/xMinMaxDelta.ts index 8368bbb3..455e669b 100644 --- a/src/x/xMinMaxDelta.ts +++ b/src/x/xMinMaxDelta.ts @@ -5,7 +5,7 @@ import { xCheck } from './xCheck.ts'; /** * Return min and max values of an array. * @param array - array of number - * @returns - Object with 2 properties, min and max + * @returns object with 2 properties, min and max. */ export function xMinMaxDelta(array: NumberArray): { min: number; diff --git a/src/x/xMinMaxValues.ts b/src/x/xMinMaxValues.ts index 7145d597..ae61db39 100644 --- a/src/x/xMinMaxValues.ts +++ b/src/x/xMinMaxValues.ts @@ -5,7 +5,7 @@ import { xCheck } from './xCheck.ts'; /** * Return min and max values of an array. * @param array - array of number - * @returns - Object with 2 properties, min and max. + * @returns object with 2 properties, min and max. */ export function xMinMaxValues(array: NumberArray): { min: number; diff --git a/src/x/xMode.ts b/src/x/xMode.ts index 7bda289e..55c3cfd6 100644 --- a/src/x/xMode.ts +++ b/src/x/xMode.ts @@ -2,8 +2,8 @@ import type { NumberArray } from 'cheminfo-types'; /** * Calculates the mode of an array - * @param input - Array containing values - * @returns - mode + * @param input - array containing values. + * @returns mode. */ export function xMode(input: NumberArray): number { if (input.length === 0) { diff --git a/src/x/xNoiseSanPlot.ts b/src/x/xNoiseSanPlot.ts index 21e95b80..a6b2e784 100644 --- a/src/x/xNoiseSanPlot.ts +++ b/src/x/xNoiseSanPlot.ts @@ -203,14 +203,14 @@ export function xNoiseSanPlot( /** * Determines the optimal cut-off point for a given array of positive numbers. - * @param signPositive - An array of positive numbers. - * @param options - Optional parameters to configure the cut-off determination. - * @param options.magnitudeMode - If true, uses magnitude mode for normalization. Default is false. - * @param options.considerList - An object specifying the range and step for consideration. - * @param options.considerList.from - The starting point of the range. Default is 0.5. - * @param options.considerList.step - The step size for the range. Default is 0.1. - * @param options.considerList.to - The ending point of the range. Default is 0.9. - * @returns The optimal cut-off point as a number. + * @param signPositive - an array of positive numbers. + * @param options - optional parameters to configure the cut-off determination. + * @param options.magnitudeMode - if true, uses magnitude mode for normalization. Default is false. + * @param options.considerList - an object specifying the range and step for consideration. + * @param options.considerList.from - the starting point of the range. Default is 0.5. + * @param options.considerList.step - the step size for the range. Default is 0.1. + * @param options.considerList.to - the ending point of the range. Default is 0.9. + * @returns the optimal cut-off point as a number. */ function determineCutOff( signPositive: NumberArray, @@ -261,11 +261,11 @@ function determineCutOff( /** * Generates a SAN plot from the given array based on the specified options. - * @param array - The input array of numbers to be processed. - * @param options - An optional object containing configuration options. - * @param options.logBaseY - The logarithmic base for the Y-axis. Defaults to 2. - * @param options.fromTo - An object specifying the range for each key. Each key maps to an object with `from` and `to` properties. - * @returns An object where each key maps to a DataXY object containing the processed data. + * @param array - the input array of numbers to be processed. + * @param options - an optional object containing configuration options. + * @param options.logBaseY - the logarithmic base for the Y-axis. Defaults to 2. + * @param options.fromTo - an object specifying the range for each key. Each key maps to an object with `from` and `to` properties. + * @returns an object where each key maps to a DataXY object containing the processed data. */ function generateSanPlot( array: NumberArray, @@ -294,10 +294,10 @@ function generateSanPlot( /** * Scales the input array based on the provided options. - * @param array - The input array to be scaled. - * @param options - An optional object containing scaling options. - * @param options.logBaseY - If provided, the array values will be scaled using the logarithm of this base. - * @returns An object containing the scaled x and y arrays. + * @param array - the input array to be scaled. + * @param options - an optional object containing scaling options. + * @param options.logBaseY - if provided, the array values will be scaled using the logarithm of this base. + * @returns an object containing the scaled x and y arrays. */ function scale( array: NumberArray, @@ -326,8 +326,8 @@ function scale( /** * Prepares and processes the input data array based on the provided options. - * @param array - The input array of numbers to be processed. - * @param options - An object containing the following properties: + * @param array - the input array of numbers to be processed. + * @param options - an object containing the following properties: * - scaleFactor: A number by which to scale each element of the array. * - mask: An optional array of the same length as the input array, where * elements corresponding to `true` values will be excluded from processing. diff --git a/src/x/xNoiseStandardDeviation.ts b/src/x/xNoiseStandardDeviation.ts index a04f29d7..172780cb 100644 --- a/src/x/xNoiseStandardDeviation.ts +++ b/src/x/xNoiseStandardDeviation.ts @@ -23,8 +23,8 @@ export interface XNoiseStandardDeviationResult { * Determine noise level using MAD https://en.wikipedia.org/wiki/Median_absolute_deviation * Constant to convert mad to sd calculated using https://www.wolframalpha.com/input?i=sqrt%282%29+inverse+erf%280.5%29 * This assumes a gaussian distribution of the noise - * @param array - * @returns noise level corresponding to one standard deviation + * @param array - array of numbers. + * @returns noise level corresponding to one standard deviation. */ export function xNoiseStandardDeviation( array: NumberArray, diff --git a/src/x/xNormed.ts b/src/x/xNormed.ts index 696263aa..3437860c 100644 --- a/src/x/xNormed.ts +++ b/src/x/xNormed.ts @@ -24,9 +24,9 @@ export interface XNormedOptions { /** * Divides the data with either the sum, the absolute sum or the maximum of the data - * @param input - Array containing values - * @param options - options - * @returns - normalized data + * @param input - array containing values. + * @param options - options. + * @returns normalized data. */ export function xNormed( input: NumberArray, diff --git a/src/x/xRobustDistributionStats.ts b/src/x/xRobustDistributionStats.ts index a8dc94ed..6430f6b1 100644 --- a/src/x/xRobustDistributionStats.ts +++ b/src/x/xRobustDistributionStats.ts @@ -17,9 +17,8 @@ export interface XRobustDistributionStats extends XBoxPlotWithOutliers { * This ensure that the statistics are calculated in the same way in all the packages * If the array is empty it will throw an error * If the array has a length of 1, sd will be NaN (unbiased calculation of sd) - * @param array - data - * @param options - * @returns - q1, median, q3, min, max + * @param array - data. + * @returns q1, median, q3, min, max. */ export function xRobustDistributionStats( array: NumberArray, diff --git a/src/x/xSampling.ts b/src/x/xSampling.ts index a9bf2d41..81a2519c 100644 --- a/src/x/xSampling.ts +++ b/src/x/xSampling.ts @@ -12,9 +12,9 @@ export interface XSamplingOptions { /** * Sample within the array - * @param array - array from which to sample - * @param options - options - * @returns - array with evenly spaced elements + * @param array - array from which to sample. + * @param options - options. + * @returns array with evenly spaced elements. * @link https://en.wikipedia.org/wiki/Sampling_(signal_processing) */ export function xSampling( @@ -34,9 +34,9 @@ export function xSampling( /** * Downsample within the array - * @param array - array from which to sample - * @param length - * @returns - array with evenly spaced elements + * @param array - array from which to sample. + * @param length - target number of elements. + * @returns array with evenly spaced elements. * @link https://en.wikipedia.org/wiki/Downsampling_(signal_processing) */ function downSampling( diff --git a/src/x/xSum.ts b/src/x/xSum.ts index b4c09911..d478b58f 100644 --- a/src/x/xSum.ts +++ b/src/x/xSum.ts @@ -6,9 +6,9 @@ import { xGetFromToIndex } from './xGetFromToIndex.ts'; /** * Calculate the sum of the values - * @param array - Object that contains property x (an ordered increasing array) and y (an array). - * @param options - Options. - * @returns XSum value on the specified range. + * @param array - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns sum value on the specified range. */ export function xSum( array: NumberArray, diff --git a/src/x/xWhittakerSmoother.ts b/src/x/xWhittakerSmoother.ts index 7adfd9d3..9b41ab08 100644 --- a/src/x/xWhittakerSmoother.ts +++ b/src/x/xWhittakerSmoother.ts @@ -69,9 +69,9 @@ export const xWhitakerSmoother = xWhittakerSmoother; /** * Computes the baseline points for the given data using an iterative smoothing algorithm. - * @param yData - The input data array. - * @param options - The options for baseline computation. - * @returns - The computed baseline points. + * @param yData - the input data array. + * @param options - the options for baseline computation. + * @returns the computed baseline points. */ function whittakerByCholesky( yData: NumberArray, @@ -132,10 +132,10 @@ function whittakerByCholesky( /** * Calculates the delta between the current and previous baseline. - * @param baseline - The current baseline array. - * @param prevBaseline - The previous baseline array. - * @param n - The length of the arrays. - * @returns - The calculated delta value. + * @param baseline - the current baseline array. + * @param prevBaseline - the previous baseline array. + * @param n - the length of the arrays. + * @returns the calculated delta value. */ function calculateDelta( baseline: NumberArray, @@ -151,9 +151,9 @@ function calculateDelta( /** * Retrieves the control points and weights for the given data, the weights are modified multiplication of controlPoints if it exists. - * @param y - The input data array. - * @param options - The options for control points and weights. - * @returns - The control points and modified weights. + * @param y - the input data array. + * @param options - the options for control points and weights. + * @returns the control points and modified weights. */ function getWeightsAndControlPoints( y: NumberArray, diff --git a/src/xreim/xreimSortX.ts b/src/xreim/xreimSortX.ts index af80cfea..686bb1ed 100644 --- a/src/xreim/xreimSortX.ts +++ b/src/xreim/xreimSortX.ts @@ -5,7 +5,7 @@ import type { DataXReIm } from '../types/index.ts'; /** * Sort object of arrays, x has to be monotone. * @param data - object of kind {x:[], re:[], im:[]} - * @returns - sorted array + * @returns sorted DataXReIm object. */ export function xreimSortX( data: DataXReIm, diff --git a/src/xreim/xreimZeroFilling.ts b/src/xreim/xreimZeroFilling.ts index 095b0c17..801795d5 100644 --- a/src/xreim/xreimZeroFilling.ts +++ b/src/xreim/xreimZeroFilling.ts @@ -5,7 +5,7 @@ import type { DataXReIm } from '../types/index.ts'; * This function makes a zero filling to re and im part. * @param data - object of kind {x:[], re:[], im:[]} * @param totalLength - final number of points - * @returns - data. + * @returns zero-filled DataXReIm object. */ export function xreimZeroFilling( data: DataXReIm, diff --git a/src/xy/__tests__/xyBinning.test.ts b/src/xy/__tests__/xyBinning.test.ts index 6e518413..3f49140b 100644 --- a/src/xy/__tests__/xyBinning.test.ts +++ b/src/xy/__tests__/xyBinning.test.ts @@ -1,3 +1,4 @@ +import type { DataXY } from 'cheminfo-types'; import { expect, test } from 'vitest'; import { xyBinning } from '../xyBinning.ts'; @@ -143,7 +144,7 @@ test('throws when x does not contain numbers', () => { y: [1, 2, 3], }; - expect(() => xyBinning(data as any, { binSize: 2 })).toThrow( + expect(() => xyBinning(data as unknown as DataXY, { binSize: 2 })).toThrow( /input must contain numbers/, ); }); diff --git a/src/xy/utils/equallySpacedSlot.ts b/src/xy/utils/equallySpacedSlot.ts index c92f4861..6becb40b 100644 --- a/src/xy/utils/equallySpacedSlot.ts +++ b/src/xy/utils/equallySpacedSlot.ts @@ -1,11 +1,11 @@ /** * Function that retrieves the getEquallySpacedData with the variant "slot". - * @param x - * @param y - * @param from - * @param to - * @param numberOfPoints - * @returns Array of y's equally spaced with the variant "slot" + * @param x - x coordinates. + * @param y - y coordinates. + * @param from - start of the output x range. + * @param to - end of the output x range. + * @param numberOfPoints - number of output points. + * @returns array of y values equally spaced with the variant "slot". */ export default function equallySpacedSlot( /** x coordinates */ diff --git a/src/xy/utils/equallySpacedSmooth.ts b/src/xy/utils/equallySpacedSmooth.ts index 16929c8c..d842f915 100644 --- a/src/xy/utils/equallySpacedSmooth.ts +++ b/src/xy/utils/equallySpacedSmooth.ts @@ -2,12 +2,12 @@ import integral from './integral.ts'; /** * Function that retrieves the getEquallySpacedData with the variant "smooth". - * @param x - * @param y - * @param from - * @param to - * @param numberOfPoints - * @returns - Array of y's equally spaced with the variant "smooth" + * @param x - x coordinates. + * @param y - y coordinates. + * @param from - start of the output x range. + * @param to - end of the output x range. + * @param numberOfPoints - number of output points. + * @returns array of y values equally spaced with the variant "smooth". */ export default function equallySpacedSmooth( /** x coordinates */ diff --git a/src/xy/utils/integral.ts b/src/xy/utils/integral.ts index 538583a4..074e03ef 100644 --- a/src/xy/utils/integral.ts +++ b/src/xy/utils/integral.ts @@ -1,10 +1,10 @@ /** * Function that calculates the integral of the line between two * x-coordinates, given the slope and intercept of the line. - * @param x0 - * @param x1 - * @param slope - * @param intercept + * @param x0 - first x coordinate. + * @param x1 - second x coordinate. + * @param slope - slope of the line. + * @param intercept - y-intercept of the line. * @returns integral value. */ export default function integral( diff --git a/src/xy/xyAlign.ts b/src/xy/xyAlign.ts index f420e4e2..bc1ab09d 100644 --- a/src/xy/xyAlign.ts +++ b/src/xy/xyAlign.ts @@ -30,9 +30,10 @@ export interface XYAlignResult { * Align data of two spectra by verifying wether x values are in a certain range (`delta`). * The two spectra should not have two consecutive x values which difference is * smaller than `delta` to achieve good results! - * @param data1 - First spectrum data - * @param data2 - Second spectrum data - * @param options - Options + * @param data1 - first spectrum data. + * @param data2 - second spectrum data. + * @param options - options. + * @returns aligned x, y1, y2 arrays. */ export function xyAlign( data1: DataXY, diff --git a/src/xy/xyBinning.ts b/src/xy/xyBinning.ts index ec7b3733..cc3191d2 100644 --- a/src/xy/xyBinning.ts +++ b/src/xy/xyBinning.ts @@ -9,9 +9,9 @@ import { xyCheck } from './xyCheck.ts'; * Downsample x and y by averaging consecutive non-overlapping points. * Both arrays are binned with the same partitioning, so the resulting x * is the mean x of each bin. - * @param data - Object that contains x and y arrays. - * @param options - Binning options (same as xBinning). - * @returns Downsampled x and y arrays. + * @param data - object that contains x and y arrays. + * @param options - binning options (same as xBinning). + * @returns downsampled x and y arrays. */ export function xyBinning( data: DataXY, diff --git a/src/xy/xyCheck.ts b/src/xy/xyCheck.ts index 7dff0114..2012053a 100644 --- a/src/xy/xyCheck.ts +++ b/src/xy/xyCheck.ts @@ -4,9 +4,9 @@ import { isAnyArray } from 'is-any-array'; /** * Verify that `data` is an object of x,y arrays. * Throws an error if it's not. - * @param data - * @param options - * @param options.minLength + * @param data - data to check. + * @param options - options. + * @param options.minLength - minimum required length. */ export function xyCheck( data: unknown, diff --git a/src/xy/xyCovariance.ts b/src/xy/xyCovariance.ts index f19953f3..1bdd5c60 100644 --- a/src/xy/xyCovariance.ts +++ b/src/xy/xyCovariance.ts @@ -12,9 +12,9 @@ export interface XYCovarianceOptions { /** * Finds the covariance of the points. - * @param data - * @param options - * @returns the covariance + * @param data - data with x and y arrays. + * @param options - options. + * @returns the covariance. */ export function xyCovariance( data: DataXY, diff --git a/src/xy/xyEnsureFloat64.ts b/src/xy/xyEnsureFloat64.ts index bcf6bd4a..9ab6faf6 100644 --- a/src/xy/xyEnsureFloat64.ts +++ b/src/xy/xyEnsureFloat64.ts @@ -2,6 +2,11 @@ import type { DataXY } from 'cheminfo-types'; import { xEnsureFloat64 } from '../x/index.ts'; +/** + * Converts both x and y arrays to Float64Array if they are not already. + * @param data - object containing x and y arrays. + * @returns data with x and y as Float64Array. + */ export function xyEnsureFloat64(data: DataXY): DataXY { return { x: xEnsureFloat64(data.x), diff --git a/src/xy/xyEnsureGrowingX.ts b/src/xy/xyEnsureGrowingX.ts index 7a19b552..914ca421 100644 --- a/src/xy/xyEnsureGrowingX.ts +++ b/src/xy/xyEnsureGrowingX.ts @@ -6,7 +6,8 @@ import { xyCheck } from './xyCheck.ts'; /** * Filters x,y values to allow strictly growing values in x-axis. - * @param data - Object that contains property x (an ordered increasing array) and y (an array). + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @returns filtered data with strictly increasing x values. */ export function xyEnsureGrowingX( data: DataXY, diff --git a/src/xy/xyExtract.ts b/src/xy/xyExtract.ts index 88079745..4846cb4b 100644 --- a/src/xy/xyExtract.ts +++ b/src/xy/xyExtract.ts @@ -14,9 +14,9 @@ export interface XYExtractOptions { /** * Extract zones from a XY data. - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns - Array of points + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns extracted DataXY containing only the points within the specified zones. */ export function xyExtract( data: DataXY, diff --git a/src/xy/xyFilterTopYValues.ts b/src/xy/xyFilterTopYValues.ts index 4fea6594..8639818c 100644 --- a/src/xy/xyFilterTopYValues.ts +++ b/src/xy/xyFilterTopYValues.ts @@ -4,9 +4,9 @@ import { xSortDescending } from '../x/index.ts'; /** * Filter an array x/y based on various criteria x points are expected to be sorted - * @param data - object containing 2 properties x and y - * @param nbPeaks - * @returns filtered data + * @param data - object containing 2 properties x and y. + * @param nbPeaks - number of top peaks to keep. + * @returns filtered data. */ export function xyFilterTopYValues(data: DataXY, nbPeaks?: number) { if (nbPeaks === undefined) return data; diff --git a/src/xy/xyFilterXPositive.ts b/src/xy/xyFilterXPositive.ts index a0e5ae63..e5d947ef 100644 --- a/src/xy/xyFilterXPositive.ts +++ b/src/xy/xyFilterXPositive.ts @@ -5,7 +5,7 @@ import { xyCheck } from './xyCheck.ts'; /** * Filter out all the points for which x <= 0. Useful to display log scale data * @param data - data - * @returns - An object with the filtered data + * @returns an object with the filtered data. */ export function xyFilterXPositive(data: DataXY): DataXY { xyCheck(data); diff --git a/src/xy/xyFromInterleaved.ts b/src/xy/xyFromInterleaved.ts index 63d11068..730e4689 100644 --- a/src/xy/xyFromInterleaved.ts +++ b/src/xy/xyFromInterleaved.ts @@ -2,7 +2,7 @@ import type { DataXY } from 'cheminfo-types'; /** * Convert a flat interleaved array [x, y, x, y, ...] to a DataXY object. - * @param data - Flat array alternating x and y values. + * @param data - flat array alternating x and y values. * @returns DataXY object with separate x and y arrays. */ export function xyFromInterleaved( diff --git a/src/xy/xyGetNMaxY.ts b/src/xy/xyGetNMaxY.ts index b12fb7f2..6d26e141 100644 --- a/src/xy/xyGetNMaxY.ts +++ b/src/xy/xyGetNMaxY.ts @@ -4,9 +4,9 @@ import { xyCheck } from './xyCheck.ts'; /** * Returns the numberMaxPoints points with the bigger y. - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param numberMaxPoints - Number of points to keep - * @returns - The points filtered to keep the `numberMaxPoints` most intense points of the input. + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param numberMaxPoints - number of points to keep. + * @returns the points filtered to keep the `numberMaxPoints` most intense points of the input. */ export function xyGetNMaxY(data: DataXY, numberMaxPoints: number): DataXY { xyCheck(data); diff --git a/src/xy/xyGrowingX.ts b/src/xy/xyGrowingX.ts index 141685a5..b9cec356 100644 --- a/src/xy/xyGrowingX.ts +++ b/src/xy/xyGrowingX.ts @@ -2,7 +2,8 @@ import type { DataXY, NumberArray } from 'cheminfo-types'; /** * Order object of array, x has to be monotone. Ensure x is growing - * @param data - Object of kind {x:[], y:[]}. + * @param data - object of kind {x:[], y:[]}. + * @returns data with x in ascending order (reversed in-place if descending). */ export function xyGrowingX( data: DataXY, diff --git a/src/xy/xyIntegral.ts b/src/xy/xyIntegral.ts index 59d6d29d..03dd2539 100644 --- a/src/xy/xyIntegral.ts +++ b/src/xy/xyIntegral.ts @@ -15,9 +15,9 @@ export interface XYIntegralOptions extends XYIntegrationOptions { /** * Generate a X / Y of the xyIntegral - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options - * @returns - An object with the xyIntegration function + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns an object with the cumulative integral values. */ export function xyIntegral( data: DataXY, diff --git a/src/xy/xyIntegration.ts b/src/xy/xyIntegration.ts index 7001f69b..2174567b 100644 --- a/src/xy/xyIntegration.ts +++ b/src/xy/xyIntegration.ts @@ -30,9 +30,9 @@ export interface XYIntegrationOptions { /** * Calculate integration - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options - * @returns - xyIntegration value on the specified range + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns integration value on the specified range. */ export function xyIntegration( data: DataXY, diff --git a/src/xy/xyInterpolateLinear.ts b/src/xy/xyInterpolateLinear.ts index 03c6683c..62accd2a 100644 --- a/src/xy/xyInterpolateLinear.ts +++ b/src/xy/xyInterpolateLinear.ts @@ -7,9 +7,9 @@ import { xyCheck } from './xyCheck.ts'; * This is useful for upsampling or resampling data to specific x positions. * Both the input data and target x values must be sorted in ascending order. * Uses a two-pointer approach with O(n + m) complexity. - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param xTarget - Target x positions where y values should be interpolated - * @returns - Interpolated y values at target x positions + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param xTarget - target x positions where y values should be interpolated. + * @returns interpolated y values at target x positions. */ export function xyInterpolateLinear( data: DataXY, diff --git a/src/xy/xyJoinX.ts b/src/xy/xyJoinX.ts index b77a7714..1433f2fa 100644 --- a/src/xy/xyJoinX.ts +++ b/src/xy/xyJoinX.ts @@ -13,9 +13,9 @@ export interface XYJoinXOptions { /** * Join x / y values when difference in X is closer than delta. * When joining, y values are summed and x values are weighted average - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options - * @returns - An object with the xyIntegration function + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns an object with joined x and summed y values. */ export function xyJoinX( data: DataXY, diff --git a/src/xy/xyMassCenter.ts b/src/xy/xyMassCenter.ts index ef3f3728..e024ac74 100644 --- a/src/xy/xyMassCenter.ts +++ b/src/xy/xyMassCenter.ts @@ -7,8 +7,9 @@ import { xyCheck } from './xyCheck.ts'; /** * Computes the weighted mean value of an array of values. - * @param data - array of DataXY - * @param options - options + * @param data - array of DataXY. + * @param options - options. + * @returns weighted mean x value (center of mass). */ export function xyMassCenter( data: DataXY, diff --git a/src/xy/xyMassCenterVector.ts b/src/xy/xyMassCenterVector.ts index 1b3a86c6..f40cbbe0 100644 --- a/src/xy/xyMassCenterVector.ts +++ b/src/xy/xyMassCenterVector.ts @@ -12,9 +12,9 @@ export interface XYMassCenterVectorOptions { * We will calculate a vector containing center of mass of DataXY as well as center of mass of both parts, etc. * This approach allows to efficiently represent spectra like XPS, NMR, etc. It should provide an extremely efficient * way to store and search similar spectra. - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - * @returns - Array of centers of mass + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns array of centers of mass. */ export function xyMassCenterVector( data: DataXY, diff --git a/src/xy/xyMaxClosestYPoint.ts b/src/xy/xyMaxClosestYPoint.ts index 8108a17d..a2086a6c 100644 --- a/src/xy/xyMaxClosestYPoint.ts +++ b/src/xy/xyMaxClosestYPoint.ts @@ -13,9 +13,9 @@ export interface XYMaxClosestYPointOptions { /** * Find the closest maximum going up hill - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns - An object with the x/y value + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns an object with the x/y value. */ export function xyMaxClosestYPoint( data: DataXY, diff --git a/src/xy/xyMaxY.ts b/src/xy/xyMaxY.ts index f3449543..4f7e42a4 100644 --- a/src/xy/xyMaxY.ts +++ b/src/xy/xyMaxY.ts @@ -30,9 +30,9 @@ export interface XYMaxYOptions { /** * Finds the max value in a zone - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options - * @returns - Max y on the specified range + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns max y on the specified range. */ export function xyMaxY(data: DataXY, options: XYMaxYOptions = {}): number { diff --git a/src/xy/xyMaxYPoint.ts b/src/xy/xyMaxYPoint.ts index b733cb8d..921b3723 100644 --- a/src/xy/xyMaxYPoint.ts +++ b/src/xy/xyMaxYPoint.ts @@ -31,8 +31,9 @@ export interface XYMaxYPointOptions { /** * Finds the max y value in a range and return a {x,y} point - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns point with the highest y value in the range. */ export function xyMaxYPoint( data: DataXY, diff --git a/src/xy/xyMaximaY.ts b/src/xy/xyMaximaY.ts index 7e3f2639..1fe95dd9 100644 --- a/src/xy/xyMaximaY.ts +++ b/src/xy/xyMaximaY.ts @@ -10,9 +10,9 @@ import { xyCheck } from './xyCheck.ts'; * Finds all the max values * If the values are equal the middle * of the equal part will be the position of the signal! - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Object with from and to properties - * @returns - Array of points + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options with from and to properties. + * @returns array of points. */ export function xyMaximaY( data: DataXY, diff --git a/src/xy/xyMedianY.ts b/src/xy/xyMedianY.ts index d88724fd..40fd8283 100644 --- a/src/xy/xyMedianY.ts +++ b/src/xy/xyMedianY.ts @@ -9,8 +9,8 @@ export interface XYMedianYOptions { /** * Computes the median of Y values in a sliding window around each point. - * @param data - Object with x and y arrays of the same length. - * @param options - Options for the median computation. + * @param data - object with x and y arrays of the same length. + * @param options - options for the median computation. * @returns A new DataXY with the same x values and smoothed y values. */ export function xyMedianY( diff --git a/src/xy/xyMedianYAtXs.ts b/src/xy/xyMedianYAtXs.ts index bf2b4b10..34fc7528 100644 --- a/src/xy/xyMedianYAtXs.ts +++ b/src/xy/xyMedianYAtXs.ts @@ -12,9 +12,9 @@ export interface XYMedianYAtXsOptions { * Computes the median of Y values in a sliding window around each target x position. * For each value in xValues, the closest index in data.x is found and the median * of the surrounding y values (within the window) is returned. - * @param data - Object with x (sorted in increasing order) and y arrays of the same length. - * @param xValues - Array of x positions at which to compute the median. - * @param options - Options for the median computation. + * @param data - object with x (sorted in increasing order) and y arrays of the same length. + * @param xValues - array of x positions at which to compute the median. + * @param options - options for the median computation. * @returns A new DataXY with x = xValues and y = computed medians. */ export function xyMedianYAtXs( diff --git a/src/xy/xyMinClosestYPoint.ts b/src/xy/xyMinClosestYPoint.ts index 70fe1f8e..a80be914 100644 --- a/src/xy/xyMinClosestYPoint.ts +++ b/src/xy/xyMinClosestYPoint.ts @@ -13,9 +13,9 @@ export interface XYMinClosestYPointOptions { /** * Find the closest minimum going down hill - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options - * @returns - An object with the x/y value + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns an object with the x/y value. */ export function xyMinClosestYPoint( data: DataXY, diff --git a/src/xy/xyMinYPoint.ts b/src/xy/xyMinYPoint.ts index 4a2f9a4f..950445df 100644 --- a/src/xy/xyMinYPoint.ts +++ b/src/xy/xyMinYPoint.ts @@ -31,8 +31,8 @@ export interface XYMinYPointOptions { /** * Finds the min y value in a range and return a {x,y} point - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - Options + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. */ export function xyMinYPoint( data: DataXY, diff --git a/src/xy/xyMinimaY.ts b/src/xy/xyMinimaY.ts index f9d3e99a..eb328cbb 100644 --- a/src/xy/xyMinimaY.ts +++ b/src/xy/xyMinimaY.ts @@ -10,9 +10,9 @@ import { xyCheck } from './xyCheck.ts'; * Finds all the min values * If the values are equal the middle * of the equal part will be the position of the signal! - * @param data - Object that contains property X (an ordered increasing array) and y (an arraY) - * @param options - Object with from and to properties - * @returns - Array of points. + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options with from and to properties. + * @returns array of points. */ export function xyMinimaY( data: DataXY, diff --git a/src/xy/xyPeakInfo.ts b/src/xy/xyPeakInfo.ts index ad30b267..becfcd7c 100644 --- a/src/xy/xyPeakInfo.ts +++ b/src/xy/xyPeakInfo.ts @@ -26,9 +26,9 @@ export interface XYPeakInfo { * ML.ArrayPoints.uniqueX * ML.ArrayPoints.sortX * ML.ArrayPoints.equallySpaced - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns - Information about signal + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns information about signal. */ export function xyPeakInfo( data: DataXY, diff --git a/src/xy/xyRealMaxYPoint.ts b/src/xy/xyRealMaxYPoint.ts index 5799a6ea..bd8f9227 100644 --- a/src/xy/xyRealMaxYPoint.ts +++ b/src/xy/xyRealMaxYPoint.ts @@ -7,9 +7,9 @@ import { xyCheck } from './xyCheck.ts'; /** * Find the closest minimum going down hill - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns - An object with the x/y value + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns an object with the x/y value. */ export function xyRealMaxYPoint(data: DataXY, options = {}): PointWithIndex { xyCheck(data); diff --git a/src/xy/xyRealMinYPoint.ts b/src/xy/xyRealMinYPoint.ts index 5946715f..fcf40416 100644 --- a/src/xy/xyRealMinYPoint.ts +++ b/src/xy/xyRealMinYPoint.ts @@ -6,9 +6,9 @@ import { xGetTargetIndex } from '../x/index.ts'; import { xyCheck } from './xyCheck.ts'; /** - * xyRealMinYPoint. - * @param data - Data. - * @param options - Options. + * Finds the real minimum y point using parabolic interpolation when possible. + * @param data - data. + * @param options - options. */ export function xyRealMinYPoint(data: DataXY, options = {}): PointWithIndex { xyCheck(data); diff --git a/src/xy/xyReduce.ts b/src/xy/xyReduce.ts index 9e219adc..6e970b89 100644 --- a/src/xy/xyReduce.ts +++ b/src/xy/xyReduce.ts @@ -50,9 +50,9 @@ export interface XYReduceOptions { * * SHOULD NOT BE USED FOR DATA PROCESSING !!! * You should rather use ml-xy-equally-spaced to make further processing - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns Object with x and y arrays + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns object with x and y arrays. */ export function xyReduce( data: DataXY, @@ -104,10 +104,10 @@ export function xyReduce( return { x: newX, y: newY }; /** - * AppendFromTo. - * @param fromIndex - From. - * @param toIndex - To. - * @param zoneNbPoints - NbPoints. + * Appends reduced x/y values for a zone to the output arrays. + * @param fromIndex - start index in the input arrays. + * @param toIndex - end index in the input arrays. + * @param zoneNbPoints - target number of points to keep in this zone. */ function appendFromTo( fromIndex: number, diff --git a/src/xy/xyReduceNonContinuous.ts b/src/xy/xyReduceNonContinuous.ts index decb38bb..df3ed2de 100644 --- a/src/xy/xyReduceNonContinuous.ts +++ b/src/xy/xyReduceNonContinuous.ts @@ -34,9 +34,9 @@ export interface XYReduceOptions { * display many spectra as SVG. This algorithm is designed for non-continuous data. * We are expecting peaks to be only positive and the x values to be ordered. * SHOULD NOT BE USED FOR DATA PROCESSING !!! - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns Object with x and y arrays + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns object with x and y arrays. */ export function xyReduceNonContinuous( data: DataXY, diff --git a/src/xy/xyRollingCircleTransform.ts b/src/xy/xyRollingCircleTransform.ts index 5f384a33..03f0f22a 100644 --- a/src/xy/xyRollingCircleTransform.ts +++ b/src/xy/xyRollingCircleTransform.ts @@ -2,8 +2,8 @@ * * Dong, Jian, et al. "An algorithm of filtering noises in multi-beam data based on rolling circle transform." 2019 2nd International Conference on Sustainable Energy, Environment and Information Engineering (SEEIE 2019). Atlantis Press, 2019. * DONG Jian, PENG Rencan, ZHANG Lihua, WANG Zhijun. An Algorithm of Filtering Noises in Multi-beam Data Based on Rolling Circle Transform[J]. Geomatics and Information Science of Wuhan University, 2016, 41(1): 86-92. DOI: 10.13203/j.whugis20130757 - * @param data - * @param options + * @param data - data with x and y arrays. + * @param options - options. */ import type { DataXY } from 'cheminfo-types'; diff --git a/src/xy/xySetYValue.ts b/src/xy/xySetYValue.ts index 0a17b6fb..9c7b86b7 100644 --- a/src/xy/xySetYValue.ts +++ b/src/xy/xySetYValue.ts @@ -7,15 +7,15 @@ import { xyCheck } from './xyCheck.ts'; export interface XYSetYValueOptions { zones?: FromTo[]; - /** data contains x and y values */ + /** Value to assign to y within the specified zones. Defaults to `0`. */ value?: number; } /** * Set a value (default 0) to specific zones. - * @param data - Object that contains property x (an ordered increasing array) and y (an array) - * @param options - options - * @returns - Array of points + * @param data - object that contains property x (an ordered increasing array) and y (an array). + * @param options - options. + * @returns data with y values set to the given value in the specified zones. */ export function xySetYValue( data: DataXY, diff --git a/src/xy/xySortX.ts b/src/xy/xySortX.ts index 44d3da90..baf0c9e2 100644 --- a/src/xy/xySortX.ts +++ b/src/xy/xySortX.ts @@ -4,7 +4,7 @@ import { xIsMonotonic } from '../x/index.ts'; /** * This function performs a quick sort of the x array while transforming the y array to preserve the coordinates. - * @param data - Object that contains property x (Array) and y (Array) + * @param data - object that contains property x (Array) and y (Array). */ export function xySortX(data: DataXY): DataXY { const { x, y } = data; diff --git a/src/xy/xyToInterleaved.ts b/src/xy/xyToInterleaved.ts index 30330d79..6de5b39b 100644 --- a/src/xy/xyToInterleaved.ts +++ b/src/xy/xyToInterleaved.ts @@ -5,7 +5,7 @@ import { xyCheck } from './xyCheck.ts'; /** * Convert a DataXY object to a flat interleaved array [x, y, x, y, ...]. * @param data - DataXY object with x and y arrays. - * @returns Flat array alternating x and y values. + * @returns flat array alternating x and y values. */ export function xyToInterleaved(data: DataXY): Float64Array { xyCheck(data); diff --git a/src/xy/xyToXYObject.ts b/src/xy/xyToXYObject.ts index 8e8cbc69..a6795158 100644 --- a/src/xy/xyToXYObject.ts +++ b/src/xy/xyToXYObject.ts @@ -5,8 +5,8 @@ import type { Point } from '../types/index.ts'; import { xyCheck } from './xyCheck.ts'; /** - * xyToXYObject. - * @param data - Array of points {x,y}. + * Converts a DataXY object to an array of {x,y} point objects. + * @param data - array of points {x,y}. */ export function xyToXYObject(data: DataXY): Point[] { xyCheck(data); diff --git a/src/xy/xyUniqueX.ts b/src/xy/xyUniqueX.ts index d03549e4..98d53223 100644 --- a/src/xy/xyUniqueX.ts +++ b/src/xy/xyUniqueX.ts @@ -19,8 +19,8 @@ export interface XYUniqueXOptions { /** * Ensure x values are unique - * @param data - Object that contains property x (Array) and y (Array) - * @param options - Object containing a property algorithm (can be 'sum' or 'average', the latter being the default value), and a property isSorted (boolean indicating if the x-array is sorted). + * @param data - object that contains property x (Array) and y (Array). + * @param options - object containing a property algorithm (can be 'sum' or 'average', the latter being the default value), and a property isSorted (boolean indicating if the x-array is sorted). */ export function xyUniqueX( data: DataXY, @@ -49,9 +49,9 @@ export function xyUniqueX( } /** - * Average. - * @param data - Input. - * @returns Result. + * Averages duplicate x values by averaging their y values. + * @param data - input. + * @returns result. */ function average(data: DataXY): DataXY { const x: number[] = []; @@ -74,9 +74,9 @@ function average(data: DataXY): DataXY { } /** - * Sum. - * @param data - Input. - * @returns Result. + * Merges duplicate x values by summing their y values. + * @param data - input. + * @returns result. */ function sum(data: DataXY): DataXY { const x: number[] = []; diff --git a/src/xyArray/utils/getSlots.ts b/src/xyArray/utils/getSlots.ts index 8a01c77a..c64f7834 100644 --- a/src/xyArray/utils/getSlots.ts +++ b/src/xyArray/utils/getSlots.ts @@ -17,9 +17,9 @@ export interface Slot { } /** - * GetSlots. + * Computes common x slots from multiple DataXY spectra by grouping nearby x values. * @param data - data. - * @param options - Options. + * @param options - options. */ export function getSlots( data: DataXY[], diff --git a/src/xyArray/utils/getSlotsToFirst.ts b/src/xyArray/utils/getSlotsToFirst.ts index 025ddf0b..a0441bc6 100644 --- a/src/xyArray/utils/getSlotsToFirst.ts +++ b/src/xyArray/utils/getSlotsToFirst.ts @@ -17,9 +17,9 @@ export interface Slot { } /** - * GetSlotsToFirst. + * Computes slots aligned to the first spectrum's x values, adding slots for any x values not covered. * @param data - data. - * @param options - Options. + * @param options - options. */ export function getSlotsToFirst( data: DataXY[], diff --git a/src/xyArray/xyArrayAlign.ts b/src/xyArray/xyArrayAlign.ts index 104dde63..64dbc1a7 100644 --- a/src/xyArray/xyArrayAlign.ts +++ b/src/xyArray/xyArrayAlign.ts @@ -21,7 +21,7 @@ export interface XYArrayAlignOptions { /** * Aligns data, can be used for spectra * @param data - data - * @param options - Options + * @param options - options. */ export function xyArrayAlign( data: DataXY[], diff --git a/src/xyArray/xyArrayMerge.ts b/src/xyArray/xyArrayMerge.ts index 3bdb7837..8c8e1600 100644 --- a/src/xyArray/xyArrayMerge.ts +++ b/src/xyArray/xyArrayMerge.ts @@ -16,7 +16,7 @@ export interface XYArrayMergeOptions { * Merge DataXY * We have an array of DataXY and the goal is to merge all the values that are the closest possible * @param data - data - * @param options - Options + * @param options - options. */ export function xyArrayMerge( data: DataXY[], diff --git a/src/xyArray/xyArrayWeightedMerge.ts b/src/xyArray/xyArrayWeightedMerge.ts index d4685c78..60139d4c 100644 --- a/src/xyArray/xyArrayWeightedMerge.ts +++ b/src/xyArray/xyArrayWeightedMerge.ts @@ -15,7 +15,7 @@ export interface XYArrayWeightedMergeOptions { * We have an array of DataXY and the goal is to merge all the values for which the deltaX is small or equal to delta. * X values are weighted average * @param data - data - * @param options - Options + * @param options - options. */ export function xyArrayWeightedMerge( data: DataXY[], @@ -68,10 +68,10 @@ export function xyArrayWeightedMerge( } /** - * NextValue. + * Finds the next minimum x value across all spectra and advances the corresponding position pointer. * @param data - data. - * @param positions - Positions array. - * @param point - Point. + * @param positions - positions array. + * @param point - point. */ function nextValue(data: DataXY[], positions: NumberArray, point: Point) { let minIndex = 0; diff --git a/src/xyObject/xyObjectBestPoints.ts b/src/xyObject/xyObjectBestPoints.ts index ce34b28a..8582cacc 100644 --- a/src/xyObject/xyObjectBestPoints.ts +++ b/src/xyObject/xyObjectBestPoints.ts @@ -44,8 +44,8 @@ export interface XYObjectBestPointsOptions { * Keep one per slot. There are 2 different slots, the smallest one will have the * new property `close` to true * @param points - array of all the points - * @param options - Options - * @returns - copy of points with 'close' property + * @param options - options. + * @returns copy of points with 'close' property. */ export function xyObjectBestPoints( points: Point[], diff --git a/src/xyObject/xyObjectCheck.ts b/src/xyObject/xyObjectCheck.ts index 19ac4454..91ea9721 100644 --- a/src/xyObject/xyObjectCheck.ts +++ b/src/xyObject/xyObjectCheck.ts @@ -11,8 +11,8 @@ export interface XYObjectCheckOptions { /** * Throws an error if it's not an array of x,y objects. * Only checks the first element. - * @param points - List of points. - * @param options - Additional checks. + * @param points - list of points. + * @param options - additional checks. */ export function xyObjectCheck( points?: Point[], diff --git a/src/xyObject/xyObjectJoinX.ts b/src/xyObject/xyObjectJoinX.ts index a60b057b..84614b4c 100644 --- a/src/xyObject/xyObjectJoinX.ts +++ b/src/xyObject/xyObjectJoinX.ts @@ -9,9 +9,9 @@ export interface XYObjectJoinXOptions { } /** - * xyObjectJoinX. - * @param points - Array of growing points {x,y}. - * @param options - Options. + * Joins points whose x values are within xError of each other using weighted averaging. + * @param points - array of growing points {x,y}. + * @param options - options. */ export function xyObjectJoinX( points: Point[], diff --git a/src/xyObject/xyObjectMaxXPoint.ts b/src/xyObject/xyObjectMaxXPoint.ts index 155b9ed8..bdfa958f 100644 --- a/src/xyObject/xyObjectMaxXPoint.ts +++ b/src/xyObject/xyObjectMaxXPoint.ts @@ -4,7 +4,7 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Finds the max x value and return a {x,y,index} point - * @param points - Object that contains property x (an ordered increasing array) and y (an array) + * @param points - object that contains property x (an ordered increasing array) and y (an array). */ export function xyObjectMaxXPoint(points: Point[] = []): Point { xyObjectCheck(points); diff --git a/src/xyObject/xyObjectMaxYPoint.ts b/src/xyObject/xyObjectMaxYPoint.ts index c6baa45e..91ca6dc0 100644 --- a/src/xyObject/xyObjectMaxYPoint.ts +++ b/src/xyObject/xyObjectMaxYPoint.ts @@ -4,8 +4,8 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Finds the max y value and return a {x,y,index} point - * @param points - Object that contains property x (an ordered increasing array) and y (an array) - * @returns max point + * @param points - object that contains property x (an ordered increasing array) and y (an array). + * @returns max point. */ export function xyObjectMaxYPoint(points: Point[] = []): Point { xyObjectCheck(points); diff --git a/src/xyObject/xyObjectMinMaxValues.ts b/src/xyObject/xyObjectMinMaxValues.ts index c2a3ee4f..5a57c066 100644 --- a/src/xyObject/xyObjectMinMaxValues.ts +++ b/src/xyObject/xyObjectMinMaxValues.ts @@ -4,8 +4,8 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Returns all min and max values of an array of points. - * @param points - Array of points {x,y}. - * @returns - Object with the 4 extrema. + * @param points - array of points {x,y}. + * @returns object with the 4 extrema. */ export function xyObjectMinMaxValues(points: Point[]): { minX: number; diff --git a/src/xyObject/xyObjectMinXPoint.ts b/src/xyObject/xyObjectMinXPoint.ts index 7780ef6b..992ecaa4 100644 --- a/src/xyObject/xyObjectMinXPoint.ts +++ b/src/xyObject/xyObjectMinXPoint.ts @@ -4,7 +4,7 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Finds the min x value and return a {x,y,index} point - * @param points - Object that contains property x (an ordered increasing array) and y (an array) + * @param points - object that contains property x (an ordered increasing array) and y (an array). */ export function xyObjectMinXPoint(points: Point[] = []): Point { xyObjectCheck(points); diff --git a/src/xyObject/xyObjectMinYPoint.ts b/src/xyObject/xyObjectMinYPoint.ts index 887e3831..028e3cea 100644 --- a/src/xyObject/xyObjectMinYPoint.ts +++ b/src/xyObject/xyObjectMinYPoint.ts @@ -4,7 +4,7 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Finds the min y value and return a {x,y,index} point - * @param points - Object that contains property x (an ordered increasing array) and y (an array) + * @param points - object that contains property x (an ordered increasing array) and y (an array). */ export function xyObjectMinYPoint(points: Point[] = []): Point { xyObjectCheck(points); diff --git a/src/xyObject/xyObjectNormedY.ts b/src/xyObject/xyObjectNormedY.ts index abdd9fd7..ae7dcfc7 100644 --- a/src/xyObject/xyObjectNormedY.ts +++ b/src/xyObject/xyObjectNormedY.ts @@ -4,9 +4,9 @@ import { xNormed } from '../x/xNormed.ts'; /** * Resize the Y values of the points to be normalized. - * @param points - array of points {x,y} - * @param options - * @returns - array of points {x,y} with normalized Y values + * @param points - array of points {x,y}. + * @param options - options. + * @returns array of points {x,y} with normalized Y values. */ export function xyObjectNormedY( points: Point[], diff --git a/src/xyObject/xyObjectSlotX.ts b/src/xyObject/xyObjectSlotX.ts index f5fbc62e..003b9670 100644 --- a/src/xyObject/xyObjectSlotX.ts +++ b/src/xyObject/xyObjectSlotX.ts @@ -9,9 +9,9 @@ export interface XYObjectSlotXOptions { } /** - * xyObjectSlotX - * @param points - Array of growing points {x,y}. - * @param options - Options. + * Slots growing points into fixed-width buckets and sums their y values. + * @param points - array of growing points {x,y}. + * @param options - options. */ export function xyObjectSlotX( points: Point[], diff --git a/src/xyObject/xyObjectSortX.ts b/src/xyObject/xyObjectSortX.ts index a7bb91b2..95787951 100644 --- a/src/xyObject/xyObjectSortX.ts +++ b/src/xyObject/xyObjectSortX.ts @@ -2,8 +2,8 @@ import type { Point } from '../types/index.ts'; /** * Sorts an array of points in-place. - * @param points - array of points {x,y} - * @returns - sorted array of points {x,y} + * @param points - array of points {x,y}. + * @returns sorted array of points {x,y}. */ export function xyObjectSortX(points: Point[]): Point[] { points.sort((a, b) => a.x - b.x); diff --git a/src/xyObject/xyObjectSumY.ts b/src/xyObject/xyObjectSumY.ts index 36307a3c..8e3ba6cc 100644 --- a/src/xyObject/xyObjectSumY.ts +++ b/src/xyObject/xyObjectSumY.ts @@ -4,7 +4,7 @@ import { xyObjectCheck } from './xyObjectCheck.ts'; /** * Calculate the sum of Y values. - * @param points - Object that contains property x and y (an array) + * @param points - object that contains property x and y (an array). */ export function xyObjectSumY(points: Point[] = []): number { xyObjectCheck(points); diff --git a/src/xyObject/xyObjectToXY.ts b/src/xyObject/xyObjectToXY.ts index cfd9479c..3c44a0d2 100644 --- a/src/xyObject/xyObjectToXY.ts +++ b/src/xyObject/xyObjectToXY.ts @@ -3,8 +3,8 @@ import type { DataXY } from 'cheminfo-types'; import type { Point } from '../types/index.ts'; /** - * xyObjectToXY. - * @param points - Array of points {x,y}. + * Converts an array of {x,y} point objects to a DataXY object. + * @param points - array of {x,y} point objects. */ export function xyObjectToXY(points: Point[]): DataXY { return {