Skip to content

Commit

Permalink
take iter values from the template but fail if the evolution method i…
Browse files Browse the repository at this point in the history
…s different
  • Loading branch information
scarlehoff committed May 6, 2024
1 parent e966b6d commit 4b73e8a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/pineko/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,23 @@ def write_operator_card(pineappl_grid, default_card, card_path, tcard):
"EXA used but IterEv not found in the theory card and not ev_op_iterations set in the template"
)

# If the information was also in the template _and it is different_, warn
for key in ["evolution_method", "ev_op_iterations"]:
defval = default_card["configs"].get(key)
if defval is not None and defval != opconf[key]:
logger.warning(f"Using {key} from theory instead of template")
# If the evolution method is defined in the template and it is different, fail
template_method = default_card["configs"].get("evolution_method")
if (
template_method is not None
and template_method != opconf["evolution_method"]
):
raise ValueError(
f"The template and the theory have different evolution method ({template_method} vs {opconf['key']})"
)

# If the change is on the number of iterations, take the template value but warn the user
template_iter = default_card["configs"].get("ev_op_iterations")
if template_iter is not None and template_method != opconf["ev_op_iterations"]:
opconf["ev_op_iterations"] = template_iter
logger.warning(
f"The number of iteration in the theory and template is different, using template value ({template_iter})"
)

# Some safety checks
if (
Expand Down

0 comments on commit 4b73e8a

Please sign in to comment.