Skip to content

Add systematic tests to mg7#32

Merged
Qubitol merged 6 commits into
mainfrom
ci-28-systematically-testing-mg7
Jul 17, 2026
Merged

Add systematic tests to mg7#32
Qubitol merged 6 commits into
mainfrom
ci-28-systematically-testing-mg7

Conversation

@Qubitol

@Qubitol Qubitol commented Jul 9, 2026

Copy link
Copy Markdown
Member

This implements #28.

Tests are defined in the metadata file tests/check_xsec_processes/reference.json.
All the processes listed in #28 are reported, but we may want to run a smaller set.

Additionally, the MadSpace installation has been made into a single shared action, that can be used by multiple workflows to build, install, and cache it, without code duplication.

TODO We need to decide when to run the workflow, if manually, on push, on push to dev/main, or similar.

Qubitol added 2 commits July 9, 2026 17:08
Truth value is reported in #28.
Processes metadata are reported in
tests/check_xsec_processees/reference.json
Tolerance and number of events can be set on the workflow file.
@Qubitol Qubitol linked an issue Jul 9, 2026 that may be closed by this pull request
2 tasks
@Qubitol Qubitol added this to the Alpha release milestone Jul 9, 2026
Especially for testing purposes, we make the workflow runnable when
pushing to the repository.
@oliviermattelaer

Copy link
Copy Markdown
Contributor

Hi @Qubitol.

Would it be possible to keep this within the test_manager.py framework ?
The constraints are that:

  1. all tests are within a class that depend of unitest.TestCase
  2. each test/process is associated to a function of that class starting with test_
  3. put the files in parralel_test (or acceptance_test)

In principle then the CI can then use test_manager.py to launch such test (which will be nice when I would implement a nice action for running such tests (which is not the case for the moment).
The main point is to have a single way to run all the tests and to be sure that all tests can be run locally.
(in top of the CI obviously)

After that how do you want to proceed?
Do you want to merge this as failing CI? and fix those in another branch? or let Theo fix those in this branch?

@Qubitol

Qubitol commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

I agree on all the points you raised, I will fix this to make sure it depends on the test manager.

Regarding the failing: if it is related only to the physics processes themselves, then my idea would be to merge as failing CI, and we can check each process separately until it satisfies the cross section.

@theoheimel

theoheimel commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Maybe we should define the threshold based on the MC integration error, i.e. something like (mean - mean_ref) / (sigma**2 + sigma_ref**2)**0.5 < thresh

Qubitol and others added 2 commits July 10, 2026 14:38
The systematic cross-section CI self-skipped with
"NNPDF23_lo_as_0130_qed LHAPDF data not found" because it relied on the
NNPDF23 grid being pre-baked into the HEPTools cache, which is not
guaranteed.

The mg7 runtime reads the PDF grid directly from
$LHAPDF_DATA_PATH/<set>/<set>_0000.dat (mg7/madevent.py, ms.PdfGrid), so
it only needs the grid data -- not the LHAPDF C++ library. Add an
install_lhapdf_pdfset composite action that installs the set with the
lhapdf-management package into a cached, writable dir and exports
LHAPDF_DATA_PATH, and wire it into the workflow in place of the fragile
restore_heptools_lhapdf dependency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per reviewer request, replace the standalone
run_check_xsec_processes.py driver with a unittest.TestCase
(tests/acceptance_tests/test_check_xsec_processes_mg7.py) that generates
one test_<section>_<id>_mg7 method per process from the reference table,
so the whole suite is discoverable and launchable through
tests/test_manager.py -- the single, locally-runnable entry point used by
the other mg7 acceptance tests.

The tolerance and event count stay settable via the MG7_XSEC_TOLERANCE /
MG7_XSEC_EVENTS environment variables. The workflow now launches each
section with a regexp, e.g.
    ./tests/test_manager.py test_ttx_decay_.*_mg7 -pA -t0
and the reference table moves next to the test as
check_xsec_processes_reference.json.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Qubitol

Qubitol commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

Yes, that's a good idea.
Also, at this point, these tests should use the test manager.
Also, there are two points to discuss:

  • do we allow generating different numbers of events for different processes? I was thinking maybe some need more events to better converge (even though the weighted threshold would make this requirement less stringent)
  • when do we want to run these tests? At every push? Or only for commits to main or commits mentioning validation explicitly (it can be a trigger to run it now and then), or only manually?

@oliviermattelaer

Copy link
Copy Markdown
Contributor

At this stage I would be agressive on when to run those.
This means every push and every PR which are from external contributor (since they do not have the push CI in that case -- this is the reason why so many test are skipped actually)

If this is too much, then we will be able to reduce that in the future

@theoheimel

theoheimel commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Regarding the first point: we should have some generic way to change run card options for some processes, like cuts for the ones with decays, or number of events for other ones should we find that is necessary. Could be as simple as a list of key-value pairs added to the json, and then the set command is applied for those.

@oliviermattelaer oliviermattelaer mentioned this pull request Jul 15, 2026
@oliviermattelaer

Copy link
Copy Markdown
Contributor

I would propose to merge this, right away and then do a follow up PR where we handle the way to use the set command.
If you agree please merge this. (Thanks a lot @Qubitol )

@Qubitol

Qubitol commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

I would propose to merge this, right away and then do a follow up PR where we handle the way to use the set command. If you agree please merge this. (Thanks a lot @Qubitol )

Ok, good for me, then.
Let's merge.

@Qubitol
Qubitol marked this pull request as ready for review July 17, 2026 10:55
@Qubitol
Qubitol merged commit 9e85ab0 into main Jul 17, 2026
455 of 465 checks passed
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.

Systematically testing MG7

3 participants