Skip to content

fix(evolve): raise error when IterEv > 1 for truncated evolution - #258

Open
ashishsoni-ai wants to merge 1 commit into
NNPDF:mainfrom
ashishsoni-ai:fix/truncated-iterations-error
Open

ashishsoni-ai wants to merge 1 commit into
NNPDF:mainfrom
ashishsoni-ai:fix/truncated-iterations-error

Conversation

@ashishsoni-ai

Copy link
Copy Markdown

Closes #176

Summary

This PR addresses issue #176 by enforcing validation of the evolution method configuration in write_operator_card:

  1. Raise error when iterations > 1 for truncated evolution (src/pineko/evolve.py):

  2. Fix literal comparison bug:

    • Corrected line 330 where if "IterEv" not in tcard and "ModEv" == "EXA": compared the string literal "ModEv" to "EXA", leaving the IterEv presence check for exact evolution dead. Changed to tcard["ModEv"] == "EXA".
  3. Guards for unsupported evolution methods:

    • Added an explicit else branch raising ValueError if tcard["ModEv"] is not recognized, preventing incomplete operator card generation.
  4. Unit Tests (tests/test_evolve.py):

    • Added test_write_operator_card_evolution_methods using the FakePine mock to verify:
      • Missing ModEv raises ValueError.
      • Unknown ModEv raises ValueError.
      • ModEv == "EXA" without IterEv raises ValueError.
      • ModEv == "EXA" with IterEv succeeds.
      • ModEv == "TRN" with IterEv > 1 raises ValueError.
      • ModEv == "TRN" with IterEv == 1 succeeds.

Verification

  • Tested locally with pytest tests/test_evolve.py: 2 passed (100%).
  • Formatted with black: 0 issues.
  • git diff --check: 0 issues.

@ashishsoni-ai
ashishsoni-ai force-pushed the fix/truncated-iterations-error branch from 11d7b48 to 3915685 Compare November 5, 2026 05:04

This branch has not been deployed

No deployments
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.

Raise an error when the number of iterations > 1 for truncated

1 participant