This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Getting reference spectrum from EVM



Section 5.1.8.3 of User guide doesnot clearly explain the procedure to receive Reference intensities. Especially the line "Sample scan struct is interpreted scanResults from a sample scan with an arbitrary scan configuration"

Here's what I understood in part c-part pseudo code
Allocate variable ref_matrix_size with size REF_CAL_MATRIX_BLOB_SIZE
NNO_GetFileSizeToRead(NNO_FILE_REF_CAL_MATRIX)
NNO_GetFile()

Allocate variable ref_cal_data with size SCAN_DATA_BLOB_SIZE
NNO_GetFileSizeToReadNNO_FILE_REF_CAL_DATA
NNO_GetFile()

Could anyone explain what DLP Spectrum Library functions should I use to get Reference intensities for computing absorbance ?

PS. dlpspec_scan_interpReference function description is also not self explanatory


Function to interpret reference scan data into what the reference scan would have been if it were scanned with the configuration which @p pScanResults was scanned with. This can be used to compute a reference for an arbitrary scan taken when a physical reflective reference is not available to take a new reference measurement.

  • Hi Cheery,

    It may help if I provide some additional background information. The following is present in the doxygen documentation scan module overview of the Spectrum Library:

    Interpret reference

    Most spectroscopy analysis is performed as material absorbance, reflectance, or transmittance. This references out any difference in radiometric response between two different instruments, and instead characterizes the properties of the sample being measured independent of the instrument. This process involves scanning a reference with a neutral reflector in the case of reflectance, or a null sample in the case of transmittance. Since a DLP spectrometer can have many different programmable scan configurations, the data from this reference measurement can vary depending on the scan configuration due to wavelength and pattern size dependent diffraction efficiencies.

    In applications where a reference is not readily available or it is not desired to retake a reference scan, this library provides the dlpspec_scan_interpReference() function to model what the reference would measure for a new scan configuration with only that configuration data and a previous reference scan serialized uScanData blob. This can be used with previous scans stored on the client, or it can be used in combination with a previous reference stored on the DLP spectrometer.

    To do this modeling, the dlpspec_scan_interpReference() function uses the following parameters, as displayed in the doxygen documentation:

    [in]

    pRefCal

    Pointer to serialized reference calibration data 

    [in]

    calSize

    Size of reference calibration data blob 

    [in]

    pMatrix

    Pointer to serialized reference calibration matrix 

    [in]

    matrixSize

    Size of reference calibration matrix data blob 

    [in]

    pScanResults

    Scan results from sample scan data (output of dlpspec_scan_interpret function) 

    [out]

    pRefResults

    Reference scan data result

    The above parameters correspond to the following data file types from the NIRscan Nano:

    • pRefCal/size: NNO_FILE_REF_CAL_COEFF, just how you described, or by using EVM::FetchRefCalData in the evm class.
    • pMatrix/size: NNO_FILE_REF_CAL_MATRIX, just how you described, or by using EVM::FetchRefCalMatrix in the evm class.
    • pScanResults: Acquire scan data from the following (you are likely already doing this while fetching scan data):
    • size = NNO_GetFileSizeToRead(NNO_FILE_SCAN_DATA);
    • allocate buffer
    • NNO_GetFile(buffer, size);
    • allocate scan_results (scanResults structure)
    • dlpspec_scan_interpret(buffer, size, &scan_results);
    • pRefResults: newly allocated scanResults structure.

    After calling dlpspec_scan_interpReference() with the above parameters, you will have two pointers to interpreted scanResults structures:

    • &scan_results
    • pRefResults

    The wavelength vectors in both of these scanResults structures will be identical, and you may divide &scan_results->intensity[] by pRefResults->intensity[] to yield transmission or reflectance depending on the sampling method used. Taking the negative log10 of the transmission or reflectance as shown in section 5.1.8.5 of the user's guide will yield absorbance.