owned this note
owned this note
Published
Linked with GitHub
## Mon 7/31/2023
*Present: Alex Austregesilo, Amy Schertz, Boris Grube, Edmundo Barriga, Farah Afzal, Justin Stevens, Kevin Scheuer, Lawrence Ng, Malte Albrecht, Remco de Boer*
- Code can be collected here: https://github.com/compwa/gluex-amplitude
- Please post your GitHub name [here](https://github.com/compwa/gluex-amplitude/issues/1) if you want to get access rights
- For now (tick once merged):
- [x] code for AmpTools model building goes into the [`amptools`](https://github.com/compwa/gluex-amplitude/tree/amptools) branch
- [x] code for the python implementation goes into the [`sympy`](https://github.com/compwa/gluex-amplitude/tree/sympy) branch
--> output HTML rendered on [compwa.github.io/gluex-amplitude](https://compwa.github.io/gluex-amplitude)
### Draft Strategy
- **Goal 0**: reproduce intensity for single amplitude of [AmpTools](https://github.com/mashephe/AmpTools)+[Zlm](https://github.com/JeffersonLab/halld_sim/blob/master/src/libraries/AMPTOOLS_AMPS/Zlm.cc) with symbolic python implementation
$$
\begin{eqnarray}
I(\Omega,\Phi) & = & 2\kappa\sum_{k}\big( \\
& & (1-P_{\gamma})\left[\sum_{l,m}[l]_{m;k}^{(-)}\Re[Z_{l}^{m}(\Omega,\Phi)]\right]^2 \\
&+& (1-P_{\gamma})\left[\sum_{l,m}[l]_{m;k}^{(+)}\Im[Z_{l}^{m}(\Omega,\Phi)]\right]^2 \\
&+& (1+P_{\gamma})\left[\sum_{l,m}[l]_{m;k}^{(+)}\Re[Z_{l}^{m}(\Omega,\Phi)]\right]^2 \\
&+& (1+P_{\gamma})\left[\sum_{l,m}[l]_{m;k}^{(-)}\Im[Z_{l}^{m}(\Omega,\Phi)]\right]^2
\big)
\end{eqnarray}
$$
- **Goal 1**: reproduce full intensity formulation from 4 coherent sums in two-pseudoscalar model
- *Pro*: avoid mistakes in AmpTools configuration files with constrained parameters, etc.
- *Con*: lose factorized amplitude structure. reduced speed due to parameters internal to amplitude model?
- **Goal 2**: compare performance of CPU and GPU with AmpTools and symbolic python
- *Pro*: avoid writing duplicate code in C++ and CUDA kernel?
- *Con*: reduced speed?
- **Goal 3**: experiment with PWA framework comparisons in preparation for a more general PWA sanity check repository/package. See [discussions at PyHEP.dev 2023](https://hackmd.io/0BFYQxh-T5WIUOMxXQo3QA?view#Amplitude-analysis-PWA).
## Tue 8/1/2023 (open analysis meeting)
- Updates:
- Skeleton SymPy implementation has been implemented ([compwa/gluex-amplitude#2](https://github.com/compwa/gluex-amplitude/pull/2))
- Infrastructure to compile AmpTools with additional amplitude classes is ready ([compwa/gluex-amplitude#3](https://github.com/compwa/gluex-amplitude/pull/3))
- Implemented widget for inspecting amplitude model behavior over $(\theta,\phi)$ phase space ([compwa/gluex-amplitude#8](https://github.com/compwa/gluex-amplitude/pull/8))
- Up-to-date status overview of implemented features on the project board:
https://github.com/users/redeboer/projects/7/views/3
- Next steps:
- **C++**
- Create script for two-pseudoscalar amplitude model (Malte)
- Plot and/or evaluate over phase space sample or single point
- **Python**
- Provide default values for $[l]^{\pm}_{m;k}$
- Plot over $\left(\theta, \phi, \Phi\right)$ phase space sample
- Widget that allows modifying $[l]^{\pm}_{m;k}$ parameters?
- Note that control needs to be added for defining a phase and a magnitude
- Questions:
- What about combining intensity functions in several estimators?
- Add mass-dependence?
--> Example here: https://lc2pkpi-polarimetry.docs.cern.ch/amplitude-model.html#sub-system-amplitudes
## Wed 8/2/2023
- _See overview of closed PRs [here](https://github.com/users/redeboer/projects/7/views/4?filterQuery=end%3A2023-08-02+status%3A%22%E2%9C%94%EF%B8%8F+Done%22) on the project board_
- Widget can now handle higher values of $l$ and all combinations for the corresponding $m$
- Improvements to the main website https://redeboer.github.io
- On the question whether SymPy expressions can be used as template to C++ code (and therefore potentially fed into AmpTools): Boris found that it may be possible to convert the expression to JAX, then generate XLA code, and then feeding that to C++ code. See https://github.com/google/jax/issues/5337.
- Created a general Slack channel for PWA / Amplitude Analysis:
https://amplitude-analysis.slack.com
https://join.slack.com/t/amplitude-analysis/shared_invite/zt-20eqvwbg6-~KbrYI_F6FAiFmVaUpQoPA (temporary link)
Not sure whether the number of participants for this free channel is limited ([pricing](https://slack.com/pricing/paid-vs-free) doesn't mention it), but we could potentially use it as a general PWA software channel.
- Minuit with autodiff: there's a PR that attempts to do this with a PWA example. Performance for this example of numerical vs autodiff is similar (autodiff is a bit faster), but the example has to be made more realistic.
https://github.com/ComPWA/compwa-org/pull/195
- Discussion about parallelizing JAX: yes, possible with [`mpi4jax`](https://mpi4jax.readthedocs.io). Syntax is almost completely similar to MPI in C++, so looks promising. Would be nice to investigate in a similar PR as the one for the autodiff.
- amptools intensity comparison ![](https://hackmd.io/_uploads/ryz_tLui2.jpg)
## Thu 8/2/2023
- Seminar on PWA with symbolic amplitude models, questions:
- Beni: Symbolics and debugging experience
- Justin: Mathematica - SymPy interfacing? What about SymPy performance?
- Matt: Can the symbolic representation be used
--> https://github.com/ComPWA/ampform-dpd/pull/38#issuecomment-1655644812
- Matt: Can we interface (compiled) JAX/XLA code to C++?
--> https://github.com/google/jax/issues/1871
--> https://github.com/google/jax/issues/5337
--> Matt: would have to be inserted in AmpTools somewhere here"
https://github.com/mashephe/AmpTools/blob/48fda72/AmpTools/UpRootMinuit/URMinuit.cc#L3171-L3190
- Afternoon session:
- Alex: what about adding Python bindings (e.g. [`pybind11`](https://pybind11.readthedocs.io)) to AmpTools and using that to feed a JAX function?
--> Example of how it was done for ComPWA++: https://github.com/ComPWA/pycompwa/blob/c83da61/src/pycompwa/ui.cpp
- Matt mentioned python bindings would be good for creating complex cfg files using the cfgInfo class. Matt has a root script that does looping and cfg file exporting
- **What about caching with a generic, large function that comes from a symbolic expression?**
Minuit only changes a handful of parameters at each iteration, only parts of the intensity that changes is recalculated. AmpTools takes care of that smartly, and it can only do that if the intensity model is built up of C++ functions over which we have full control.
- Jax might be able to do caching of intermediate result (?) Alternatively you could use calculated at Zlm amps as the data instead of kinematics
-> **We need to test/benchmark this**
- Would be interesting for Minuit2: feed the analytic derivative of only certain parameters. That would ([in the case of JAX](https://github.com/ComPWA/compwa-org/pull/195#issuecomment-1632735521)) greatly reduce the memory footprint and (for C++) remove the need to implement _all_ derivatives.
- Matt: AmpTools seems to do that here: https://github.com/mashephe/AmpTools/blob/48fda72/AmpTools/UpRootMinuit/URMinuit.cc#L1906-L2030
- Boris actually made a PR to Minuit2 about an analytic second derivate
https://sft.its.cern.ch/jira/browse/ROOT-3513
## Friday 8/4/2023
- How to follow-up on these meetings after this week?
- Purpose of Slack workspace. Do we need privat sub-channels, like #gluex?
- Follow-up to the comparison
- https://github.com/redeboer/gluex-amplitude repo
- Amplitude analysis roundtable, like HSF roundtables. Low-frequency! Once per month/quarter
--> if you hear of any projects or analysis that you think are interesting to have presented to a general audience, propose to organise a Roundtable in the Slack
- Perhaps like [PHASE-network](https://github.com/PHASE-network)
- List of PWA projects:
- https://phase-network.github.io//articles/fitter-collection/
- https://pwa.readthedocs.io/software.html
- https://github.com/dglazier/HASPECT6
- https://github.com/dglazier/brufit