Skip to content

update pytests to accuracy=high#594

Open
cdeline wants to merge 15 commits into
NatLabRockies:developmentfrom
cdeline:593_rtrace
Open

update pytests to accuracy=high#594
cdeline wants to merge 15 commits into
NatLabRockies:developmentfrom
cdeline:593_rtrace

Conversation

@cdeline
Copy link
Copy Markdown
Contributor

@cdeline cdeline commented Apr 10, 2026

  • Code changes are covered by tests
    [ ] Code changes have been evaluated for compatibility/integration with GUI
    [ ] New functions added to __init__.py
    [ ] manualapi.rst is up to date, along with other sphinx docs pages
  • Example notebooks are rerun and differences in results scrutinized
  • Updated changelog

@cdeline
Copy link
Copy Markdown
Contributor Author

cdeline commented Apr 10, 2026

need to update version of RADIANCE used by CI.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to reduce CI variability in Radiance-based tests by switching some pytest runs to higher radiance tracing accuracy, and updates CI to use a newer Radiance distribution.

Changes:

  • Update selected pytest assertions and calls to use accuracy='high' in 1-axis cumulative-sky tests.
  • Add accuracy: high to some test .ini files and adjust tolerances/expected values for stability.
  • Update GitHub Actions pytest workflow to install a newer Radiance release and run tests under xvfb.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/test_gencumsky.py Improves debug output formatting for gencumsky modelchain test.
tests/test_bifacial_radiance.py Uses accuracy='high' for some 1-axis analyses and tweaks tolerances/expected values.
tests/ini_highAzimuth.ini Adds accuracy / debug options intended to reduce variability for the high-azimuth modelchain test.
tests/ini_gencumsky.ini Adds accuracy: high intended to reduce variability for gencumsky modelchain test.
docs/sphinx/source/whatsnew/pending.rst Adds pending release notes documenting the pytest/CI changes.
.github/workflows/pytest.yaml Switches CI Radiance install to a newer distribution and replaces the xvfb action with xvfb-run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/sphinx/source/whatsnew/pending.rst
Comment thread docs/sphinx/source/whatsnew/pending.rst Outdated
Comment thread tests/ini_highAzimuth.ini Outdated
Comment on lines +48 to +49
accuracy: high
debug: True
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

analysisParamsDict entries like accuracy: high and debug: True added here are not currently consumed by the modelchain path used in test_Radiance_high_azimuth_modelchains (runModelChain calls analysis.analysis(...) / demo.analysis1axis(...) without forwarding these options). This makes the config misleading and won’t actually reduce test variability. Either plumb analysisParamsDict.get('accuracy') (and debug, if desired) through modelchain into the analysis calls, or remove these keys from the ini to avoid implying they have an effect.

Suggested change
accuracy: high
debug: True

Copilot uses AI. Check for mistakes.
Comment thread tests/ini_gencumsky.ini
sensorsy: 9
modWanted: 5
rowWanted: 2
accuracy: high
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

accuracy: high is added to analysisParamsDict here, but the fixed-tilt cumulative-sky modelchain code path (used by tests/test_gencumsky.py::test_SingleModule_gencumsky_modelchain) does not currently pass an accuracy value into AnalysisObj.analysis(...), so this setting has no effect. Consider updating modelchain to forward analysisParamsDict.get('accuracy', 'low') into the analysis call (or drop this ini key if it’s not intended to be supported).

Suggested change
accuracy: high

Copilot uses AI. Check for mistakes.
Comment on lines 110 to +113
assert np.mean(results.Wm2Front[0]) == pytest.approx(899, rel = 0.005) # was 912 in v0.2.3
assert np.mean(results.Wm2Back[0]) == pytest.approx(189, rel = 0.03) # was 182 in v0.2.2
assert results.Pout[0] == demo2.compiledResults.Pout[0] == pytest.approx(369, abs= 1)
assert results.Mismatch[0] == pytest.approx(2.82, abs = .1)
assert results.Mismatch[0] == pytest.approx(2.82, abs = .15)
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

This test loosens the Mismatch tolerance, but it still won’t benefit from accuracy: high being added to ini_highAzimuth.ini because the modelchain path doesn’t currently propagate analysisParamsDict['accuracy'] into the analysis step. If the goal is to reduce variability, it would be better to plumb the ini’s accuracy setting through modelchain (so the test truly runs with high accuracy) rather than compensating by widening assertions.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/pytest.yaml Outdated
Comment on lines +37 to +43
- name: Install Radiance v5.3
run: |
wget https://github.com/LBNL-ETA/Radiance/releases/download/012cb178/Radiance_012cb178_Linux.zip -O radiance.zip
#wget https://github.com/LBNL-ETA/Radiance/releases/download/012cb178/Radiance_012cb178_Linux.zip -O radiance.zip
wget https://github.com/LBNL-ETA/Radiance/releases/download/rad6R0P2/Radiance_c1700d56_Linux.zip -O radiance.zip
unzip radiance.zip
tar -xvf radiance-5.3.012cb17835-Linux.tar.gz
#tar -xvf radiance-5.3.012cb17835-Linux.tar.gz
tar -xvf radiance-6.0.c1700d56cc-Linux.tar.gz
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The step name says “Install Radiance v5.3”, but the commands now download/extract Radiance 6.0 (rad6R0P2 / radiance-6.0...). Please update the step name (and/or remove the commented-out v5.3 lines) to match what’s actually installed, so future debugging doesn’t get misleading signals.

Copilot uses AI. Check for mistakes.
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26662835530

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Warning

No base build found for commit fa5f784 on development.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 74.781%

Details

  • Patch coverage: 3 of 3 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 5361
Covered Lines: 4009
Line Coverage: 74.78%
Coverage Strength: 0.75 hits per line

💛 - Coveralls

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