cedalion.nirs.common

Functions

channel_distances(amplitudes, geo3d)

Calculate distances between channels.

get_extinction_coefficients(spectrum, ...)

Provide a matrix of extinction coefficients from tabulated data.

split_long_short_channels(ts, geo3d[, ...])

Split a time series into two based on channel distances.

cedalion.nirs.common.get_extinction_coefficients(spectrum: str, wavelengths: ArrayLike)[source]

Provide a matrix of extinction coefficients from tabulated data.

Parameters:
  • spectrum

    The type of spectrum to use. Currently supported options are:

    • ”prahl”: Extinction coefficients based on the Prahl absorption spectrum (Prahl1998).

  • wavelengths – An array-like object containing the wavelengths at which to calculate the extinction coefficients.

Returns:

A matrix of extinction coefficients with dimensions “chromo”

(chromophore, e.g. HbO/HbR) and “wavelength” (e.g. 750, 850, …) at which the coefficients for each chromophore are given in units of “mm^-1 / M”.

Return type:

xr.DataArray

References

(Prahl 1998) - taken from Homer2/3, Copyright 2004 - 2006 - The General Hospital Corporation and President and Fellows of Harvard University.

“These values for the molar extinction coefficient e in [cm-1/(moles/liter)] were compiled by Scott Prahl (prahl@ece.ogi.edu) using data from W. B. Gratzer, Med. Res. Council Labs, Holly Hill, London N. Kollias, Wellman Laboratories, Harvard Medical School, Boston To convert this data to absorbance A, multiply by the molar concentration and the pathlength. For example, if x is the number of grams per liter and a 1 cm cuvette is being used, then the absorbance is given by

  1. [(1/cm)/(moles/liter)] (x) [g/liter] (1) [cm]

A = —————————————————

66,500 [g/mole]

using 66,500 as the gram molecular weight of hemoglobin. To convert this data to absorption coefficient in (cm-1), multiply by the molar concentration and 2.303, µa = (2.303) e (x g/liter)/(66,500 g Hb/mole) where x is the number of grams per liter. A typical value of x for whole blood is x=150 g Hb/liter.”

cedalion.nirs.common.channel_distances(amplitudes: cdt.NDTimeSeries, geo3d: cdt.LabeledPoints)[source]

Calculate distances between channels.

Parameters:
  • amplitudes – A DataArray representing the amplitudes with dimensions (channel, *).

  • geo3d (xr.DataArray) – A DataArray containing the 3D coordinates of the channels with dimensions (channel, pos).

Returns:

A DataArray containing the calculated distances between

source and detector channels. The resulting DataArray has the dimension ‘channel’.

Return type:

dists (xr.DataArray)

cedalion.nirs.common.split_long_short_channels(
ts: cdt.NDTimeSeries,
geo3d: cdt.LabeledPoints,
distance_threshold: cdt.QLength = <Quantity(1.5,
'centimeter')>,
)[source]

Split a time series into two based on channel distances.

Parameters:
  • ts (cdt.NDTimeSeries) – Time series to split.

  • geo3d (cdt.LabeledPoints) – 3D coordinates of the optodes.

  • distance_threshold (Quantity) – Distance threshold for splitting the channels.

Returns:

time series with channel distances >= distance_threshold ts_short : time series with channel distances < distance_threshold

Return type:

ts_long