Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEHAVIOR: insert parity prefactor as sympy.Rational #322

Merged
merged 3 commits into from
Aug 9, 2022
Merged
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
19 changes: 12 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,21 @@ def get_minor_version(package_name: str) -> str:
"https://suchung.web.cern.ch",
]


# Settings for myst_nb
def get_execution_mode() -> str:
if "FORCE_EXECUTE_NB" in os.environ:
print("\033[93;1mWill run ALL Jupyter notebooks!\033[0m")
return "force"
if "EXECUTE_NB" in os.environ:
return "cache"
return "off"


nb_execution_mode = get_execution_mode()
nb_execution_timeout = -1
nb_output_stderr = "remove"

nb_execution_mode = "off"
EXECUTE_NB = False
if "EXECUTE_NB" in os.environ:
print("\033[93;1mWill run Jupyter notebooks!\033[0m")
EXECUTE_NB = True
nb_execution_mode = "cache"
EXECUTE_NB = nb_execution_mode != "off"

# Settings for myst-parser
myst_enable_extensions = [
Expand Down
4 changes: 2 additions & 2 deletions src/ampform/helicity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def __generate_helicity_coupling(

def __generate_amplitude_prefactor(
self, transition: StateTransition
) -> float | None:
) -> sp.Rational | None:
prefactor = get_prefactor(transition)
if prefactor != 1.0:
for node_id in transition.topology.nodes:
Expand All @@ -552,7 +552,7 @@ def __generate_amplitude_prefactor(
raw_suffix
]
if coefficient_suffix != raw_suffix:
return prefactor
return sp.Rational(prefactor)
return None


Expand Down
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ commands =
-b html \
docs/ docs/_build/html

[testenv:docnb-force]
description =
Execute ALL Jupyter notebooks and build documentation with Sphinx
allowlist_externals =
sphinx-build
passenv =
READTHEDOCS_VERSION
TERM
setenv =
FORCE_EXECUTE_NB = yes
PYTHONHASHSEED = 0
commands =
sphinx-build -nW --keep-going -b html docs/ docs/_build/html

[testenv:jcache]
description =
Inspect Jupyter cache
Expand Down