Repository navigation
Feature/local background subtraction - #131
ManuelOsburg wants to merge 5 commits into
Conversation
The LED intensity sum_col_value is a plain sum over the search box and therefore contains scene-dependent background (stray light, smoke path radiance). Under smoke the LED dims while the background remains, biasing the transmission high and the reconstructed extinction coefficient low. Add a new quantity bgsub_sum_col_value computed alongside the existing sums: the local background is estimated as the median of the positive pixels in a 2 px border ring of the search area (zeros are excluded because raw Bayer arrays mask foreign-channel pixels with 0) and subtracted pixel-wise with clipping at 0 before summing. The value is written as an additional CSV column and picked up by the HDF aggregation, so it can be selected in the analysis via reference_property = bgsub_sum_col_val. Defaults are unchanged: sum_col_value is not modified and old CSV files still parse correctly.
Test with a synthetic Gaussian LED spot plus constant background that bgsub_sum_col_value is independent of the background level and matches the pure LED integral (also with a Bayer-like zero mask), while sum_col_value scales with the background. Also cover the background estimator edge cases and the HDF column name detection for old (5-column) and new (6-column) CSV files.
…default results - new suite 07: bgsub reference property reproduces ground truth on clean images; default analysis results are bit-identical with and without the bgsub column (old data format); constant background biases sum_col_val but not bgsub_sum_col_val - test library: optional constant background for generated test images, reference_property parameter for analysis config and result checks, keywords to strip the bgsub column and compare result files
|
Hi Manuel, thanks for adding the feature. For traceability can you maybe elaborate the feature and model behind that here? Thank you! |
|
Hi Kristian, sure — here is the feature and the model behind it. What the feature adds. Step 3 computes one additional quantity per LED and image, bgsub_sum_col_value: the local background Median → robust against LED tails and hot pixels; positive-only → raw Bayer arrays mask foreign-channel pixels with exactly 0, which would otherwise pull the median to ~0; clip at 0 → masked pixels stay untouched. The analysis uses it only when reference_property = bgsub_sum_col_val is set in config_analysis.ini — the default pipeline is unchanged (verified bit-identical by the new acceptance suite 07, which also covers reading pre-existing 5-column step-3 files). The model behind it. The search-area sum contains, besides the LED, an additive background (ambient/stray light plus a small estimator noise floor) that does not dim with smoke. Because this floor which propagates to the extinction coefficient as Empirical basis (Hasenheide data, camera F1L). The LED-free border ring falls only to 0.86 of its reference value while the LED signal falls to 0.51 — direct evidence of light in the box that the smoke does not dim. The floor fraction measured independently from the ring time series ( |
…files read_hdf only builds analysis/channel0/all_parameters.h5 from the step 3 files if the binary does not exist yet. In the test "Default Analysis Is Not Changed By The Bgsub Column" the binary already existed from the previous suites, so both analysis runs read the same binary and the stripped files were never used. Remove the binary before each run. The strip keyword now also shortens the column header and takes the number of columns to keep, so it can simulate files of any older format. (cherry picked from commit ed7ddc9)
The noise on the input extinction coefficients was drawn without seed, so the rmse checks against the ground truth varied between runs (bgsub on clean images 0.039-0.066 against the bound 0.06 in repeated runs). create_test_data and create_test_data_stacked now seed the generator. The default seed is 1: with seed 0 the nonlinear solver misses image 3 of the test data (rmse 0.178; linear solver on the same data 0.014), while seeds 1-7 are fine (nonlinear rmse <= 0.036). This is a weak case of the nonlinear solver, not of the test bounds. (squashed from 1df8435 and db59b0b on ManuelOsburg/LEDSmokeAnalysis)
|
Hi Kristian, two test-only commits were added, so the step 3 output and
An update on the model, from the Hasenheide 2.0 data:
In my fork I built opt-in follow-ups on top of this PR. The defaults stay bit-identical:
If you are interested, I would offer them as separate PRs once #130 and #131 are merged. Would you merge these two as they are now? Best, |
No description provided.