Effect of scanning samples through polypropylene film on predicting nitrogen content of forage using handheld NIR

This study examined the effect of collecting near infrared (NIR) spectra of forage samples through a transparent polypropylene (PP) plastic film instead of glass cups on calibrating two handheld NIR spectrometers to nitrogen content (N). The first device was a transportable spectrometer (H1) covering 790–2500 nm at 1 nm interval, while the second device was a smartphone spectrometer (H2) covering 900–1700 nm at 4 nm interval. The spectra from each spectrometer were subjected to principal component analysis (PCA) to identify wavebands for PP packaging that would interfere in subsequent partial least squares (PLS) regression modeling to predict N. PCA results showed that the loadings of the first principal component (PC1) of the first derivative of the spectra from H1 and loadings of the second principal component (PC2) of the second derivative of the spectra from H2 were useful in identifying wavebands due to PP film. Regression models for H1 had better prediction performance when spectra were collected through glass than through PP films, in terms of coefficient of determination (r2 = 0.958), standard error of prediction (SEP = 0.96 g kg-1), and ratio of performance to deviation (RPD) = 4.93 vs. (r2 = 0.942, SEP = 1.13 g kg-1, and RPD = 4.17). Similar results were obtained for H2 using spectra collected through glass (r2 = 0.821, SEP = 1.73 g kg-1, and RPD = 2.72) than through PP (r2 = 0.499, SEP = 2.99 g kg-1, and RPD = 1.57). Removing peaks due to PP in the sample spectra improved the PLS models for H1 (r2 = 0.959, SEP = 0.94 g kg-1, and RPD = 5.02), but not for H2 (r2 = 0.521, SEP = 3.17 g kg-1, and RPD = 1.49). Hence, scanning samples through PP films can reduce the accuracy of predicting N, but for some handheld NIR spectrometers, this could be overcome by excluding wavebands due to PP.


Introduction
Near infrared (NIR) spectroscopy is routinely used in food and feed quality assessment, given that it is a non-destructive, simple, rapid, and inexpensive technology [1]. Miniaturization of microprocessors and optical components has enabled the development of portable or handheld spectrometers for a fraction of the cost of benchtop instruments, making them easier to transport and be used in environments where benchtop spectrometers would be difficult to employ [2]. Their suitability for in situ measurements raises questions on the effect of packaging material since glass cups or containers, typically used with benchtop NIR spectrometers, would be less durable and less convenient to transport and handle than plastic cups or pouches. Glass cups are relatively more expensive to buy and keep intact or un-scratched. In contrast, disposable plastic packaging, such as thin, transparent polypropylene (PP) films, are cheaper and require little to no maintenance. When scanning samples through plastic films, the assumption is that the packaging is transparent to NIR light and will have minimal to no influence on the resulting spectra. This might explain the limited availability of published literature on the effect of polymer packaging films on the performance of NIR spectroscopy [3]. However, collecting NIR spectra through a plastic material can complicate spectral data processing and analysis downstream, since plastic polymers absorb NIR light [4][5][6][7][8][9][10][11][12] thereby interfering with the NIR absorption of a sample's components. For example, polyethylene (PE) and PP possess absorption bands in the third overtone regions around 1100-1300 and 1380-1430 nm. The absorptions are even stronger in the first overtone and combination regions around 1600, 1650-1800, and 1850-2500 nm [8,11,13]. If a packaging material such as PP is used to contain samples during NIR scanning, its contribution to the spectra may need to be removed or at least reduced depending on the strength of the absorption bands of the sample's constituents and analyte of interest. To what extent does this interference affect the utility of a handheld NIR spectrometer and its corresponding calibration model? Can the interference by PP film be corrected for, in preprocessing the spectra? In an attempt to correct for this PP interference, the approach of collecting a background spectrum by encasing a white reference disk in an empty packaging bag has been used [14]. The collected background spectrum is then subtracted by the spectrometer from subsequent sample spectra. Gowen et al. [3] studied the impact of polymer packaging on visible-NIR hyperspectral imaging data in the wavelength range of 450-950 nm. The authors concluded that scanning products through polymer packaging can be a source of variability in hyperspectral imaging, mainly due to light scattering, and that the thickness and refractive index of thin polymer films largely caused interference. However, they reported that imaging and spectral preprocessing reduced the polymer packaging effects. The objective of this study was to analyze the of collecting NIR spectra of forage samples through 0.08-mm-thick (3 mil = 3/1000th inch thick) PP films instead of glass cups on predicting forage nitrogen content (N) using two handheld NIR spectrometers. The two handheld spectrometers used-a transportable spectrometer and a smartphone spectrometerrepresented two ends of the spectrum of commercially available handheld NIR in terms of spectral range, resolution, cost, and potential applications [15]. The transportable spectrometer (H1) covered 780-2500 nm, while the smartphone spectrometer (H2) covered 900-1700 nm only, mostly collecting absorbances in the second and third overtone regions. Foster et al. [16] identified important spectra during calibration modeling for N in forage as 1450, 1580, 1630, 1830, 2030, 2100, 2180, 2250, and 2490 nm, most of which are in the first overtone and combination regions. Since H1 covered the full NIR spectral region, it was hypothesized that the PP influence would be more pronounced in the H1 spectra than in the H2 spectra and, that once spectral wavebands due to PP film packaging were removed, both spectrometers could be used to predict N concentration of forage samples.

Forage samples
Perennial warm-season grasses, including Switchgrass (Panicum virgatum), Big bluestem (Andropogon gerardii), and Indiangrass (Sorghastrum nutans), native to North America, were evaluated. Their corresponding laboratory (wet chemistry) data were determined in the USDA Forage Research Laboratory at the University of Nebraska-Lincoln. Description of samples and procedures for obtaining chemical data were documented by Vogel et al. [17]. Briefly, samples were dried in a forced-air oven at 50 ℃ to a moisture content of 8

Spectrometers
Two handheld NIR spectrometers were used to collect spectral data. The first (H1) was a transportable NIR spectrometer (ASD QualitySpec® Trek, Malvern Panalytical, Cambridge, UK), which measures in the visible and NIR ranges from 350-2500 nm, has a spectral interval of 1 nm, making it comparable to benchtop NIR spectrometers used in forage analysis, such as a FOSS XDS Rapid Content Analyzer and FOSS 6500 (FOSS, Hilleroed, Denmark). Its weight (2.5 kg), however, makes it more portable than these benchtop instruments. The second handheld NIR spectrometer (H2) was a smartphone NIR spectrometer (Enterprise Scanner, Tellspec Inc., Toronto, Ontario, Canada), which measures from 900-1700 nm and has a spectral interval of 4 nm, weighs 136 g, and can be classified as a Hadamard transform-based palm-sized spectrometer [15].

Spectral data collection
Spectral data of 123 warm season forage samples were collected using both handheld spectrometers. The composition and average of the sample set was as follows: Switchgrass ( = 136, = 10.45 gkg −1 ), Big Bluestem ( = 24, = 9.86 gkg −1 ), and Indiangrass ( = 18, = 8.61 gkg −1 ). For each spectrometer, a background spectrum was collected by using a white reference (Spectralon®) disk to calibrate the instrument. Each forage sample was scanned through a black ring sample cup with a quartz glass window. A spectrum was collected by placing the window of the handheld spectrometer directly on top of the quartz glass window covering the sample and pulling the trigger on H1 or pressing the scan button on the H2 to start scanning. The recorded NIR scan was an average of 50 spectral measurements across the spectrometer's entire wavelength range. The spectrometer H1 was retreated, and the sample rotated clockwise 90-180 and re-scanned. Afterwards, the lid of the glass cup was removed, allowing for the uncovered sample and glass cup to be placed inside a clean, 0.08-mm-thick (3 mil = 3/1000th inch thick) PP bag (Uline, Pleasant Prairie, WI, USA). The widow for each spectrometer was placed against the PP film, which was flush to the sample material. For H1, the trigger was pulled, while for H2, the scan button was pressed to start scanning. As with scanning through glass cups, each scan was an average of 50 spectral measurements across the device's spectral range. The spectrometer was retracted, sample was rotated clockwise 90-180, and re-scanned. The two scans obtained per sample, per spectrometer, were averaged in Excel (Microsoft Office Suite, Version 2016, Microsoft Corporation, Redmond, WA, USA) before preprocessing and multivariate analyses. The averaged spectra collected with H1 were truncated also to include only the NIR range (780-2500 nm). In practice, the background spectrum for samples scanned through the PP bag would be collected with the white reference encased in an empty bag of the same kind and subtracted from subsequent sample spectra. This, however, was not done since the aim was to quantify the effects of PP packaging on the resulting spectra and models.

Principal component analysis
H1 and H2 spectra were analyzed first using principal component analysis (PCA), a variablereduction method [19], in The Unscrambler® X (Version 10.5, Camo Analytics, Magnolia, TX, USA). For each spectrometer, the raw spectra of the samples collected through glass or through PP films were subjected to PCA to see if the scans would cluster according to packaging material. The loadings were also checked to see if high values were obtained for known absorption wavebands of PP. The PCA was repeated for H1 using the first derivative of mean-centered NIR spectra, which was estimated using the Savitzky-Golay algorithm utilizing a second order polynomial and 31 smoothing points [SG1(2,31)]. For H2, the second derivative of mean-centered NIR spectra was used. This was estimated using the Savitzky-Golay algorithm utilizing a second order polynomial and 17 smoothing points [SG2 (2,17)]. The second PCA was conducted since, often, mean-centered and derivatized NIR spectra are used in instrument calibration [20]. While taking a derivative tends to remove noise from the spectra, it could accentuate the effect of PP film and segregate samples due to packaging. Using the loadings values, wavebands due to PP film were removed prior to partial least squares (PLS) regression modeling.

Partial least squares regression
The N of all 123 forage samples were plotted to allow for samples from each bin of the histogram to be randomly selected to form an independent validation set (n = 25) ( Figure 1). The remaining samples then formed the calibration set (n = 98), for which four PLS regression models were developed, one for each packaging material and spectrometer. By utilizing the histogram in segregating the samples, the calibration and validation sets had comparable descriptive statistics. PLS regression was carried out using The Unscrambler® X software. The NIR spectra were projected onto a small number of latent variables (N LV ). The corresponding N values were used to estimate the LVs so that the first few captured most of the variability in N. These LVs were fitted to N using a linear regression model, which serves as the calibration model. A coefficient of determination (R 2 ) and root mean square error of calibration (RMSEC) were calculated and, generally, a good calibration model would have low N LV , high R 2 , and low RMSEC. During calibration, the model was cross-validated using a segmented approach, where the calibration set was divided into several segments containing four samples each, and one segment was left out of the validation at a time. The prediction residuals generated during cross-validation were used to compute a residual variance and, eventually, the root mean square error of cross-validation (RMSECV). By default, The Unscrambler® X software selects the N LV in the calibrated based on the lowest resulting RMSECV. In general, good fit calibration models have similar values for RMSEC and RMSECV.
Following cross-validation, the model was validated using the independent validation sample set, and the prediction performance was evaluated as follows: a high coefficient of determination of validation (r 2 ), low root mean square error of prediction (RMSEP) and standard error of prediction (SEP), close to zero, a high ratio of standard deviation of the reference values ( ) in the validation set to the SEP and a high ratio of to the range of the reference values in the validation set [21]. These two ratios are referred to as RPD and RER, respectively. The range is the difference between the maximum and minimum N values in the validation set. Aside from these parameters, the effect of packaging material on the prediction performance was evaluated by checking whether the loadings and -coefficients of the PLS regression models included known absorption wavebands for PP. Marten's uncertainty test, a significance testing method based on jack-knifing [22], was enabled during cross-validation to identify, along with loading weights, the important wavelengths on which the PLS regression model is based. This allowed for a set of model parameters [e.g., -coefficients  (also called regression coefficients), scores, loadings, and loading weights] to be calculated for every sub-model created based on samples that were not held out of the cross-validation segment. Differences between the -coefficients of all the sub-models to those of the full calibration model were calculated and used to estimate the uncertainty limits of each -coefficient. Wavelengths with -coefficients, which had a relatively large uncertainty limit and, at the same time, had loading weights with relatively large uncertainties were deemed not important by The Unscrambler® software.

Principal components analysis
PCA scores plot based on raw NIR spectra from H1 shows the first principal component (PC1) captured 80% of the variability in the dataset, while the second principal component (PC2) captured 15% of the variability in the dataset (Figure 2a). PC1 also captured the difference between packaging materials, i.e., scanning through glass yielded negative PC1 values while scanning through PP films yielded positive PC1 values. The variability in N was captured in both PC1 and PC2. When PCA was applied to the first derivative of the NIR absorption spectra, the scores plot showed that PC1 captured 98% of the variability in the dataset, but strictly the effect of packaging material (Figure 2b). Applying PCA to the second derivative of the NIR spectra, PC1, on the scores plot, captured 100% of the variation, which could all be attributed to the effect of packaging material (Figure 2c). However, looking that the PC1 scale, scores were farther apart with the first derivative than with the second derivative spectra, suggesting better separation. Therefore, the loadings plot was based on PCA applied to the first derivative spectra. The plot showed that the loadings at 1160-1260, 1680-1800, and 2200-2500 nm were pronounced (Figure 2d). These wavebands are known absorption bands for PP [8,11,13], and they also corresponded to some of the known absorption bands for N in forage materials [16]. The strong absorption by the PP film in the combination region greatly influenced the PCA model, potentially making the calibration of H1 spectra to N particularly sensitive to PP film packaging. When the identified bands were removed, the resulting PCA model based on raw spectra had PC1 accounting for 79% and PC2 accounting for 18% of the observed variation ( Figure 2e). However, the pattern of separation between samples scanned through PP films and those scanned through glass-as observed in Figure 2a-was lost. Even when a first derivative was applied to the spectra before PCA, there was no clear separation of the two groups of samples (Figure 2f), an indicator that removing interfering PP spectra my reduce its effect on prediction of N. The variation captured by PC1 reduced to 53%, while that captured by PC2 was 16%. There was no observable pattern to N variation across both PCs.  In comparison, PCA scores plot based on raw NIR spectra from H2 shows that PC1 and PC2 captured 96% and 3% of the variability in the dataset, respectively, and spectra collected through glass and through PP were not distinct from each other (Figure 3a). This showed it was not easy to see the PP effect easily with raw spectra from H2, unlike the case with H1. When the PCA was conducted on the first derivative of the NIR spectra, PC1 and PC2 captured 67% and 17% of the variability in the dataset, respectively, again with no clear distinction between samples scanned through glass cups and PP films (Figure 3b). Applying a second derivative before PCA showed the scores plot with PC1 capturing 74% and PC2 capturing 16% of the total variation. Separation of samples based on packaging material could be seen in PC2, i.e., samples with positive PC2 values were those scanned through glass while samples with negative PC2 values were scanned through PP films (Figure 3c). The corresponding PC2 loadings plot based on second derivative spectra showed pronounced absorption bands that corresponded to those known for PP at 1180-1280, 1410-1460, 1640-1700 nm (Figures 3d). The absorption by the PP film around these bands greatly influenced the PCA model based on the second derivative of the spectra, making the calibration of H2 spectra to N potentially sensitive to PP film packaging, but not to the degree seen with H1 spectra. The PCA model excluding the highlighted spectral bands had PC1 and PC2 capturing 97% and 3% of the variation, respectively, when the analysis was performed on raw spectra, with no clear separation of samples scanned through PP films and glass cups (Figure 3e), just like the case with raw spectra with all the spectral bands. Applying a second derivative prior to PCA indicated that the observed separation in Figure 3c had disappeared (Figure 3f). Noting that the separations observed in Figures  3a and 3b were already minor, the removal of known PP spectral bands had only a minimal effect.

Partial least squares regression
PLS regression models were built to assess further the effects of PP film on the prediction of N, as well as the impact of removing the PP wavebands ( Table 1). The models were based on spectra preprocessed using the same preprocessing techniques applied during PCA, i.e., SG1(2,31) for H1 and SG2 (2,17) for H2, and when scanned through glass (Models H1.1 and H2.1), PP (Models H1.2 and H2.2), and after PP wavebands identified through PCA were removed (Models H1.3 and H2.3).
When spectra scanned through PP films were subjected to a PLS regression following a first derivative preprocessing, the calibration model for N (Model H1.2) had parameters similar or slightly inferior to those of Model H1.1, with R 2 = 0.955, r 2 = 0.942, RMSEC, RMSECV, RMSEP and SEP = 1.00, 1.28, 1.11, and 1.13 g kg −1 , respectively. The RPD and RER for this model were 4.17 and 16.20, respectively. Again with r 2 > 0.92 and RPD > 4.1, this model could be used for a wide range of applications (e.g., screening to quality control). Comparing Models H1.1 and H1.2 showed only a slight influence of PP on model performance. This was different than what we would have expected based on PCA, which showed an increased effect of packaging after applying a first derivative to spectral data. When the PCA-identified wavebands were removed before PLS regression modeling, r 2 increased to 0.959, RMSEP and SEP reduced to 0.94 g kg −1 , while RPD and RER increased to 5.02 and 19.50, respectively (Model H1.3). The two latter variables were even slightly better than those of Model H1.1, with samples scanned through glass cups.  In comparison, the second derivative spectral data collected through glass cups using H2 had a PLS model with R 2 = 0.877, r 2 = 0.821, RMSEC = 1.79 g kg −1 , RMSECV = 2.33 g kg −1 , RMSEP = 1.64 g kg −1 , SEP = 1.57 g kg −1 , RPD = 2.72 and RER = 10.57 (Model H2.1) ( Table 1). Based on r 2 and RPD, this model could be applied to screening of samples and research [23]. On the contrary, for samples scanned through PP films, the PLS regression model had R 2 = 0.818, RMSEC = 2.02 g kg −1 , RMSEP = 3.27 g kg −1 , SEP = 2.99 g kg −1 , r 2 = 0.499, RPD = 1.57 and RER = 6.11 (Model H2.2). Removing previously identified spectral regions for PP only slightly improved model performance, with an increase in r 2 to 0.521 and a small drop in RMSEP to 3.20 g kg −1 . Other model parameters either did not improve or declined (Model H2.3). Although the RPD was below 2.00, this model, based on r 2 , could be used for screening of forage samples for N content.
While the observed effects of PP film on spectral data variation were significant during PCA, it followed that with PLS regression, elimination of interfering spectral bands overcame these effects when using H1. Results from the Martens uncertainty test during cross validation showed that many wavebands with high loadings used in predicting N did not overlap with those identified for PP film in the PCA (Figure 4). Looking at the spectra identified by Foster et al. [16] as important to modeling forage N, even with the removal of identified interfering PP spectral bands, there was a wide window left for calibration of spectral data to predict forage N and, thus, no significant difference in Model H1.1 and Model H1.3 performance. For H2, the effect of PP film was minimal. It took a second derivative transformation to cluster samples according to packaging material, but even then, the clustering was not as pronounced as that of H1 spectra. Overall, removing the three PP bands identified during the PCA did not improve the model since these are also known to contribute to modeling for N. Given that H2 has a limited spectral range, eliminating such spectral bands further limited its ability to extract information necessary for calibrating N using the remaining spectra ( Figure 4). Looking at Figure 4, models for H1 had much more spectral information to facilitate the calibration to N, compared to those of H2. Moreover, the reduced spectral region for H2 was mostly in the second overtone, with a limited window in the first and second overtone regions of the NIR spectrum. Since NIR absorption bands are weaker moving from the combinations to the first, second, and third overtone regions [24], it was reasonable to expect a calibration to N based on second and third overtone absorption bands would be weaker than one based on the first and combinations absorption bands.   Figure 5 shows the validation performance for PLS models based on samples scanned through glass cups and PP films using both H1 and H2. Overall, predicted N values from the H1 models agreed better with reference N values than predicted N values from H2 models. It was visibly evident that H1 models Figure 5a) showed more linearity than H2 models (Figure 5b). For H2 models, samples scanned through glass cups showed less deviation from linearity than samples scanned through PP films (Table 2).   (Table 2). Slopes were equal to unity and intercepts equal to zero for Models H1.2 and H1.3. All other model predictions were biased (i.e., slope 1) and were offset (i.e., intercept 0) when compared against reference N.
In general, the model calibration and validation parameters for samples scanned through glass cups were better than those of the model for samples scanned through PP films, with the former having higher R 2 , r 2 , RPD, RER, and lower model errors. For samples scanned through PP films removing previously identified spectral regions for PP improved model performance to a greater extent when using H1 than when using H2. Scanning samples through packaging was enabled by the fact that NIR, compared to other spectroscopy methods, can penetrate more than 10 mm deep into the sample [25,26], thus capturing spectral characteristics of both the sample and the package. However, it should be noted that light goes through the package, to the sample and back through the package to the detector. This double passage through the package carries extra information that is not related to the sample, especially when the package has significant absorption in the NIR region. Payne and Wolfrum [27] suggested that using higher quality packaging, such as optical glass cups, provides spectral information with reduced noise. Therefore, when choosing to scan a sample through a packaging material, one must consider the relative strength of NIR absorption by the package and target analyte in the sample and whether the effects of the packaging material can be eliminated through spectral preprocessing or excluding specific wavebands from the calibration.

Conclusions
This study showed that scanning samples through PP film instead of glass cups using handheld NIR spectrometers affects the ability to predict N concentration of perennial warm-season grass samples, including Switchgrass, Big Bluestem and Indian grass. For the transportable spectrometer (H1), regression models had better prediction performance when spectra were collected through glass than through PP films (r 2 = 0.958, SEP = 0.96 g kg −1 , and RPD = 4.93 vs. r 2 = 0.942, SEP = 1.13 g kg −1 , and RPD = 4.17). Similar results were obtained for the smartphone spectrometer (H2) with spectra collected through glass (r 2 = 0.821, SEP = 1.73 g kg −1 , and RPD = 2.72) than through PP (r 2 = 0.499, SEP = 2.99 g kg −1 , and RPD = 1.57). Removing peaks due to PP in the sample spectra improved the PLS models for H1 to improve N prediction (r 2 = 0.959, SEP = 0.94 g kg −1 , and RPD = 5.02), but not for H2 (r 2 = 0.521, SEP = 3.17 g kg −1 , and RPD = 1.49). Therefore, scanning samples through PP films can reduce the accuracy of predicting N, but for some handheld NIR spectrometers, this could be overcome by excluding wavebands due to PP. Despite the advantages of using plastic packaging, scanning through glass cups using the smartphone spectrometer led to more accurate prediction of N concentration. The N prediction models based on scanning through PP films were useful for rough screening applications or for developing rations in regions with limited access to benchtop spectrometers.