Expose the reference-spectrum API on ProcessingContext - #96
Open
birkholz-cubert wants to merge 7 commits into
Open
Expose the reference-spectrum API on ProcessingContext#96birkholz-cubert wants to merge 7 commits into
birkholz-cubert wants to merge 7 commits into
Conversation
set_reference becomes polymorphic: the two new ReferenceType members WhiteSpectrum and TargetSpectrum take spectrum data (an ImageData with wavelengths, or a (wavelengths, values) pair of arrays) instead of a Measurement; a white counts spectrum additionally requires effective_bit_depth and carries integration_time and load_level. get_reference_spectrum returns either slot as an ImageData, or None when the slot is empty. has_reference and clear_reference work on the new members unchanged. The counts metadata is write-only: the C API stores it but exposes no getter, so a round trip returns wavelengths and values only.
A flat 50 percent target spectrum halves the reflectance cube; the two white sources clear each other on set and the counts spectrum drives the denominator (four times the counts quarter the cube); both spectra survive a legacy .cu3 save and reload embedded in the file, values and rounded-nm wavelengths intact. The flat-100-percent identity check gets one count of tolerance: the reflectance kernel is parallel and not bit-deterministic between runs.
The CubeExporter is the one component that writes references in their link forms: with allow_session_file=False it produces a loose .cu3 and one .cu3sp sidecar per spectrum slot in the Calibration directory, never embedding a spectrum into the measurement. cuvis_measurement_save stays the raw legacy dump and is not part of this contract. full_export=True keeps the processed cube through the export trim.
- target spectrum values are reflectance fractions now, 1.0 = 100 percent - get_reference_spectrum(WhiteSpectrum) carries effective_bit_depth and integration_time attributes, which the flat out-parameter API lost - behavior tests flipped to fractions; they pass only against an SDK built with the fraction convention in reflectivity_on_grid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
cuvis.ReferenceTypegainsWhiteSpectrumandTargetSpectrum;has_reference/clear_referencework on them unchanged.ProcessingContext.set_referencebecomes polymorphic: the spectrum types take anImageDatacarrying wavelengths or a(wavelengths, values)array pair; a white counts spectrum requireseffective_bit_depth(1 to 16) and carriesintegration_time/load_level. Classic types keep the Measurement path; cross-usage is aTypeErrorbefore the C layer.ProcessingContext.get_reference_spectrum(refType)returns the slot as anImageData(1 x 1 x channels, wavelengths in nm) orNonewhen empty;get_referencestays Measurement-only.Why
Pitfalls
*_reference_spectrum*functions; CI will fail until thecubertgmbh/cuvis_pyil:3.5.3container carries that build.set_reference's first parameter is renamed frommesutodata; keyword callers usingmesu=break (positional callers are unaffected).effective_bit_depth,integration_time,load_level) is write-only; the C API exposes no getter, soget_reference_spectrumcannot return it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hrw1VcGnJiHXcfeHC8LHus