4. plotting

pyIMD.plotting.figures.create_montage_array(img_stack, size)

Creates an image montage of a 3D numpy array with the shape [image frames, image row, image col] for the specified size.

Parameters:
  • img_stack (3D numpy array) – 3D numpy image array [image row, image col, image frames].
  • size (numpy array) – Array specifying the amount of images displayed in the montage per row and column. If one argument is replaced with np.nan, the needed amount of rows or columns is calculated automatically. E. g. [5, np.nan]
Returns:

2D numpy array with the image montage

Return type:

montage (2D numpy array)

pyIMD.plotting.figures.get_montage_array_size(size, image_row_count, image_col_count, frame_count)

Calculates the final size of a numpy array needed to hold a the number of specified image frames given the row and column count of the final array.

Parameters:
  • size (numpy array) – Array specifying the amount of images displayed in the montage per row and column. If one argument is replaced with np.nan, the needed amount of rows or columns is calculated automatically. E. g. [5, np.nan]
  • image_row_count (int) – Number of rows per image
  • image_col_count (int) – Number of columns per image
  • frame_count (int) – Number of image frames in the stack
Returns:

Array with the number of rows and columns needed in the montage array for the images

Return type:

montage_size (numpy array)

pyIMD.plotting.figures.plot_fitting(x, y, resonance_frequency, parameter)

Plots the phase response and the corresponding fit of the harmonic damped oscillator.

Parameters:
  • x (float array) – X coordinates (frequency in kHz)
  • y (float array) – Y coordinates (phase in radians)
  • resonance_frequency (float array) – Resonance frequency given by the fit of x and y
  • parameter (float array) – Others parameters of function fit (Q factor, offset, linear background)
Returns:

Returns a ggplot object

Return type:

p (ggplot object)

pyIMD.plotting.figures.plot_mass(calculated_cell_mass, plot_every_nth_point)

Plots the resulting mass

Parameters:
  • calculated_cell_mass (pandas data frame) – Pandas data frame [Nx3] with time and calculated cell mass and rolling mean averaged cell mass
  • plot_every_nth_point (int) – If 1 all data points are plotted. Otherwise every nth data point is used for plotting.
Returns:

Returns a ggplot plot object

Return type:

p (ggplot object)

pyIMD.plotting.figures.plot_response_shift(x, y, resonance_frequency_without, parameter_without, xx, yy, resonance_frequency_with, parameter)

Plots the phase response of pre start data without and with cell attached to cantilever with the respective function fit.

Parameters:
  • x (float array) – X coordinates w/o cell (frequency in kHz)
  • y (float array) – Y coordinates w/o cell (phase in radians)
  • xx (float array) – X coordinates w/ cell(frequency in kHz)
  • yy (float array) – Y coordinates w/ cell (phase in radians)
  • resonance_frequency_without (float array) – Resonance frequency given by the fit of x and y w/o cell
  • resonance_frequency_with (float array) – Resonance frequency given by the fit of x and y w/ cell
  • parameter (float array) – Others parameters of function fit (Q factor, offset, linear background) w/o cell
  • parameter_without (float array) – Others parameters of function fit (Q factor, offset, linear background) w/ cell
Returns:

Returns a ggplot object

Return type:

p (ggplot object)