skultrafast.fitter ================== .. py:module:: skultrafast.fitter Attributes ---------- .. autoapisummary:: skultrafast.fitter.posv skultrafast.fitter.LinAlgError skultrafast.fitter.alpha Classes ------- .. autoapisummary:: skultrafast.fitter.Fitter Functions --------- .. autoapisummary:: skultrafast.fitter.direct_solve skultrafast.fitter.solve_mat Module Contents --------------- .. py:data:: posv .. py:data:: LinAlgError .. py:function:: direct_solve(a, b) .. py:data:: alpha :value: 0.001 .. py:function:: solve_mat(A, b_mat, method='ridge') Returns the solution for the least squares problem |Ax - b_i|^2. .. py:class:: Fitter(tup, model_coh=False, model_disp=1) Bases: :py:obj:`object` The fit object, takes all the need data and allows to fit it. There a two different methods to fit the data. The fast one assumes, that the data has no dispersion, so the base vectors are the same for each channel. It is recommended to first work with the fast version. Note that the fast version is able to handle dispersion by using linear interpolation to transform the data to dispersion free data. The slower version calculates the base vector for each channel, in which the dispersion is integrated. The slower methods using the prefix full. :param wl: Array containing the wavelength-coordinates. :type wl: ndarray(M) :param t: Array containing the time-coordinates. :type t: ndarray(N) :param data: The 2d-data to fit. :type data: ndarry(N,M) :param model_coh: If the model contains coherent artifacts at the time zero, defaults to False. :type model_coh: bool :param model_disp: Degree of the polynomial which models the dispersion. If 1, only a offset is modeled, which is very fast. :type model_disp: int .. py:attribute:: t .. py:attribute:: wl .. py:attribute:: data .. py:attribute:: verbose :value: False .. py:attribute:: model_coh :value: False .. py:attribute:: model_disp :value: 1 .. py:attribute:: lsq_method :value: 'ridge' .. py:attribute:: num_exponentials :value: -1 .. py:attribute:: weights :value: None .. py:method:: make_model(para) Calculates the model for given parameters. After calling, the DAS is at self.c, the model at self.model. If the dispersion is modeled, it is done via linear interpolation. This way, the base- vectors and their decomposition are only calculated once. :param para: para has the following form: [p_0, ..., p_M, w, tau_1, ..., tau_N] Where p are the coefficients of the dispersion polynomial, w is the width of the system response and tau are the decay times. M is equal to self.model_disp. :type para: ndarray(N) .. py:method:: _chk_for_disp_change(para) .. py:method:: _build_xvec(para) Build the base (the folded functions) for given parameters. .. py:method:: res(para) Return the residuals for given parameters using the same basevector for each channel. See make_model for para format. .. py:method:: full_res(para) Return the residuals for given parameter modelling each channel for it own. .. py:method:: make_full_model(para) Calculates the model for given parameters. After calling, the DAS is at self.c, the model at self.model. :param para: para has the following form: [p_0, ..., p_M, w, tau_1, ..., tau_N] Where p are the coefficients of the dispersion polynomial, w is the width of the system response and tau are the decay times. M is equal to self.model_disp. :type para: ndarray(N) .. py:method:: _build_xmat(para, is_disp_changed) Builds the basevector for every channel. The vectors are save self.xmat. .. py:method:: _check_num_expontials(para) Check if num_exp changed and allocate space as necessary. .. py:method:: res_sum(para) Returns the squared sum of the residuals for given parameters .. py:method:: start_lmfit(x0, fixed_names=[], lower_bound=0.3, fix_long=True, fix_disp=False, full_model=1)