{ "info": { "author": "Albert Puig Navarro", "author_email": "albert.puig@cern.ch", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Physics" ], "description": "==========\nPhaseSpace\n==========\n\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.2591993.svg\n :target: https://doi.org/10.5281/zenodo.2591993\n.. image:: https://img.shields.io/pypi/status/phasespace.svg\n :target: https://pypi.org/project/phasespace/\n.. image:: https://img.shields.io/pypi/pyversions/phasespace.svg\n :target: https://pypi.org/project/phasespace/\n.. image:: https://travis-ci.org/zfit/phasespace.svg?branch=master\n :target: https://travis-ci.org/zfit/phasespace\n.. image:: https://coveralls.io/repos/github/zfit/phasespace/badge.svg?branch=master\n :target: https://coveralls.io/github/zfit/phasespace?branch=master\n.. image:: https://readthedocs.org/projects/phasespace/badge/?version=stable\n :target: https://phasespace.readthedocs.io/en/latest/?badge=stable\n :alt: Documentation Status\n.. image:: https://badges.gitter.im/zfit/phasespace.svg\n :target: https://gitter.im/zfit/phasespace?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge\n :alt: Gitter chat\n\nPython implementation of the Raubold and Lynch method for `n`-body events using\nTensorFlow as a backend.\n\nThe code is based on the GENBOD function (W515 from CERNLIB), documented in [1]\nand tries to follow it as closely as possible.\n\nDetailed documentation, including the API, can be found in https://phasespace.readthedocs.io.\nDon't hesitate to join our `gitter`_ channel for questions and comments.\n\nIf you use phasespace in a scientific publication we would appreciate citations to the `zenodo`_ publication:\n\n.. code-block:: bibtex\n\n @article{phasespace-2019,\n title={phasespace: n-body phase space generation in Python},\n DOI={10.5281/zenodo.2926058},\n publisher={Zenodo},\n author={Albert Puig and Jonas Eschle},\n year={2019},\n month={Mar}}\n\nFree software: BSD-3-Clause.\n\n[1] F. James, Monte Carlo Phase Space, CERN 68-15 (1968)\n\n.. _zenodo: https://doi.org/10.5281/zenodo.2591993\n.. _Gitter: https://gitter.im/zfit/phasespace\n\n\nWhy?\n----\nLately, data analysis in High Energy Physics (HEP), traditionally performed within the `ROOT`_ ecosystem, has been moving more and more towards Python.\nThe possibility of carrying out purely Python-based analyses has become real thanks to the development of many open source Python packages,\nwhich have allowed to replace most ROOT functionality with Python-based packages.\n\nOne of the aspects where this is still not possible is in the random generation of `n`-body phase space events, which are widely used in the field, for example to study kinematics\nof the particle decays of interest, or to perform importance sampling in the case of complex amplitude models.\nThis has been traditionally done with the `TGenPhaseSpace`_ class, which is based of the GENBOD function of the CERNLIB FORTRAN libraries and which requires a full working ROOT installation.\n\nThis package aims to address this issue by providing a TensorFlow-based implementation of such function to generate `n`-body decays without requiring a ROOT installation.\nAdditionally, an oft-needed functionality to generate complex decay chains, not included in ``TGenPhaseSpace``, is also offered, leaving room for decaying resonances (which don't have a fixed mass, but can be seen as a broad peak).\n\n.. _ROOT: https://root.cern.ch\n.. _TGenPhaseSpace: https://root.cern.ch/doc/master/classTGenPhaseSpace.html\n\nInstalling\n----------\n\nTo install ``phasespace``, run this command in your terminal:\n\n.. code-block:: console\n\n $ pip install phasespace\n\nThis is the preferred method to install ``phasespace``, as it will always install the most recent stable release.\n\nFor the newest development version, which may be unstable, you can install the version from git with\n\n.. code-block:: console\n\n $ pip install git+https://github.com/zfit/phasespace\n\n\nHow to use\n----------\n\nThe generation of simple `n`-body decays can be done using the ``generate`` function of ``phasespace`` with a\nvery simple interface: one needs to pass the mass of the top particle and the masses of the children particle as\na list. For example, to generate `B^0\\to K\\pi`, we would do:\n\n.. code-block:: python\n\n import phasespace\n\n B0_MASS = 5279.58\n PION_MASS = 139.57018\n KAON_MASS = 493.677\n\n weights, particles = phasespace.generate(B0_MASS,\n [PION_MASS, KAON_MASS],\n n_events=1000)\n\nThis returns a numpy array of 1000 elements in the case of ``weights`` and a list of ``n particles`` (2) arrays of (1000, 4) shape,\nwhere each of the 4-dimensions corresponds to one of the components of the generated Lorentz 4-vector.\nAll particles are generated in the rest frame of the top particle; boosting to a certain momentum (or list of momenta) can be\nachieved by passing the momenta to the ``boost_to`` argument.\n\nBehind the scenes, this function runs the TensorFlow graph, but no caching of the graph or reusing the session is performed.\nIf we want to get the graph to avoid an immediate execution, we can use the `as_numpy` flag. Then, to produce the equivalent result\nto the previous example, we simply do:\n\n.. code-block:: python\n\n import tensorflow as tf\n\n with tf.Session() as sess:\n weights, particles = phasespace.generate(B0_MASS,\n [PION_MASS, KAON_MASS],\n n_events=1000,\n as_numpy=False)\n weights, particles = sess.run([weights, particles])\n\nSequential decays can be handled with the ``Particle`` class (used internally by ``generate``) and its ``set_children`` method.\nAs an example, to build the `B^{0}\\to K^{*}\\gamma` decay in which `K^*\\to K\\pi`, we would write:\n\n.. code-block:: python\n\n from phasespace import Particle\n\n B0_MASS = 5279.58\n KSTARZ_MASS = 895.81\n PION_MASS = 139.57018\n KAON_MASS = 493.677\n\n pion = Particle('pi+', PION_MASS)\n kaon = Particle('K+', KAON_MASS)\n kstar = Particle('K*', KSTARZ_MASS).set_children(pion, kaon)\n gamma = Particle('gamma', 0)\n bz = Particle('B0', B0_MASS).set_children(kstar, gamma)\n\n weights, particles = bz.generate(n_events=1000)\n\nWhere we have used the fact that ``set_children`` returns the parent particle.\nIn this case, ``particles`` is a ``dict`` with the particle names as keys:\n\n.. code-block:: pycon\n\n >>> particles\n {'K*': array([[ 1732.79325872, -1632.88873127, 950.85807735, 2715.78804872],\n [-1633.95329448, 239.88921123, -1961.0402768 , 2715.78804872],\n [ 407.15613764, -2236.6569286 , -1185.16616251, 2715.78804872],\n ...,\n [ 1091.64603395, -1301.78721269, 1920.07503991, 2715.78804872],\n [ -517.3125083 , 1901.39296899, 1640.15905194, 2715.78804872],\n [ 656.56413668, -804.76922982, 2343.99214816, 2715.78804872]]),\n 'K+': array([[ 750.08077976, -547.22569019, 224.6920906 , 1075.30490935],\n [-1499.90049089, 289.19714633, -1935.27960292, 2514.43047106],\n [ 97.64746732, -1236.68112923, -381.09526192, 1388.47607911],\n ...,\n [ 508.66157459, -917.93523639, 1474.7064148 , 1876.11771642],\n [ -212.28646168, 540.26381432, 610.86656669, 976.63988936],\n [ 177.16656666, -535.98777569, 946.12636904, 1207.28744488]]),\n 'gamma': array([[-1732.79325872, 1632.88873127, -950.85807735, 2563.79195128],\n [ 1633.95329448, -239.88921123, 1961.0402768 , 2563.79195128],\n [ -407.15613764, 2236.6569286 , 1185.16616251, 2563.79195128],\n ...,\n [-1091.64603395, 1301.78721269, -1920.07503991, 2563.79195128],\n [ 517.3125083 , -1901.39296899, -1640.15905194, 2563.79195128],\n [ -656.56413668, 804.76922982, -2343.99214816, 2563.79195128]]),\n 'pi+': array([[ 982.71247896, -1085.66304109, 726.16598675, 1640.48313937],\n [ -134.0528036 , -49.3079351 , -25.76067389, 201.35757766],\n [ 309.50867032, -999.97579937, -804.0709006 , 1327.31196961],\n ...,\n [ 582.98445936, -383.85197629, 445.36862511, 839.6703323 ],\n [ -305.02604662, 1361.12915468, 1029.29248526, 1739.14815935],\n [ 479.39757002, -268.78145413, 1397.86577911, 1508.50060384]])}\n\nThe `Particle` class is able to cache the graphs so it is possible to generate in a loop\nwithout overhead:\n\n.. code-block:: pycon\n\n for i in range(10):\n weights, particles = bz.generate(n_events=1000)\n ...\n (do something with weights and particles)\n ...\n\nThis way of generating is recommended in the case of large samples, as it allows to benefit from\nparallelisation while at the same time keep the memory usage low.\n\nIf we want to operate with the TensorFlow graph instead, we can use the `generate_tensor` method\nof `Particle`, which has the same signature as `generate`.\n\nMore examples can be found in the ``tests`` folder and in the `documentation`_.\n\n.. _documentation: https://phasespace.readthedocs.io/en/latest/usage.html\n\n\nPhysics validation\n------------------\n\nPhysics validation is performed continuously in the included tests (``tests/test_physics.py``), run through Travis CI.\nThis validation is performed at two levels:\n\n- In simple `n`-body decays, the results of ``phasespace`` are checked against ``TGenPhaseSpace``.\n- For sequential decays, the results of ``phasespace`` are checked against `RapidSim`_, a \"fast Monte Carlo generator for simulation of heavy-quark hadron decays\".\n In the case of resonances, differences are expected because our tests don't include proper modelling of their mass shape, as it would require the introduction of\n further dependencies. However, the results of the comparison can be expected visually.\n\nThe results of all physics validation performed by the ``tests_physics.py`` test are written in ``tests/plots``.\n\n.. _RapidSim: https://github.com/gcowan/RapidSim/\n\n\n\nContributing\n------------\n\nContributions are always welcome, please have a look at the `Contributing guide`_.\n\n.. _Contributing guide: CONTRIBUTING.rst\n\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zfit/phasespace", "keywords": "phasespace", "license": "BSD license", "maintainer": "zfit", "maintainer_email": "zfit@physik.uzh.ch", "name": "phasespace", "package_url": "https://pypi.org/project/phasespace/", "platform": "", "project_url": "https://pypi.org/project/phasespace/", "project_urls": { "Homepage": "https://github.com/zfit/phasespace" }, "release_url": "https://pypi.org/project/phasespace/1.0.2/", "requires_dist": [ "tensorflow (>=1.12.0)", "tensorflow-probability" ], "requires_python": ">=3.6", "summary": "TensorFlow implementation of the Raubold and Lynch method for n-body events", "version": "1.0.2" }, "last_serial": 5967472, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "eb741c7f0f20f639666f7ea63c432eba", "sha256": "cf99839473e8472a096cab2850a22c88bce440b2f9ad88a65e1e43dc8e14c182" }, "downloads": -1, "filename": "phasespace-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eb741c7f0f20f639666f7ea63c432eba", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 15565, "upload_time": "2019-10-13T14:02:25", "url": "https://files.pythonhosted.org/packages/c1/ec/a09a3bde02eb2eb5e0100f0d08996b1642e3f7526b97377fcb86bf54c095/phasespace-0.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0f425efb01778bb2b967ebe3011c85a", "sha256": "6e870657bcc873105304eb27dd953e951117e261c13e34b2dc5eb34a9e45d3d9" }, "downloads": -1, "filename": "phasespace-0.0.0.tar.gz", "has_sig": false, "md5_digest": "c0f425efb01778bb2b967ebe3011c85a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 33180, "upload_time": "2019-10-13T14:02:26", "url": "https://files.pythonhosted.org/packages/e4/9d/0b045f304096c8ae32d88b11331e679be593990ed740ace6f850d32652c4/phasespace-0.0.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "34689803b709aab9bdfbd389f3817f64", "sha256": "bf5e6ce157f5a5f01a7fd6609f3ee9a12a3ba9f1905fe3bd0daac520146ebe27" }, "downloads": -1, "filename": "phasespace-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "34689803b709aab9bdfbd389f3817f64", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 13240, "upload_time": "2019-03-12T21:02:00", "url": "https://files.pythonhosted.org/packages/6d/73/ef4a947ed4488b2183603d860e7bcdd1f4f845045e70c8fa1a6e0464a2b6/phasespace-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "22e3a42ed549f8cf1228febd097ac1b7", "sha256": "b4df1f91dd1f939fa2063c5b39c7a540bcbb3eeedce48ef31219b3e57474df99" }, "downloads": -1, "filename": "phasespace-0.2.0.tar.gz", "has_sig": false, "md5_digest": "22e3a42ed549f8cf1228febd097ac1b7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 27167, "upload_time": "2019-03-12T21:02:02", "url": "https://files.pythonhosted.org/packages/33/e9/e7ca8b1616368da68db9b6d761a4fa7e331af735bcf586a379de3e1c45db/phasespace-0.2.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "42d07c5a289966a9fe30e3f096ffa490", "sha256": "37e096032c99dc07ff49c402c92781b810e19df9ef67d281286d781e14563ec9" }, "downloads": -1, "filename": "phasespace-0.8.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "42d07c5a289966a9fe30e3f096ffa490", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 13357, "upload_time": "2019-03-12T23:47:01", "url": "https://files.pythonhosted.org/packages/7a/fd/a0a680308daa98d316c386e61e0cd5af87f7cc3ef72939bb2741f4dcb633/phasespace-0.8.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c49d352bbcfb0d68985f55f254d898b5", "sha256": "2112c09e53198ff1a325bc937ad220f3fcefa7e1f9562b633a84ae3a3622a349" }, "downloads": -1, "filename": "phasespace-0.8.0.tar.gz", "has_sig": false, "md5_digest": "c49d352bbcfb0d68985f55f254d898b5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 27415, "upload_time": "2019-03-12T23:47:02", "url": "https://files.pythonhosted.org/packages/11/49/ddd444c6b1b2bf083d8b63ea8452b4e4328f2be836c6fad2679b357ff8b0/phasespace-0.8.0.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "5bc4a0dece2fe0775cbb845031db4146", "sha256": "f045cd15191c8676bd3d43b73a3c9ea8a9e487deaf4ca238a763a4766a631557" }, "downloads": -1, "filename": "phasespace-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5bc4a0dece2fe0775cbb845031db4146", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.5", "size": 13364, "upload_time": "2019-03-13T09:00:02", "url": "https://files.pythonhosted.org/packages/c6/c2/45ca11439903c2745eb793a7e7ac66a7a141c5af993dff1f849182da2c04/phasespace-0.9.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "13f67012dbfd823bc545a172693660eb", "sha256": "a0ce14f4d01616c2f75fac14127631f549be982c96219277e850a905a5cdb540" }, "downloads": -1, "filename": "phasespace-0.9.0.tar.gz", "has_sig": false, "md5_digest": "13f67012dbfd823bc545a172693660eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 27454, "upload_time": "2019-03-13T09:00:04", "url": "https://files.pythonhosted.org/packages/77/52/b0ea33988ed459dadddb135216d9a960889d470d70b2c77d79051e72df06/phasespace-0.9.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "a403608ff8ad09150bd706f3c9f7e1c2", "sha256": "2cbae5132d6b3b4858abd82dda875e3debbdca37dd833ffab986e2c93fc69f2d" }, "downloads": -1, "filename": "phasespace-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a403608ff8ad09150bd706f3c9f7e1c2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 14486, "upload_time": "2019-05-17T17:26:43", "url": "https://files.pythonhosted.org/packages/4a/e1/2fa41d431c58720ebba5467cb76270cfc343b274d10b0d2f44d922e8a1f5/phasespace-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ad1a97f09cc2f52e80524455217793ef", "sha256": "7b8e16038d369faaaefafaf0032ce9f83779685e709e796efcd7a0e04f1610bf" }, "downloads": -1, "filename": "phasespace-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ad1a97f09cc2f52e80524455217793ef", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 30865, "upload_time": "2019-05-17T17:26:44", "url": "https://files.pythonhosted.org/packages/6b/4f/6790625b114d545f44c7bcdee446456eb4388b1251e394818bcf38192b50/phasespace-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "f1dfb7f7b7d0bc57a40d8bd10f53d008", "sha256": "88e0f00ee55907d8f5773e8f70de9eda2c195cae98f22a8add6a89efde5702ac" }, "downloads": -1, "filename": "phasespace-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1dfb7f7b7d0bc57a40d8bd10f53d008", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 14744, "upload_time": "2019-05-20T12:33:16", "url": "https://files.pythonhosted.org/packages/a9/b7/e140dfdcb9527a5506f15f7075e362c7c5e3acfc05ce4458da6ca39b9255/phasespace-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "81ac5cfc1cc2d939b5067e3085dfcb68", "sha256": "b5972994608c2fdccf5caf8f93442d0bfcfa88f25f6f7e9a02ea974609897946" }, "downloads": -1, "filename": "phasespace-1.0.1.tar.gz", "has_sig": false, "md5_digest": "81ac5cfc1cc2d939b5067e3085dfcb68", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 31668, "upload_time": "2019-05-20T12:33:18", "url": "https://files.pythonhosted.org/packages/98/3e/f74f8f50f470956408c4551a0766091ad07989f43f09030ea29c9f19a1bb/phasespace-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "98844f1df42bb2233d2a271b28bcfbfb", "sha256": "5792475d80e9dd22b6ab3483c728ff993aff30148fa8edfa22540393aeeb3914" }, "downloads": -1, "filename": "phasespace-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "98844f1df42bb2233d2a271b28bcfbfb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 14747, "upload_time": "2019-06-03T13:04:45", "url": "https://files.pythonhosted.org/packages/78/b0/b0990b07c036fc89841e1933d99ae2230c4758a8a769ae25e84fffe83d86/phasespace-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "257195a6cff0ca78372349f0cea2c29a", "sha256": "cb194cfa9b8802118fdafecd98ca7c02a0379d8c1f7df4f639bd6eb7b4d8cc4e" }, "downloads": -1, "filename": "phasespace-1.0.2.tar.gz", "has_sig": false, "md5_digest": "257195a6cff0ca78372349f0cea2c29a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 31674, "upload_time": "2019-06-03T13:04:46", "url": "https://files.pythonhosted.org/packages/bb/f1/039ae54b297d13fe40156dbcd08e0b678a39ce4e5172ab7116466f7340e6/phasespace-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "98844f1df42bb2233d2a271b28bcfbfb", "sha256": "5792475d80e9dd22b6ab3483c728ff993aff30148fa8edfa22540393aeeb3914" }, "downloads": -1, "filename": "phasespace-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "98844f1df42bb2233d2a271b28bcfbfb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6", "size": 14747, "upload_time": "2019-06-03T13:04:45", "url": "https://files.pythonhosted.org/packages/78/b0/b0990b07c036fc89841e1933d99ae2230c4758a8a769ae25e84fffe83d86/phasespace-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "257195a6cff0ca78372349f0cea2c29a", "sha256": "cb194cfa9b8802118fdafecd98ca7c02a0379d8c1f7df4f639bd6eb7b4d8cc4e" }, "downloads": -1, "filename": "phasespace-1.0.2.tar.gz", "has_sig": false, "md5_digest": "257195a6cff0ca78372349f0cea2c29a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 31674, "upload_time": "2019-06-03T13:04:46", "url": "https://files.pythonhosted.org/packages/bb/f1/039ae54b297d13fe40156dbcd08e0b678a39ce4e5172ab7116466f7340e6/phasespace-1.0.2.tar.gz" } ] }