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;
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 or higher than 16-bit digitization, use the VUB_ or VUL_ 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 qiVector by VQI_accVUL and call then, e.g., VQI_ODtoE.

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