Peaks.PeakSimilarity#

Peaks.Similarity.py

Copyright (c) 2024, SAXS Team, KEK-PF

class PeakSimilarity(x, y1, y2, try_both_signs=False)#

Bases: object

A class to evaluate the similarity between two peaks by fitting one peak to another. It uses a scaling factor and a linear baseline (slope and intercept) to fit the first peak to the second peak.

objective#

The objective function to minimize, which computes the difference between the scaled and shifted first peak and the second peak.

Type:

function

results#

The results of the optimization for different initial conditions.

Type:

list of OptimizeResult

Initialize the PeakSimilarity object.

Parameters:
  • x (np.ndarray) – The x values of the peaks.

  • y1 (np.ndarray) – The y values of the first peak to be fitted.

  • y2 (np.ndarray) – The y values of the second peak to which the first peak is fitted.

  • try_both_signs (bool, optional) – If True, try both positive and negative scaling factors for the first peak. Default is False.

get_minimizer_result()#

Get the best minimizer result. :returns: The best result from the optimization. :rtype: OptimizeResult

get_stdratio()#

Get the standard deviation to scale ratio from the best minimizer result. :returns: The standard deviation to scale ratio. :rtype: float