Linear Fit routine. This will allow errors on the Y values, and will report chi squared. Borrowed from pamguard, https://sourceforge.net/projects/pamguard/.
return the result A of the fit y = A + B * x
return the result B of the fit y = A + B * x
return Chi-Squared result from the fit.
return the intercept as a datum with units of y.
return the slope as a datum with units of Yunits/Xunits. Note the current version of the library is unable to do many unit calculations.