FunctionOptical Density
Syntax C/C++#include <VFmath.h>
int VF_OD( fVector OD, fVector X, fVector X0, ui size );
int VUS_ODtoF( fVector OD, usVector X, usVector X0, ui size );
C++ VecObj#include <OptiVec.h>
int vector<T>::OD( const vector<T>& X, const vector<T>& X0 );
int vector<flot>::ODtoF( const vector<unsigned>& X, const vector<unsigned>& X0 );
Pascal/Delphiuses VFmath;
function VF_OD( OD, X, X0:fVector; size:UIntSize ): IntBool;
function VUS_ODtoF( OD:fVector; X, X0:usVector; size:UIntSize ): IntBool;
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_OD( fVector d_OD, fVector d_X, fVector d_X0, ui size );
int cudaVUS_ODtoF( fVector d_OD, usVector d_X, usVector d_X0, ui size );
int VFcu_OD( fVector h_OD, fVector h_X, fVector h_X0, ui size );
int VUScu_ODtoF( fVector h_OD, usVector h_X, usVector h_X0, ui size );
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_OD( d_OD, d_X, d_X0:fVector; size:UIntSize ): IntBool;
function cudaVUS_ODtoF( d_OD:fVector; d_X, d_X0:usVector; size:UIntSize ): IntBool;
function VFcu_OD( h_OD, h_X, h_X0:fVector; size:UIntSize ): IntBool;
function VUScu_ODtoF( h_OD:fVector; h_X, h_X0:usVector; size:UIntSize ): IntBool;
DescriptionODi = log10( X0i/Xi ) for (X0i >= ODThresh0 & Xi >= ODThresh),
ODi = 0.0 otherwise
The "optical density" is calculated for positive, non-zero input numbers. By default, ODThresh and ODThresh0 are 0.001 for the versions with floating-point input vectors (VF_OD,   VD_OD, and VE_OD), and 1 for the versions with unsigned-integer input vectors.
The typical application of these functions would be an absorption measurement with a spectrometer, where each element of X corresponds to the light intensity at one specific wavelength, transmitted through the sample, and each element of X0 corresponds to the light intensity measured through air or through a reference sample. Normally, the intensity data will have been digitized with 12-bit or 16-bit precision. In this case, VUS_ODtoF or VUS_ODtoD will be the appropriate functions. For the rare cases of 8-bit, 32-bit, or even 64-bit digitization, use the VUB_, VUL_ or VUQ_ versions.
You might wish to accumulate several measurements before calculating the OD. For example, repeated measurements in a usVector may be accumulated into a ulVector by VUL_accVUS, before the OD is calculated by VUL_ODtoD. Similarly, you might accumulate 32-bit data into a uqVector by VUQ_accVUL and call then, e.g., VUQ_ODtoD.

In order to cut off experimental noise, the input-number threshold below which the OD is corrected to 0.0 may be set to arbitrary positive values by VF_setODThresh,   VUS_setODThresh, etc.

If background values have to be taken into account, please use the functions of the VF_ODwDark family.

Error handlingnone
Return valuealways FALSE (0)
See alsoVF_ODwDark,   VF_log10

VectorLib Table of Contents  OptiVec home