{ "info": { "author": "Florian Staub", "author_email": "florian.staub@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: MacOS", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "# xSLHA\n``xSLHA`` is a ``python`` parser for files written in the SLHA format. It is optimised for fast reading of a large sample of files.\n\n## Installation\nThe package can be installed via\n```\npip install xslha\n```\nand is loaded in python by \n```\nimport xslha\n```\n\n## Reading a single spectrum file\nReading a spectrum file ``file`` and stroing the information in a class object ``spc`` is done via the command\n```\nspc=xslha.read(file)\n```\nOne has afterwards access to the different information by using the ``Value`` command, e.g\n```\nprint(\"tan(beta): \",spc.Value('MINPAR',[3]))\nprint(\"T_u(3,3): \",spc.Value('TU',[3,3]))\nprint(\"m_h [GeV]: \",spc.Value('MASS',[25]))\nprint(\"Gamma(h) [GeV]: \",spc.Value('WIDTH',25))\nprint(\"BR(h->W^+W^-): \",spc.Value('BR',[25,[-13,13]]))\nprint(\"Sigma(pp->N1 N1,Q=8TeV): \",spc.Value('XSECTION',[8000,(2212,2212),(1000021,1000021)]))\n```\nproduces the following output\n```\ntan(beta): 16.870458\nT_u(3,3): 954.867627\nm_h [GeV]: 117.758677\nGamma(h) [GeV]: 0.00324670136\nBR(h->W^+W^-): 0.000265688227\nSigma(pp->N1 N1,Q=8TeV): [[(0, 2, 0, 0, 0, 0), 0.00496483158]]\n```\nThus, the conventions are:\n* for information given in the different SLHA blocks is returned by using using the name of the block as input as well as the numbers in the block as list\n* the widths of particles are returned via the keyword ``WIDHT`` and the pdg of the particle\n* for branching ratios, the keyword ``BR``is used together with a nested list which states the pdg of the decay particle as well as of the final states\n* for cross-sections the keyword ``XSECTION`` is used together with a nested list which states the center-of-mass energy and the pdgs of the initial/final states. The result is a list containing all calculated cross-sections for the given options for the renormalisation scheme, the QED & QCD order, etc. (see the SLHA recommendations for details). \n\nAnother possibility to access the information in the spectrum file is to look at the different dictionaries\n```\nspc.blocks\nspc.widths\nspc.br\nspc.xsctions\n```\nwhich contain all information\n\n## Reading all spectrum files from a directory\nIn order to read several spectrum files located in a directory ``dir``, one can make use of the command\n```\nlist_spc=xslha.read_dir(dir)\n```\nThis generates a list ``list_spc`` where each entry corresponds to one spectrum. Thus, one can for instance use \n```\n[[x.Value('MINPAR',[1]),x.Value('MASS',[25])] for x in list_spc]\n```\nto extract the input for a 2D-scatter plot. \n\n## Fast read-in of many files\nReading many spectrum files can be time consuming. However, many of the information which is given in a SLHA file is often not needed for a current study. Therefore, one can speed up the reading by extracting first all relevant information. This generates smaller files which are faster to read in. This can be done via the optional argument ``entries`` for ``read_dir``:\n```\nlist_spc_fast=xslha.read_dir(\"/home/$USER/Documents/spc1000\",entries=[\"# m0\",\"# m12\",\"# hh_1\"])`\n```\n``entries`` defines a list of strings which can be used to extract the necessary lines from the SLHA file by using ``grep``. The speed improvement can be easily an order of magnitude if only some entries from a SLHA file are actually needed.\n\n### Speed\nThe impact of this optimisation for reading 1000 files is as follows:\n```\n%%time\nlist_spc=xslha.read_dir(\"/home/$USER/Documents/spc1000\")\n\nCPU times: user 5.05 s, sys: 105 ms, total: 5.15 s\nWall time: 5.51 s\n```\ncompared to \n```\n%%time\nlist_spc_fast=xslha.read_dir(\"/home/$USER/Documents/spc1000\",entries=[\"# m0\",\"# m12\",\"# hh_1\"])\n\nCPU times: user 147 ms, sys: 132 ms, total: 280 ms\nWall time: 917 ms\n```\nOne can also compares this with other available python parser:\n* ``pylha``:\n```\n%%time\nall_spc=[]\nfor filename in os.listdir(\"/home/$USER/Documents/spc1000/\"): \n with open(\"~/Documents/spc1000/\"+filename) as f:\n input=f.read()\n all_spc.append(pylha.load(input))\n\nCPU times: user 21.5 s, sys: 174 ms, total: 21.7 s\nWall time: 21.7 s \n```\n* ``pyslha``{\n```\n%%time\nall_spc=[]\nfor filename in os.listdir(\"/home/$USER/Documents/spc1000/\"): \n all_spc.append(pyslha.read((\"/home/$USER/Documents/spc1000/\"+filename)))\n\nCPU times: user 13.3 s, sys: 152 ms, total: 13.5 s\nWall time: 13.5 s\n ```\n\n## Reading spectra stored in one file\nAnother common approach for saving spectrum files is to produce one huge file in which the different spectra are separated by a keyword. ``xSLHA`` can read such files by setting the optional argument ``separator`` for ``read``:\n```\nlist_spc=xslha.read(file,separator=keyword)\n```\nIn order to speed up the reading of many spectra also in this case, it is possible to define the entries as well which are need:\n```\nlist_spc=xslha.read(file,separator=keyword,entries=list)\n```\nIn this case``xSLHA`` will produce first a smaller spectrum file using ``cat`` and ``grep``. For instance, in order to read efficiently files produced with [``SSP``](https://sarah.hepforge.org/SSP), one can use:\n```\nlist_spc=xslha.read(\"SpectrumFiles.spc\",separator=\"ENDOFPARAMETERFILE\",entries=[\"# m0\", \"# m12\", \"# hh_1\"])\n```\n\n## Special blocks\nThere are some programs which use blocks that are not supported by the official SLHA conventions:\n* [``HiggsBounds``](https://higgsbounds.hepforge.org/) expects the effective coupling ratios in blocks ``HIGGSBOUNDSINPUTHIGGSCOUPLINGSBOSONS`` and ``HIGGSBOUNDSINPUTHIGGSCOUPLINGSFERMIONS`` which are differently order compared to other blocks (first the numerical entries are stated before the PDGs of the involved particles follow)\n* [``SPheno``](spheno.hepforge.org) version generated by [``SARAH``](sarah.hepforge.org) can calculate one-loop corrections to the decays. The results are given in the blocks ``DECAY1L`` which appear in parallel to ``DECAY`` containing the standard calculation. ``xSLHA`` will distinguish these cases when reading the file and offer the two following options for ``Values`` in addtion:\n```\nspc.Values('WIDTH1L',1000022)\nspc.Values('BR1L',[1000023,[25,1000022]])\n```\n\n## Writing files\nFiles in the SLHA format can be written via\n```\nxslha.write(blocks,file)\n```\nwhere it might be the best to use ordered dictionaries to define the blocks and the values in the blocks. For instance \n```\nimport collections\nout_blocks=collections.OrderedDict([\n ('MODSEL',collections.OrderedDict([('1', 1), ('2', 2),('6',0)])),\n ('MINPAR',collections.OrderedDict([('1', 1000.),('2', 2000),('3',10),('4',1),('5',0)]))\n])\nxslha.write(out_blocks,\"/home/$USER/Documents/LH.in\")\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fstaub/xSLHA", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "xslha", "package_url": "https://pypi.org/project/xslha/", "platform": "", "project_url": "https://pypi.org/project/xslha/", "project_urls": { "Homepage": "https://github.com/fstaub/xSLHA" }, "release_url": "https://pypi.org/project/xslha/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "A python package to read (big/many) SLHA files", "version": "1.0.3" }, "last_serial": 4671855, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "63e751ca34320300981658b9c5b5c29d", "sha256": "fda2f0b2f52f2835a5416e15b77e292d9abfe6b5245fccd6031d82139b9eed67" }, "downloads": -1, "filename": "xslha-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "63e751ca34320300981658b9c5b5c29d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4666, "upload_time": "2018-11-21T19:28:55", "url": "https://files.pythonhosted.org/packages/ad/ad/05cc56630e0dcffd680efc3e8d0d26c240e31a8d9892df38f8b828e3205e/xslha-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "19e93ca867565ae2694885cd7917112d", "sha256": "186a0a8c064743f0331538c8e88a2a26a658bf1796dac641a2f1f9383b7df263" }, "downloads": -1, "filename": "xslha-0.2.2.tar.gz", "has_sig": false, "md5_digest": "19e93ca867565ae2694885cd7917112d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3435, "upload_time": "2018-11-21T19:28:57", "url": "https://files.pythonhosted.org/packages/49/7f/37bec8194a560109f9344e29a3515dbb0974a26f415890947a34143933ac/xslha-0.2.2.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "4ab241c34d657b5888b95baf36b42640", "sha256": "4adb6061d7230ed7c388dd75a5f7212881d8ef437203ad334bb53b3739c3a5c2" }, "downloads": -1, "filename": "xslha-0.9.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4ab241c34d657b5888b95baf36b42640", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7340, "upload_time": "2018-11-22T12:34:38", "url": "https://files.pythonhosted.org/packages/d9/71/07e91caf6353c9ada5159b542a226f275efea178c31e8d74a1ba2bcb6c04/xslha-0.9.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87984776da998522003e9e1ce97adba1", "sha256": "94040d074d29038ace9bd0dd7f9969a17413a5d2825a12737da1b2d93502eb63" }, "downloads": -1, "filename": "xslha-0.9.0.tar.gz", "has_sig": false, "md5_digest": "87984776da998522003e9e1ce97adba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6491, "upload_time": "2018-11-22T12:34:39", "url": "https://files.pythonhosted.org/packages/8a/08/8dee9ed4104bc9138639806038847520a28b02a0ff7d37235d435eee98ea/xslha-0.9.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "d4fd1e5c5a6cb625d5db79804762914b", "sha256": "0e18c721297ed4933444dff2724b3c6aedbf825ae2b790c38a7e5c01074d1476" }, "downloads": -1, "filename": "xslha-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d4fd1e5c5a6cb625d5db79804762914b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9952, "upload_time": "2018-12-07T12:12:45", "url": "https://files.pythonhosted.org/packages/07/10/f2b2523641770ccb2d53e9ada93e4abc0d5ef96cc35372900180d9e12ddc/xslha-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de39a7ec677abdffb8742e38512537d0", "sha256": "2a5d3227ba1a14df8f4c7fd31a58226dbde525b473000acc48f7e7ee09892a83" }, "downloads": -1, "filename": "xslha-1.0.0.tar.gz", "has_sig": false, "md5_digest": "de39a7ec677abdffb8742e38512537d0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6507, "upload_time": "2018-12-07T12:12:47", "url": "https://files.pythonhosted.org/packages/ab/6e/f78f992b10dc1505a97f5d08be62762559117bf40176c7cd438ef4b0ac38/xslha-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0c1aaeda12988970be11cd1af5c43b7e", "sha256": "e4d718ad4da0627d073f0c8558c988a8034c397050dbeaf089f746be7b0763be" }, "downloads": -1, "filename": "xslha-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0c1aaeda12988970be11cd1af5c43b7e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9716, "upload_time": "2018-12-11T14:16:32", "url": "https://files.pythonhosted.org/packages/24/66/78682652abf01577a3bc43a2f93f22dc715cb410a50a79488040b0ba9f99/xslha-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff374a447f6046da3ab47679883a7e49", "sha256": "d0c208a9f7ad68fc9aa8379b7e3f1f6b2af22dafe1a66ec5c80ed745f10f72e9" }, "downloads": -1, "filename": "xslha-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ff374a447f6046da3ab47679883a7e49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6300, "upload_time": "2018-12-11T14:16:35", "url": "https://files.pythonhosted.org/packages/8d/23/8dcb29de006caacc07964ad4579c4927e9425b29f5e6a0a0df28ad4d9df7/xslha-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "0d9a128c5bf4169e932d090a4536dece", "sha256": "1123fbf02f8173c4b7151e828c4baea41a97f00358b37d1b7447c7c43d4399af" }, "downloads": -1, "filename": "xslha-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0d9a128c5bf4169e932d090a4536dece", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9962, "upload_time": "2019-01-07T09:23:41", "url": "https://files.pythonhosted.org/packages/fb/72/62439d170e43ad63485abc93d5c1c349a0fc69ae4f77f1fa9405ac291f09/xslha-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6303f2e2cc1ee80dfea07ed44405875", "sha256": "eb5b962cc0ea9a480e3d1dcdb2f2a23bfa147a4b639c2e9cc64c34ada4c7a1e2" }, "downloads": -1, "filename": "xslha-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f6303f2e2cc1ee80dfea07ed44405875", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6531, "upload_time": "2019-01-07T09:23:43", "url": "https://files.pythonhosted.org/packages/07/46/5128ab1ab5a1f5f53bde44e5b6dc7c2c6dcf9b669c3dca030867925c8b26/xslha-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "cca99140d14b2579a37a0fc17c113f17", "sha256": "c01cee20a86cbd713895d3bc82ff225c91cf081cef75578251f17f50ff95afde" }, "downloads": -1, "filename": "xslha-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "cca99140d14b2579a37a0fc17c113f17", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10000, "upload_time": "2019-01-08T08:21:29", "url": "https://files.pythonhosted.org/packages/cb/9c/00225d8422de8d99f7015cb6af90b5fb28e46e40edf1cf32331c65958146/xslha-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9bdc9172af3b4aab0051b067eb570387", "sha256": "f3e1e83d9e858d54391274cd50821904d2e6b3d3c625f595dfbd491888f0a0fb" }, "downloads": -1, "filename": "xslha-1.0.3.tar.gz", "has_sig": false, "md5_digest": "9bdc9172af3b4aab0051b067eb570387", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6567, "upload_time": "2019-01-08T08:21:31", "url": "https://files.pythonhosted.org/packages/1d/fd/b2f8a76f75bee527017cf380f12c322a30a2da080e38765748edb22f44b3/xslha-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cca99140d14b2579a37a0fc17c113f17", "sha256": "c01cee20a86cbd713895d3bc82ff225c91cf081cef75578251f17f50ff95afde" }, "downloads": -1, "filename": "xslha-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "cca99140d14b2579a37a0fc17c113f17", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10000, "upload_time": "2019-01-08T08:21:29", "url": "https://files.pythonhosted.org/packages/cb/9c/00225d8422de8d99f7015cb6af90b5fb28e46e40edf1cf32331c65958146/xslha-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9bdc9172af3b4aab0051b067eb570387", "sha256": "f3e1e83d9e858d54391274cd50821904d2e6b3d3c625f595dfbd491888f0a0fb" }, "downloads": -1, "filename": "xslha-1.0.3.tar.gz", "has_sig": false, "md5_digest": "9bdc9172af3b4aab0051b067eb570387", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6567, "upload_time": "2019-01-08T08:21:31", "url": "https://files.pythonhosted.org/packages/1d/fd/b2f8a76f75bee527017cf380f12c322a30a2da080e38765748edb22f44b3/xslha-1.0.3.tar.gz" } ] }