Skip to content

[test] better spectral curves for testing#293

Merged
antond-weta merged 2 commits into
AcademySoftwareFoundation:mainfrom
antond-weta:test_curves
May 29, 2026
Merged

[test] better spectral curves for testing#293
antond-weta merged 2 commits into
AcademySoftwareFoundation:mainfrom
antond-weta:test_curves

Conversation

@antond-weta

Copy link
Copy Markdown
Contributor

Description

Generate spectral curves mimicking the camera, CMF and, illuminant and training data.
The curves approximate real world curves, and implemented in a form of parametric function, with only 4 numbers stored per curve.

Tests

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable. (Check if there is no
    need to update the documentation, for example if this is a bug fix that
    doesn't change the API.)
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
@codecov-commenter

codecov-commenter commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.32%. Comparing base (6d4276a) to head (cd7dd42).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #293   +/-   ##
=======================================
  Coverage   91.32%   91.32%           
=======================================
  Files          17       17           
  Lines        3551     3551           
  Branches      527      527           
=======================================
  Hits         3243     3243           
  Misses        308      308           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d4276a...cd7dd42. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


#include <nlohmann/json.hpp>
#include <fstream>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to include #include / #include ?

}

rta::core::SpectralData
create_hypothetical_illuminant( const std::string &type )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone seeing this method might think changing type might change the curve shape, but it won't right?

return generate_spectral_data( HypotheticalTrainingData );
}

void save_spectral_json(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to write units (= "relative") ?

Comment thread tests/test_data_helpers.cpp Outdated
// Where:
// a - amplitude
// b - central wavelength
// c - shape, c = c1 to the left of the central wavelength, c2 otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not what you do in the code.
The correct version would be

// Asymmetric Gaussian peak:
//   f(λ) = a * exp( - (λ - b)² / (2 c²) )
//   c = c1 for λ < b, c2 otherwise.
//   a = peak amplitude, b = center wavelength (nm), c = width (nm).

if you want to keep the code and update the comment

Signed-off-by: Anton Dukhovnikov <antond@wetafx.co.nz>
@antond-weta antond-weta merged commit 7d3619e into AcademySoftwareFoundation:main May 29, 2026
23 checks passed
@antond-weta antond-weta deleted the test_curves branch May 29, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants