Conceptual NIR experiment design: material lots contain specimens, and repeated scans stay grouped with their specimen; a held-out lot is marked separately.
Original code-authored conceptual diagram. It illustrates the guide’s checks, not experimental data or a benchmark result.

Write the claim before the scan plan

A NIR hyperspectral study can produce thousands of spectra from one specimen. The practical question is how much new material, preparation variation and acquisition variation those spectra represent. A useful experiment plan identifies those sources of variation before collecting the first cube.

Start with one sentence describing the intended decision: classify a new item from a familiar production lot, classify an item from an unseen lot, or predict a laboratory measurement for material collected on a later day. Each claim needs a different holdout. A study that tests new pixels from familiar objects answers a narrower question than a study that tests independently sourced objects.

This guide develops a close-range reflectance experiment around a worked material-classification example. The specimen counts are illustrative, not a sample-size recommendation or a report of measured results. For the terminology and choice between point spectroscopy and imaging, start with NIR spectroscopy versus hyperspectral imaging.

Give every level of the experiment its own identifier

Keep material lot, specimen, preparation, acquisition session and scan separate in the data record. A specimen might be one independently selected item. A preparation might be its cleaned surface, packed powder cup or exposed cross-section. A scan is one acquisition of that preparation. Pixels and regions of interest sit below the scan in this hierarchy.

Two scans without moving the object mainly test short-term acquisition repeatability. Removing and replacing it adds positioning variability. Repacking a powder cup adds preparation variability. Collecting a new specimen adds material variability. Choose the repeats that answer the uncertainty you need to understand; counting all of them as independent specimens hides the distinction.

For powders, record preparation choices such as particle-size treatment, fill depth and packing procedure. For intact objects, record surface condition, orientation and the region included in the analysis. Keep these conditions controlled during an initial feasibility test, then deliberately include realistic variation before claiming operational robustness.

A worked plan for testing unseen material lots

Suppose the task is to distinguish three material classes in new lots from the same sourcing process. An illustrative design uses four separately identified lots per class and eight specimens per lot: 3 × 4 × 8 = 96 specimens. Two repositioned scans per specimen produce 192 cubes, but the study still contains 96 specimens and 12 lots.

Before model selection, reserve one lot from each class for the final test. That leaves 72 specimens from nine lots for development and 24 specimens from three lots for the locked evaluation. Keep both scans, all crops and every pixel from a specimen with its assigned lot. Within development, construct validation folds that hold out whole lots while retaining representation of every class in the training data.

This plan exposes a limitation worth stating: the final test contains only three independent held-out lots, one per class. Thousands of test pixels cannot make that a precise estimate of between-lot performance. More independently sourced lots would strengthen that estimate; scanning the same items repeatedly would mostly strengthen repeatability information.

The example tests lot transfer under the acquisition conditions represented in the study. It does not establish transfer to a new instrument, an unseen supplier or a later season. If future-day performance is the claim, reserve suitable new specimens for a genuinely held-out acquisition session as well. Do not rename a same-session lot holdout as a day-transfer experiment.

Balance the acquisition schedule

Avoid scanning every specimen of one class first and every specimen of another class later. Class would then be entangled with time, lamp drift, operator fatigue or an equipment adjustment. NIST describes blocking as holding important nuisance conditions relatively constant while allowing the factor of interest to vary within those blocks. Randomisation addresses remaining order effects. [1]

A practical application is to treat acquisition sessions as blocks and distribute specimens from the different classes and lots across them. Randomise their order within a session, subject to the sample’s stability and safe handling. Save the planned order and actual timestamps. Record interruptions and setting changes rather than silently treating the session as uniform.

Keep the experimental treatment and validation split distinct. Mixing classes within a session reduces a class–session confound. Holding out lots addresses generalisation to different material lots. Neither operation automatically achieves the other. If constraints prevent balancing the schedule, record the confounding and narrow the conclusion instead of relying on a model to separate effects the design never separated.

Sources: [1]

Set acquisition controls before collecting the full dataset

Confirm that the usable wavelength range includes the information needed for the task. Record the actual retained bands and spectral metadata rather than describing the sensor only as “NIR”. Inspect signals at the dim and bright parts of the spectrum and across the field of view. Use pilot specimens that cover the intended range of appearance, including challenging dark or reflective surfaces.

Set illumination, viewing geometry, working distance and scanning settings, then collect the appropriate references. Resonon’s acquisition instructions warn that changes to exposure, gain, illumination or working distance can invalidate relevant corrections. A reference captured at the start of a long session is not automatically valid after those conditions change. Follow the instrument’s procedure and verify stability with repeated checks. [2]

Reference placement deserves its own record. Specim’s white-reference experiment shows that changing the sample’s height relative to the reference can alter measured reflectance levels. For irregular samples, document the reference height and representative sample geometry; a reference cannot make every surface point equally illuminated. [3]

Use the reflectance-calibration guide for the dark/panel calculation and the acquisition guide for optics, line rate and motion. The experiment plan should preserve their settings and reference files, not create another undocumented correction pipeline.

Sources: [2], [3]

Match the reference label to the thing being predicted

A class label attached to an intact, homogeneous item may support an object-level classification task. A chemical assay made on a mixed bulk sample supports a different target. Assigning that bulk result to every image pixel does not create pixel-resolved reference measurements.

State whether the prediction concerns a pixel, a region, an object or a batch. If the reference is specimen-level, define how pixel predictions or spectra are aggregated to that level before evaluation. Keep the aggregation rule fixed during the final test.

For quantitative targets, record the laboratory method, units, sample preparation and correspondence between the assayed material and the imaged surface. If the material changes between imaging and assay, preserve the timing and handling details. A disagreement may reflect reference uncertainty or mismatched sampling as well as model error.

Decide how failed scans will be handled

Define acquisition-quality rules during the pilot stage. Useful checks include saturation, inadequate dark-subtracted reference signal, missing lines, excessive motion, an invalid sample mask and a failed reference measurement. Set thresholds from instrument behaviour and the intended measurement tolerance, rather than choosing a universal percentage from an unrelated camera.

Keep the raw cube, the calibrated cube or transformation record, the reference identifiers and the reason for any exclusion. Do not delete inconvenient scans or tune quality thresholds until the final test score looks better. If a failure can be detected in deployment, a predefined reacquisition or rejection rule can be evaluated as part of the workflow.

Report exclusions by class, lot and session. An apparently accurate classifier may cover only easy specimens after quality filtering. The useful result includes both prediction quality on accepted specimens and the fraction of specimens that the system could not assess.

Split before fitting learned preprocessing

Build the split from the specimen and lot manifest, then generate training crops or spectra. Group-aware cross-validation keeps observations from the same specified group out of both sides of a fold. The scikit-learn documentation explains this distinction and provides grouped splitters. Check the resulting class and lot composition explicitly; a convenient split function does not know the scientific claim. [4]

Fit dataset-level scaling, PCA, feature selection and other learned transforms inside the development folds. Apply the fitted transforms to validation data without refitting them. Select the pipeline with development data, then evaluate the locked test once. The scikit-learn guidance on leakage recommends pipelines to keep learned preprocessing within the correct fitting boundary. [5]

Patch-based models need an additional spatial check. Nearby training and test patches can share observations even when their centre pixels differ. Liang and colleagues describe how spectral-spatial processing can amplify dependence under random pixel sampling. For an object study, keeping complete objects and their surrounding context together is a useful starting point; for scene mapping, use the dedicated spatial-split guide. [6]

Sources: [4], [5], [6]

Use a pilot to decide where the next measurement helps

Inspect variation at the levels you deliberately repeated. Compare the same specimen without movement, after repositioning, across preparations and across acquisition sessions where available. Plot these differences alongside differences between specimens and lots. This is a way to diagnose the measurement process, not proof that a particular difference is chemical.

If repeat scans are unstable, improve acquisition before expanding model complexity. If scans are stable but lots differ substantially, invest in independent lots. If labels disagree for nominally comparable material, investigate the reference process and sampling correspondence. These decisions direct the next measurement toward the weakest part of the evidence.

A simple object-level spectral baseline is useful before a large spatial model. Compare both on the same held-out specimens and lot assignments. For classification, include per-class performance and the confusion matrix. For regression, report errors in the target’s units and inspect bias and the target range. Evaluate at the decision unit you defined, rather than allowing large objects with more pixels to dominate the score.

Keep a compact measurement manifest

The manifest is the connection between experimental design and reproducible analysis. One row per acquisition can hold the identifiers below, while calibration certificates, instrument metadata and detailed laboratory methods remain linked records.

A useful release includes the split assignments, quality decisions and aggregation rule as well as the spectra. Another analyst should be able to determine which scans belong to the same physical material and which observations were actually independent.

Suggested acquisition-manifest fields. These describe a study record, not a required instrument format.
Field groupRecord
Identityscan_id, specimen_id, lot_id, preparation_id, session_id
Targetclass or reference value, units, reference method, label level
Acquisitiontimestamp, scan order, exposure, gain, line rate, geometry/configuration ID
Calibrationdark-reference ID, panel-reference ID, panel certificate, wavelength metadata
Qualityvalid-band mask, specimen mask, quality flags, exclusion/reacquisition reason
Evaluationsplit assignment, grouping unit, aggregation rule version

Frequently asked questions

How many samples does a NIR hyperspectral experiment need?

There is no defensible universal count. Use the intended error tolerance, class or target coverage, observed variability and number of independent lots or specimens to plan it. The 96-specimen example explains the hierarchy; it does not establish statistical power.

Do repeated scans increase the independent sample size?

They provide information about repeatability or preparation variation, depending on what is changed. They do not turn the same physical specimen into newly sampled material.

Can I split individual pixels randomly?

Only if that split supports the specific claim and accounts for dependence and spatial context. For performance on new specimens or lots, keep those units intact across the split.

References and further reading

  1. NIST/SEMATECH: Randomized block designs
  2. Resonon: Benchtop acquisition, reference capture and invalidating corrections
  3. Specim: The role of white reference in obtaining reflectance data
  4. scikit-learn: Cross-validation iterators for grouped data
  5. scikit-learn: Data leakage and recommended practices
  6. Liang et al.: On the sampling strategy for evaluation of spectral-spatial methods in hyperspectral image classification

Reader feedback

— reads— comments

Reads since 1 October 2026: at least 15 seconds with the article visible, counted once per browser per day. Reactions are anonymous and can be changed.

Discuss this article

Ask a technical question, challenge an assumption or share evidence from your own work.

Your name and comment will be public after approval. New comments wait for approval. No email required. Keep it respectful and relevant; no personal information or spam. Plain text, up to 2,000 characters.

Owner: manage comments