backscatter.fitacf.leastsquares module

class backscatter.fitacf.leastsquares.LeastSquaresFitting(confidence, DoF)[source]

Bases: object

This class holds all the methods needed to fit rawacf data

This class holds methods for 1 parameter straight line fits, 2 parameter straight line fits, and 2 parameter quadratic fits.

find_chi_2(lst_sqrs, x_arr, y_arr, sigmas, fit_type)[source]

Computes the chi-square statistic of the fit

Parameters:
  • lst_sqrs – LeastSquaresValues object with parameters a and b

  • x_arr – array with x-axis data

  • y_arr – array with y-axis data

  • sigmas – weighting for y-axis data

  • fit_type – selects between ‘linear’ and ‘quadratic’ fits

find_sums(lst_sqrs, x_arr, y_arr, sigmas, fit_type)[source]

Computes the sums needed for linear least squares equations

Parameters:
  • lst_sqrs – LeastSquaresValues object to fill

  • x_arr – array with x-axis data

  • y_arr – array with y-axis data

  • sigmas – weighting for y-axis data

  • fit_type – selects between ‘linear’ and ‘quadratic’ fits

one_parameter_line_fit(x_arr, y_arr, sigmas, num_points)[source]

Computes a fit for the model y = bx

Parameters:
  • x_arr – array with x-axis data

  • y_arr – array with y-axis data

  • sigmas – weighting for y-axis data

  • num_points – number of data points

Returns:

LeastSquaresValues with computed values

quadratic_fit(x_arr, y_arr, sigmas, num_points)[source]

Computes a fit for the model y = bx^2 + a

Parameters:
  • x_arr – array with x-axis data

  • y_arr – array with y-axis data

  • sigmas – weighting for y-axis data

  • num_points – number of data points

Returns:

LeastSquaresValues with computed values

two_parameter_line_fit(x_arr, y_arr, sigmas, num_points)[source]

Computes a fit for the model y = bx + a

Parameters:
  • x_arr – array with x-axis data

  • y_arr – array with y-axis data

  • sigmas – weighting for y-axis data

  • num_points – number of data points

Returns:

LeastSquaresValues with computed values

class backscatter.fitacf.leastsquares.LeastSquaresValues[source]

Bases: object

This class simply holds all the least squares values associated with the fitting algorithm outlined in NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING