cedalion.nirs
Functions for preliminary processing of near-infrared spectroscopy (NIRS) data.
Functions
|
Calculate concentration changes from amplitude using the modified BL law. |
|
Calculate distances between channels. |
|
Calculate optical density data from concentration changes. |
|
Provide a matrix of extinction coefficients from tabulated data. |
|
Calculate optical density from intensity amplitude data. |
|
Calculate concentration changes from optical density data. |
|
Split a time series into two based on channel distances. |
- cedalion.nirs.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/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.channel_distances(amplitudes: cdt.NDTimeSeries, geo3d: cdt.LabeledPointCloud)[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.int2od(amplitudes: cdt.NDTimeSeries)[source]
Calculate optical density from intensity amplitude data.
- Parameters:
amplitudes (xr.DataArray, (time, channel, *)) – amplitude data.
- Returns:
(xr.DataArray, (time, channel,*): The optical density data.
- Return type:
od
- cedalion.nirs.od2conc(
- od: cdt.NDTimeSeries,
- geo3d: cdt.LabeledPointCloud,
- dpf: DataArray,
- spectrum: str = 'prahl',
Calculate concentration changes from optical density data.
- Parameters:
od (xr.DataArray, (channel, wavelength, *)) – The optical density data array
geo3d (xr.DataArray) – The 3D coordinates of the optodes.
dpf (xr.DataArray, (wavelength, *)) – The differential pathlength factor data
spectrum (str, optional) – The type of spectrum to use for calculating extinction coefficients. Defaults to “prahl”.
- Returns:
A data array containing concentration changes by channel.
- Return type:
conc (xr.DataArray, (channel, *))
- cedalion.nirs.conc2od(
- conc: cdt.NDTimeSeries,
- geo3d: cdt.LabeledPointCloud,
- dpf: DataArray,
- spectrum: str = 'prahl',
Calculate optical density data from concentration changes.
- Parameters:
conc (xr.DataArray, (channel, *)) – The concentration changes by channel.
geo3d (xr.DataArray) – The 3D coordinates of the optodes.
dpf (xr.DataArray, (wavelength, *)) – The differential pathlength factor data.
spectrum (str, optional) – The type of spectrum to use for calculating extinction coefficients. Defaults to “prahl”.
- Returns:
- A data array containing
optical density data.
- Return type:
od (xr.DataArray, (channel, wavelength, *))
- cedalion.nirs.beer_lambert(
- amplitudes: cdt.NDTimeSeries,
- geo3d: cdt.LabeledPointCloud,
- dpf: DataArray,
- spectrum: str = 'prahl',
Calculate concentration changes from amplitude using the modified BL law.
- Parameters:
amplitudes (xr.DataArray, (channel, wavelength, *)) – The input data array containing the raw intensities.
geo3d (xr.DataArray) – The 3D coordinates of the optodes.
dpf (xr.DataArray, (wavelength,*)) – The differential pathlength factors
spectrum (str, optional) – The type of spectrum to use for calculating extinction coefficients. Defaults to “prahl”.
- Returns:
- A data array containing
concentration changes according to the mBLL.
- Return type:
conc (xr.DataArray, (channel, *))
- cedalion.nirs.split_long_short_channels(
- ts: cdt.NDTimeSeries,
- geo3d: cdt.LabeledPointCloud,
- distance_threshold: cdt.QLength = <Quantity(1.5,
- 'centimeter')>,
Split a time series into two based on channel distances.
- Parameters:
ts (cdt.NDTimeSeries) – Time series to split.
geo3d (cdt.LabeledPointCloud) – 3D coordinates of the channels.
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