Discussion of Python in High Energy Physics https://hepsoftwarefoundation.org/activities/pyhep.html
:=
.” - as you may know, that’s no longer true, Python 3.8 will have :=
(along with shared memory multiprocessing and positional-only parameters)
print(f”{1+2=}")
prints 1+2=3
Dear all,
as part of our work in zfit, we have released a standalone package for multibody phasespace generation à la TGenPhaseSpace. It's pure python, based of tensorflow. On top of simple phasespace generation, it can build more complex decay chains, handle resonances, etc, all in a very simple manner.
The package is called phasespace (https://github.com/zfit/phasespace), it's well documented and fairly easy to use, so no excuses for not trying :-)
Let us know what you think, we highly appreciate any feedback and suggestions from the software community here
Jonas+Albert
stupid question. I have two numpy arrays, a
, and b
and I want to group elements in b
by the unique elements in a
, i.e.
a = [1, 12, 1, 50]
b = [10, 20, 30, 40]
result == [[10, 30], [20], [50]]
Is there a numpy function that does that? It seems I am missing the right keyword in my searches
numpy groupby
will get you there
I think awkward array might be able to help instead of pandas (not tested):
reorder = np.argsort(a)
_, counts = np.unique(a[reorder], return_counts=True)
result = awkard.JaggedArray.fromcounts(counts, b[reorder])
The only thing I'm unsure of there is the order of the unique counts, I'm assuming the unique
method returns things in the order they're first seen, but I suspect that's not true.
Dear colleague,
We are pleased to announce the second "Python in HEP" workshop organised by the HEP Software Foundation (HSF). The PyHEP, "Python in HEP", workshops aim to provide an environment to discuss and promote the usage of Python in the HEP community at large.
PyHEP 2019 will be held in Abingdon, near Oxford, United Kingdom, from 16-18 October 2019.
The workshop will be a forum for the participants and the community at large to discuss developments of Python packages and tools, exchange experiences, and steer where the community needs and wants to go. There will be ample time for discussion.
The agenda will be composed of plenary sessions, a highlight of which is the following:
1) A keynote presentation from the Data Science domain.
2) A topical session on histogramming including a talk and a hands-on tutorial.
3) Lightning talks from participants.
4) Presentations following up from topics discussed at PyHEP 2018.
We encourage community members to propose presentations on any topic (email: pyhep2019-organisation@cern.ch). We are particularly interested in new(-ish) packages of broad relevance.
The agenda will be made available on the workshop indico page (https://indico.cern.ch/event/833895/) in due time. It is also linked from the PyHEP WG homepage http://hepsoftwarefoundation.org/activities/pyhep.html.
Registration will open very soon, and we will provide detailed travel and accommodation information at that time.
Travel funds may be available at a modest level. To be confirmed once registration opens.
You are encouraged to register to the PyHEP WG Gitter channel (https://gitter.im/HSF/PyHEP) and/or to the HSF forum (https://groups.google.com/forum/#!forum/hsf-forum) to receive further information concerning the organisation of the workshop.
Looking forward to your participation!
Eduardo Rodrigues & Ben Krikler, for the organising committee
NOTICE: This domain name expired on 7/11/2019 and is pending renewal or deletion.
import numpy as np, awkward
a = np.array([1, 12, 1, 10, 50, 10])
b = np.array([10, 20, 30, 40, 50, 60])
arg = a.argsort(kind='stable')
offsets, = np.where(np.r_[True, np.diff(a[arg]) > 0])
output = awkward.JaggedArray.fromoffsets(offsets.flatten(), awkward.IndexedArray(arg, b))
np.where([0, 1, 0, 0, 1])[0].base
is surprisingly 2d (hence the flatten)