zfit / phasespace

Phase space generation implemented in TensorFlow
https://phasespace.rtfd.io
BSD 3-Clause "New" or "Revised" License
24 stars 9 forks source link

Add numpy/tensor generation #18

Closed apuignav closed 5 years ago

apuignav commented 5 years ago

Addresses #15.

Still missing, how to deal with boost_to in the iterator case.

apuignav commented 5 years ago

I'm happy now. If you agree, I fix the docs and we're ready to release 1.0.0.

apuignav commented 5 years ago

Open question, the way we implemented things now, I am not sure about the caching anymore.

from phasespace import Particle

B0_MASS = 5279.58
KSTARZ_MASS = 895.81
PION_MASS = 139.57018
KAON_MASS = 493.677

pion = Particle('pi+', PION_MASS)
kaon = Particle('K+', KAON_MASS)
kstar = Particle('K*', KSTARZ_MASS).set_children(pion, kaon)
gamma = Particle('gamma', 0)
bz = Particle('B0', B0_MASS).set_children(kstar, gamma)

for i in range(10):
       weights, particles = bz.generate(n_events=1000)
       ...
       (do something with weights and particles)
       ...

Does this actually cache the graph? Since in generate it's recreated from scratch.

jonas-eschle commented 5 years ago

You're right, it does not yet, wanted to get things working again first, which is good now. I'll implement it, it should be very simple.

apuignav commented 5 years ago

Great! Other than that it's working, and docs should be up to date!

jonas-eschle commented 5 years ago

Good! I'll tackle it tomorrow