Data and Model — interact_fit 0.0.1 documentation

# Data and Model

Classes to deal with input data

class `data_model.` `Data`(x, y, yerr, mask=[])

  Class for input data

  Stores input data from user

  Parameters

    - x (array) – x data

    - y (array) – y data

    - yerr (array) – errors on y data

    - mask (array) – True where to include data, False otherwise

class `data_model.` `Fit`(Data_object, Model_object)

  Class to perform a fit

  Fit the data with a specified model

  Parameters

    - Data_object (class) – a data object

    - Model_object (class) – a model object

  `run_fit`()

    Run fit

    Performs a fit to the data with a minimization routine, currently uses scipy curve_fit

    Returns

      The best fit model popt (array): The best fit parameter values for the fitting function x_model (array): The x array of the model

    Return type

      y_model (array)

class `data_model.` `Model`(function_type, init_guess=[], poly_deg=4)

  Class for model

  Generates a model for fitting the data. Currently supports polynomials of arbitrary degreee

  Parameters

    - function_type (string) – type of fitting function. Options are: poly

    - init_guess (list) – initial guesses for fit

    - poly_deg (int) – degree of the polynomial

  static `arbitrary_poly`(x, *params)

    Make a polynomial function

    Function called by minimization routine to create polynomial

    Parameters

      - x (array) – array of x values to compute poly model

      - params (array) – array of polynomial indices

    Returns

      The polynomial model

  `change_degree`(new_degree)

    Change polynomial degree

    Function to change degree of the fitting polynomial

    Parameters

      new_degree (int) – the specified degree of polynomial