Nanodrop.Mode protocol
(nanodrop v0.3.1)
Copy Markdown
Protocol for measurement modes (DNA, Protein, etc.).
Each mode defines how to extract metadata from a spectrum and generate SVG overlays for visualization.
Summary
Functions
Find the absorbance value at a specific wavelength.
Extract metadata from a spectrum for this mode.
Generate SVG overlay elements from metadata.
Safely compute a ratio, returning nil if denominator is zero or near-zero.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
Find the absorbance value at a specific wavelength.
If the spectrum has :corrected_absorbance, uses that. Otherwise uses :absorbance.
Extract metadata from a spectrum for this mode.
Returns a map of key-value pairs. Keys starting with underscore
are considered private/internal (e.g., _baseline, _corrected_absorbance).
Generate SVG overlay elements from metadata.
The context map contains:
:scale_x- function to convert wavelength to x pixel:scale_y- function to convert absorbance to y pixel:x_off,:y_off- chart offsets:width,:height- chart dimensions
Returns an SVG string to be inserted into the graph.
Safely compute a ratio, returning nil if denominator is zero or near-zero.