skultrafast.fitter

Module Contents

Classes

Fitter

The fit object, takes all the need data and allows to fit it.

Functions

direct_solve(a, b)

solve_mat(A, b_mat[, method])

Returns the solution for the least squares problem |Ax - b_i|^2.

Attributes

skultrafast.fitter.posv[source]
skultrafast.fitter.LinAlgError[source]
skultrafast.fitter.direct_solve(a, b)[source]
skultrafast.fitter.alpha = 0.001[source]
skultrafast.fitter.solve_mat(A, b_mat, method='ridge')[source]

Returns the solution for the least squares problem |Ax - b_i|^2.

class skultrafast.fitter.Fitter(tup, model_coh=False, model_disp=1)[source]

Bases: 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.

Parameters:
  • wl (ndarray(M)) – Array containing the wavelength-coordinates.

  • t (ndarray(N)) – Array containing the time-coordinates.

  • data (ndarry(N,M)) – The 2d-data to fit.

  • model_coh (bool) – If the model contains coherent artifacts at the time zero, defaults to False.

  • model_disp (int) – Degree of the polynomial which models the dispersion. If 1, only a offset is modeled, which is very fast.

make_model(para)[source]

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.

Parameters:

para (ndarray(N)) –

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.

_chk_for_disp_change(para)[source]
_build_xvec(para)[source]

Build the base (the folded functions) for given parameters.

res(para)[source]

Return the residuals for given parameters using the same basevector for each channel. See make_model for para format.

full_res(para)[source]

Return the residuals for given parameter modelling each channel for it own.

make_full_model(para)[source]

Calculates the model for given parameters. After calling, the DAS is at self.c, the model at self.model.

Parameters:

para (ndarray(N)) –

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.

_build_xmat(para, is_disp_changed)[source]

Builds the basevector for every channel. The vectors are save self.xmat.

_check_num_expontials(para)[source]

Check if num_exp changed and allocate space as necessary.

res_sum(para)[source]

Returns the squared sum of the residuals for given parameters

start_lmfit(x0, fixed_names=[], lower_bound=0.3, fix_long=True, fix_disp=False, full_model=1)[source]