1. analysis

pyIMD.analysis.curve_fit.fit_function(x, fn, q, a, b)

Defines the phase response of a damped harmonic oscillator (i.e. the cantilever with or without cell). It is called from calculate_resonance_frequencies, to be fitted to the data primarily to extract the natural resonance frequency.

Parameters:
  • x (float) – Frequency (the independent variable of that function)
  • fn (float) – Natural resonance frequency
  • q (float) – Q factor (losses)
  • a (float) – Linear factor accounting for a linear background
  • b (float) – Constant Phase-Offset
Returns:

Returns the phase.

Return type:

phase (float)

pyIMD.analysis.calculations.calculate_mass(spring_constant, res_freq_after_cell_load, res_freq_before_cell_load)

Calculates the mass given the spring constant of the cantilever and the resonance frequency without and with cell attached to the cantilever.

Args:

spring_constant (float): Stiffness of the cantilever [in N/m] res_freq_after_cell_load (float): Resonance frequency of the cantilever AFTER the cell is picked up, at time point t [in kHz] res_freq_before_cell_load (float): Resonance frequency of the cantilever BEFORE the cell is picked up [in kHz]

Returns: mass (float): Returns data as float, which is the mass at time point t.

pyIMD.analysis.calculations.calculate_position_correction(cell_position, cantilever_length)

Calculates the correction factor with which the measured mass needs to be multiplied to get all the mass present on the cantilever. This is needed as the cantilever is differently sensitive to mass, depending on the location where this mass is attached. The measurements are performed with the first mode of vibration, which is described by the factor kL = 1.875. For higher modes, different would be used (4.694 for the second , 7.855 for the third etc.)

Parameters:
  • cell_position (float) – Cell position from the free end of the cantilever [in micrometer]
  • cantilever_length (float) – Cantilever length [in micrometer]
Returns:

Returns a double which is the correction factor.

Return type:

correction_factor (float)

pyIMD.analysis.calculations.calculate_resonance_frequencies(frequency_array, phase_array, initial_param_guess, lower_param_bounds, upper_param_bounds)
Calculate_resonance_frequencies calculates the resonance frequency
from input frequency and phase array. It does so via fitting the phase response of a harmonic oscillator (defined in pyIMD.analysis.curve_fit). The first fit parameter of the fit parameter array is the resonance frequency.
Parameters:
  • frequency_array (float array) – Array of frequencies [in kHz]
  • phase_array (float array) – Array of phase [in Rad]
  • initial_param_guess (float) – Initial parameter guess (1x4 array)
  • lower_param_bounds (float) – Lower bounds (1x4 array)
  • upper_param_bounds (float) – Upper bounds (1x4 array)
Returns:

Resonance frequency [in kHz]

Return type:

resonance_frequency (float)

Returns:

Curve fit parameters

curve_fit_parameter[0] := Q factor (losses)

curve_fit_parameter[1] := Linear factor accounting for a linear background

curve_fit_parameter[2] := Offset of the background

Return type:

curve_fit_parameter (float array)