libgunshotmatch_mpl.combined_chromatogram

Combined “chromatogram” drawing functionality.

A bar chart for peak area/height styled as a chromatogram, with time on the x-axis.

New in version 0.5.0.

Classes:

CCPeak(area_or_height, area_or_height_list, …)

Data for a peak in a combined “chromatogram”.

Functions:

draw_combined_chromatogram(project, figure, …)

Draw a combined “chromatogram” for the project.

get_cc_peak(peak[, use_median, use_peak_height])

Return data on a peak for a combined “chromatogram”.

get_combined_chromatogram_data(project, *[, …])

Returns data for a combined “chromatogram” for the project.

get_y_label([use_median, use_peak_height])

Returns the appropriate label for the y-axis.

namedtuple CCPeak(area_or_height, area_or_height_list, rt, rt_list, errorbar)[source]

Bases: NamedTuple

Data for a peak in a combined “chromatogram”.

Fields
  1.  area_or_height (float) – Alias for field number 0

  2.  area_or_height_list (List[float]) – Alias for field number 1

  3.  rt (float) – Alias for field number 2

  4.  rt_list (List[float]) – Alias for field number 3

  5.  errorbar (Union[float, Tuple[List[float], List[float]]]) – Alias for field number 4

draw_combined_chromatogram(project, figure, ax, *, top_n_peaks=None, minimum_area=0, use_median=False, use_peak_height=False, show_points=False, colourmap=None)[source]

Draw a combined “chromatogram” for the project.

A bar chart for peak area/height styled as a chromatogram, with time on the x-axis.

Parameters
  • project (Project)

  • figure (Figure)

  • ax (Axes)

  • top_n_peaks (Optional[int]) – Show only the n largest peaks. Default None.

  • minimum_area (float) – Show only peaks larger than the given area (or peak height, as applicable). Default 0.

  • use_median (bool) – Show the median and inter-quartile range, rather than the mean and standard deviation. Default False.

  • use_peak_height (bool) – Show the peak height and not the peak area. Default False.

  • show_points (bool) – Show individual retention time / peak area scatter points. Default False.

  • colourmap (Union[Colormap, Callable[[float], Tuple[int, int, int, int]], None]) – Optional colourmap function for the bars. By default sequential bars are given colours from the default colour cycle. If colourmap is provided this function calculates the bar colour from the retention time. The function must return a tuple of RGBA values when given a float between 0 and 1. Default None.

New in version 0.2.0.

Changed in version 0.4.0: Added the use_median, use_peak_height and show_points keyword arguments.

Changed in version 0.5.0:
  • Moved to the combined_chromatogram module.

  • Y-axis label now reflects use_median and use_peak_height options.

get_cc_peak(peak, use_median=False, use_peak_height=False)[source]

Return data on a peak for a combined “chromatogram”.

Parameters
  • peak (ConsolidatedPeak)

  • use_median (bool) – Show the median and inter-quartile range, rather than the mean and standard deviation. Default False.

  • use_peak_height (bool) – Show the peak height and not the peak area. Default False.

Return type

CCPeak

get_combined_chromatogram_data(project, *, top_n_peaks=None, threshold=0, use_median=False, use_peak_height=False)[source]

Returns data for a combined “chromatogram” for the project.

Parameters
  • project (Project)

  • top_n_peaks (Optional[int]) – Show only the n largest peaks. Default None.

  • threshold (float) – Show only peaks larger than the given area (or peak height, as applicable). Default 0.

  • use_median (bool) – Show the median and inter-quartile range, rather than the mean and standard deviation. Default False.

  • use_peak_height (bool) – Show the peak height and not the peak area. Default False.

  • show_points – Show individual retention time / peak area scatter points.

Return type

List[CCPeak]

get_y_label(use_median=False, use_peak_height=False)[source]

Returns the appropriate label for the y-axis.

Parameters
  • use_median (bool) – Whether the combined chromatogram shows the median and inter-quartile range, rather than the mean and standard deviation. Default False.

  • use_peak_height (bool) – Whether the combined chromatogram shows the peak height and not the peak area. Default False.

Return type

str