Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UpdateNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ ANNOUNCEMENT:
A new LTS (based on the current 3.5.X) is starting now and will act as the stable release for the coming years.

0.4.0 (XX/XX/XX):
OM: NLO outputs made with Python 3.14 never certified the G scaling of the helicity
masks (helicity_signature.json mode exact_compact_state instead of homogeneous_G):
the coupling-degree analysis used ast.Num, removed in Python 3.14, so every coupling
came out of unknown degree. With a dynamical scale each Born and real-emission call
then relearned its helicity mask, summing all helicities, at every change of alpha_s.
OM: madevent rejected every phase-space point with a dynamical factorisation scale below
2 GeV whenever lpp was not 0, a floor that only makes sense for hadron PDFs: it
silently cut the threshold region, e.g. 27% of PbPb > a a > ta+ ta- at 5.52 TeV
Expand Down
15 changes: 11 additions & 4 deletions madgraph/iolibs/born_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,15 @@ def variable(name):
finally:
visiting.remove(name)

def number(node):
# Numeric literals are ast.Constant nodes; ast.Num, its deprecated
# alias, no longer exists in Python 3.14, where every coupling then
# came out of unknown degree and no output certified G scaling.
return (isinstance(node, ast.Constant) and not isinstance(node.value, bool)
and isinstance(node.value, (int, float, complex)))

def expression(node):
# Num also recognizes numeric Constant nodes on Python >= 3.8.
if isinstance(node, ast.Num):
if number(node):
return Fraction(0)
if isinstance(node, ast.Name):
return variable(node.id)
Expand All @@ -397,8 +403,9 @@ def expression(node):
return left-right
if isinstance(node.op, (ast.Add, ast.Sub)) and left == right:
return left
if isinstance(node.op, ast.Pow) and isinstance(node.right, ast.Num):
return left*Fraction(node.right.n)
if (isinstance(node.op, ast.Pow) and number(node.right)
and not isinstance(node.right.value, complex)):
return left*Fraction(node.right.value)
if isinstance(node, ast.Call):
name = node.func.id if isinstance(node.func, ast.Name) else (
node.func.attr if isinstance(node.func, ast.Attribute) and
Expand Down
15 changes: 15 additions & 0 deletions tests/unit_tests/iolibs/test_real_helicity_filter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Numerical checks of the generated real-emission helicity loop."""

import ast
import copy
from pathlib import Path
import re
import shutil
import subprocess
import tempfile
import unittest
from unittest import mock

from madgraph.iolibs import born_support as support
from madgraph.core.base_objects import ModelVariable, ParamCardVariable
Expand Down Expand Up @@ -141,6 +143,19 @@ def test_sm_and_heft_coupling_degrees(self):
with self.subTest(model=model_name, coupling=name):
self.assertEqual(degrees[name], degree)

def test_coupling_degrees_without_removed_ast_aliases(self):
# Python 3.14 removed ast.Num and the other literal aliases of
# ast.Constant. Using one made every coupling degree unknown, so no
# output certified G scaling. Hide them here on any Python version.
class Python314Ast:
def __getattr__(self, name):
if name in ('Num', 'Str', 'Bytes', 'NameConstant', 'Ellipsis'):
raise AttributeError(name)
return getattr(ast, name)

with mock.patch.object(support, 'ast', Python314Ast()):
self.test_sm_and_heft_coupling_degrees()

def run_driver(self, ncomb, nsqamps, driver, members=None, signature=None,
include_real=True, diagram_weights=False):
template = (ROOT/'madgraph/iolibs/template_files/'
Expand Down
Loading