toolbox_scs.routines.knife_edge

Toolbox for SCS.

Various utilities function to quickly process data measured at the SCS instrument.

Copyright (2019-) SCS Team.

Module Contents

Functions

knife_edge(ds[, axisKey, signalKey, axisRange, p0, ...])

Calculates the beam radius at 1/e^2 from a knife-edge scan by

toolbox_scs.routines.knife_edge.knife_edge(ds, axisKey='scannerX', signalKey='FastADC4peaks', axisRange=None, p0=None, full=False, plot=False, display=False)[source]

Calculates the beam radius at 1/e^2 from a knife-edge scan by fitting with erfc function: f(x, x0, w0, a, b) = a*erfc(np.sqrt(2)*(x-x0)/w0) + b with w0 the beam radius at 1/e^2 and x0 the beam center.

Parameters:
  • ds (xarray Dataset) – dataset containing the detector signal and the motor position.

  • axisKey (str) – key of the axis against which the knife-edge is performed.

  • signalKey (str) – key of the detector signal.

  • axisRange (list of floats) – edges of the scanning axis between which to apply the fit.

  • p0 (list of floats, numpy 1D array) – initial parameters used for the fit: x0, w0, a, b. If None, a beam radius of 100 micrometers is assumed.

  • full (bool) – If False, returns the beam radius and standard error. If True, returns the popt, pcov list of parameters and covariance matrix from scipy.optimize.curve_fit.

  • plot (bool) – If True, plots the data and the result of the fit. Default is False.

  • display (bool) – If True, displays info on the fit. True when plot is True, default is False.

Returns:

error from the fit in mm. If full is True, returns parameters and covariance matrix from scipy.optimize.curve_fit function.

Return type:

If full is False, tuple with beam radius at 1/e^2 in mm and standard