ml-spectra-processing
    Preparing search index...

    Function xyMedian

    • Computes the weighted median of the x values, using the y values as weights. This is the x value that splits the total weight (sum of y) into two equal halves. If the cumulative weight lands exactly at 50%, the result is the average of the two surrounding x values.

      Parameters

      • data: DataXY

        x should be sorted in increasing order, y values are used as weights and should be non-negative.

      Returns number

      The weighted median x value, or NaN if the data is empty.