Skip to content

Conversation

@Zeyna777
Copy link
Contributor

@Zeyna777 Zeyna777 commented Sep 25, 2025

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Zeyna777 Zeyna777 requested review from Copilot and redeboer and removed request for Copilot September 25, 2025 14:09
@Zeyna777 Zeyna777 self-assigned this Sep 25, 2025
@Zeyna777 Zeyna777 added the ✨ Feature New feature added to the package label Sep 25, 2025
@Zeyna777
Copy link
Contributor Author

As discussed, something is off with the threshold. But otherwise a good step forward! Image

adressed by 733a192

@redeboer redeboer force-pushed the analytic_phasespace_factor branch 2 times, most recently from 7ba935b to dd59569 Compare September 26, 2025 12:03
@redeboer redeboer force-pushed the analytic_phasespace_factor branch from dd59569 to 62af95b Compare September 26, 2025 12:04
@redeboer redeboer force-pushed the analytic_phasespace_factor branch from ee552b2 to 33f9158 Compare September 26, 2025 12:19
@redeboer redeboer force-pushed the analytic_phasespace_factor branch from aaa4358 to 4f3bf42 Compare September 26, 2025 13:30
Comment on lines +172 to +207
@unevaluated
class PhaseSpaceFactorPWave(sp.Expr):
r"""Phase space factor using `ChewMandelstamIntegral` for :math:`L=1`.
This `PhaseSpaceFactor` uses the numerical dispersion integral implemented in
`ChewMandelstamIntegral`. As such, you have to be careful when lambdifying this
function and evaluating this over an array. In many cases, you want to wrap the
resulting lambdified numerical function with :func:`numpy.vectorize`.
>>> import numpy as np
>>> from ampform.dynamics.phasespace import PhaseSpaceFactorPWave
>>> s, m1, m2 = sp.symbols("s m_1 m_2")
>>> rho_expr = PhaseSpaceFactorPWave(s, m1, m2)
>>> rho_func = sp.lambdify((s, m1, m2), rho_expr.doit())
>>> rho_func = np.vectorize(rho_func)
>>> s_values = np.linspace(0.1, 4.0, num=4)
>>> rho_func(s_values, 0.14, 0.98).real
array([-4.08315014e-07, 8.05561163e-03, 2.65015019e-01, 5.43083429e-01])
"""

s: Any
m1: Any
m2: Any
name: str | None = argument(default=None, sympify=False)

def evaluate(self) -> sp.Expr:
s, m1, m2 = self.args
chew_mandelstam = ChewMandelstamIntegral(s, m1, m2, L=1, epsilon=1e-5)
return -sp.I * chew_mandelstam

def _latex_repr_(self, printer: LatexPrinter, *args) -> str:
s_symbol = self.args[0]
s_latex = printer._print(s_symbol)
subscript = _indices_to_subscript(determine_indices(s_symbol))
name = R"\rho^\mathrm{CM}_1" + subscript if self.name is None else self.name
return Rf"{name}\left({s_latex}\right)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a check whether a wrapped dispersion integral works, plus a bit of documentation with regard to vectorisation. We have to find a solution for the fact though that the PhaseSpaceFactorProtocol only allows for the keyword arguments s, m1, and m2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature New feature added to the package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install jupyterlab-quickopen in jupyter dependency group Define lab task for Poe the Poet

3 participants