``fit`` ================================== .. py:module:: optimeed.consolidate.fit Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: optimeed.consolidate.fit._Device optimeed.consolidate.fit._Objective Functions ~~~~~~~~~ .. autoapisummary:: optimeed.consolidate.fit.leastSquare optimeed.consolidate.fit.r_squared optimeed.consolidate.fit.do_fit .. py:class:: _Device(fitFunction, nbArgs) .. py:class:: _Objective(x_data, y_data, fitCriterion) Bases: :py:obj:`optimeed.optimize.InterfaceObjCons` Interface class for objectives and constraints. The objective is to MINIMIZE and the constraint has to respect VALUE <= 0 .. py:method:: compute(theDevice) Get the value of the objective or the constraint. The objective is to MINIMIZE and the constraint has to respect VALUE <= 0 :param theDevice: Input device that has already been evaluated :return: float. .. py:function:: leastSquare(function, functionArgs, x_data, y_data) Least square calculation (sum (y-ลท)^2) :param function: Function to fit :param functionArgs: Arguments of the function :param x_data: x-axis coordinates of data to fit :param y_data: y-axis coordinates of data to fit :return: least squares .. py:function:: r_squared(function, functionArgs, x_data, y_data) R squared calculation :param function: Function to fit :param functionArgs: Arguments of the function :param x_data: x-axis coordinates of data to fit :param y_data: y-axis coordinates of data to fit :return: R squared .. py:function:: do_fit(fitFunction, x_data, y_data, *args, fitCriterion=leastSquare) Main method to fit a function :param fitFunction: the function to fit (link to it) :param x_data: x-axis coordinates of data to fit :param y_data: y-axis coordinates of data to fit :param args: for each parameter: [min, max] admissible value :param fitCriterion: fit criterion to minimize. Default: least square :return: [arg_i_optimal, ...], y estimated, error.