Nanodrop.Spectrum (nanodrop v0.3.1)

Copy Markdown

Absorbance spectrum data structure.

Contains wavelengths (nm) and corresponding absorbance values, calculated from raw intensity data using Beer-Lambert law:

A = -log10((sample - dark) / (blank - dark))

Summary

Functions

Returns the absorbance at a specific wavelength (nearest match).

Filters the spectrum to a wavelength range.

Creates a spectrum from wavelength and absorbance lists.

Finds the wavelength with maximum absorbance.

Returns the number of data points.

Subtracts baseline values from absorbance.

Returns the wavelength range as {min, max}.

Types

t()

@type t() :: %Nanodrop.Spectrum{
  absorbance: [float()],
  timestamp: DateTime.t() | nil,
  wavelengths: [float()]
}

Functions

absorbance_at(spectrum, target_wavelength)

@spec absorbance_at(t(), float()) :: float()

Returns the absorbance at a specific wavelength (nearest match).

filter_range(spectrum, min_wl, max_wl)

@spec filter_range(t(), float(), float()) :: t()

Filters the spectrum to a wavelength range.

new(wavelengths, absorbance)

@spec new([float()], [float()]) :: t()

Creates a spectrum from wavelength and absorbance lists.

peak_wavelength(spectrum)

@spec peak_wavelength(t()) :: float()

Finds the wavelength with maximum absorbance.

size(spectrum)

@spec size(t()) :: non_neg_integer()

Returns the number of data points.

subtract(spectrum, baseline)

@spec subtract(t(), t() | [float()]) :: t()

Subtracts baseline values from absorbance.

Accepts either another Spectrum or a list of values.

wavelength_range(spectrum)

@spec wavelength_range(t()) :: {float(), float()}

Returns the wavelength range as {min, max}.