hesspix
=======
``hesspix`` is a tiny library to read HESS pixel info from ROOT files. No ROOT
is required.
Installation
~~~~~~~~~~~~
``hesspix`` is a registered Python package. It can be installed using ``pip``::
pip install hesspix
To install the latest development version from the Git repository::
pip install git+https://github.com/tamasgal/hesspix
Usage
~~~~~
It's as easy as::
>>> import hesspix as hp
>>> r = hp.CT5Reader("gamma_20deg_180deg_run4151.dst.root")
accessing events via a global index, as written in the ROOT branch::
>>> r[0]
Event 801 (bunch 0) [10 pixels]
>>> r[23]
Event 19607 (bunch 0) [3 pixels]
Grabbing an event with a given event number and bunch number::
>>> r.get(event_nr=3902, bunch_nr=0)
Event 3902 (bunch 0) [18 pixels]
>>> event = r.get(event_nr=3902, bunch_nr=0)
The pixel information is stored in ``pixinfo``::
>>> event.pixinfo
rec.array([( 352, 18.27153 , 3, 20.9375 ),
( 353, 23.193665, 3, 21.703125),
( 355, 11.846128, 3, 22.171875),
( 357, 15.300814, 3, 21.5 ),
( 513, 8.219065, 3, 21.046875),
(1296, 15.051192, 3, 19.890625),
(1299, 9.525627, 3, 19.265625),
(1302, 9.479142, 3, 20.21875 ),
(1304, 14.532091, 3, 21.171875),
(1306, 22.21212 , 3, 21.46875 ),
(1307, 11.263601, 3, 20.953125),
(1316, 16.932125, 3, 20.046875),
(1318, 13.045629, 3, 21.515625),
(1324, 13.618393, 3, 20.75 ),
(1325, 12.267553, 3, 20.953125),
(1329, 8.492023, 3, 21.921875),
(1339, 10.908205, 3, 20.953125),
(1341, 21.191723, 3, 21.546875)],
dtype=[('id', '<i4'), ('intensity', '>f4'), ('channel', 'i1'), ('time', '>f4')])
as a simple NumPy RecArray (struct of arrays)::
>>> event.pixinfo.intensity
array([18.27153 , 23.193665, 11.846128, 15.300814, 8.219065, 15.051192,
9.525627, 9.479142, 14.532091, 22.21212 , 11.263601, 16.932125,
13.045629, 13.618393, 12.267553, 8.492023, 10.908205, 21.191723],
dtype='>f4')
Accessing individual elements yields "struct-like" instances::
>>> event.pixinfo[4]
(513, 8.219065, 3, 21.046875)
>>> event.pixinfo[4].time
21.046875
>>> event.pixinfo[4].channel
3
Iterating through all the events in the file can be done with::
>>> for event in r:
...
---
*Created with ``cookiecutter https://git.km3net.de/templates/python-project``*
Raw data
{
"_id": null,
"home_page": "https://git.ecap.work/tgal/hesspix",
"name": "hesspix",
"maintainer": "Tamas Gal",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "tamas.gal@fau.de",
"keywords": "astroparticle, physics, HEP",
"author": "Tamas Gal",
"author_email": "tamas.gal@fau.de",
"download_url": "https://files.pythonhosted.org/packages/63/89/c13dbfa3223d8f4858f6eda387939896c48b9227c691aab33b7dd0b9151e/hesspix-0.2.1.tar.gz",
"platform": null,
"description": "hesspix \n=======\n\n``hesspix`` is a tiny library to read HESS pixel info from ROOT files. No ROOT\nis required.\n\nInstallation\n~~~~~~~~~~~~\n\n``hesspix`` is a registered Python package. It can be installed using ``pip``::\n\n pip install hesspix\n\nTo install the latest development version from the Git repository::\n\n pip install git+https://github.com/tamasgal/hesspix\n\nUsage\n~~~~~\n\nIt's as easy as::\n\n >>> import hesspix as hp\n\n >>> r = hp.CT5Reader(\"gamma_20deg_180deg_run4151.dst.root\")\n\naccessing events via a global index, as written in the ROOT branch::\n\n >>> r[0]\n Event 801 (bunch 0) [10 pixels]\n\n >>> r[23]\n Event 19607 (bunch 0) [3 pixels]\n\nGrabbing an event with a given event number and bunch number::\n\n >>> r.get(event_nr=3902, bunch_nr=0)\n Event 3902 (bunch 0) [18 pixels]\n\n >>> event = r.get(event_nr=3902, bunch_nr=0)\n\nThe pixel information is stored in ``pixinfo``::\n\n >>> event.pixinfo\n rec.array([( 352, 18.27153 , 3, 20.9375 ),\n ( 353, 23.193665, 3, 21.703125),\n ( 355, 11.846128, 3, 22.171875),\n ( 357, 15.300814, 3, 21.5 ),\n ( 513, 8.219065, 3, 21.046875),\n (1296, 15.051192, 3, 19.890625),\n (1299, 9.525627, 3, 19.265625),\n (1302, 9.479142, 3, 20.21875 ),\n (1304, 14.532091, 3, 21.171875),\n (1306, 22.21212 , 3, 21.46875 ),\n (1307, 11.263601, 3, 20.953125),\n (1316, 16.932125, 3, 20.046875),\n (1318, 13.045629, 3, 21.515625),\n (1324, 13.618393, 3, 20.75 ),\n (1325, 12.267553, 3, 20.953125),\n (1329, 8.492023, 3, 21.921875),\n (1339, 10.908205, 3, 20.953125),\n (1341, 21.191723, 3, 21.546875)],\n dtype=[('id', '<i4'), ('intensity', '>f4'), ('channel', 'i1'), ('time', '>f4')])\n\n\nas a simple NumPy RecArray (struct of arrays)::\n\n >>> event.pixinfo.intensity\n array([18.27153 , 23.193665, 11.846128, 15.300814, 8.219065, 15.051192,\n 9.525627, 9.479142, 14.532091, 22.21212 , 11.263601, 16.932125,\n 13.045629, 13.618393, 12.267553, 8.492023, 10.908205, 21.191723],\n dtype='>f4')\n\nAccessing individual elements yields \"struct-like\" instances::\n\n >>> event.pixinfo[4]\n (513, 8.219065, 3, 21.046875)\n\n >>> event.pixinfo[4].time\n 21.046875\n\n >>> event.pixinfo[4].channel\n 3\n\nIterating through all the events in the file can be done with::\n\n >>> for event in r:\n ...\n\n---\n\n*Created with ``cookiecutter https://git.km3net.de/templates/python-project``*\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tiny library to read HESS pixel info from ROOT files.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://git.ecap.work/tgal/hesspix"
},
"split_keywords": [
"astroparticle",
" physics",
" hep"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6389c13dbfa3223d8f4858f6eda387939896c48b9227c691aab33b7dd0b9151e",
"md5": "406c4c61cc2f28746b28a08fee7aab00",
"sha256": "2bcd073de3bea96d9e60834986169c22489f682086d303b0607ae57497a9a12e"
},
"downloads": -1,
"filename": "hesspix-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "406c4c61cc2f28746b28a08fee7aab00",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 40673,
"upload_time": "2024-04-05T11:25:41",
"upload_time_iso_8601": "2024-04-05T11:25:41.350429Z",
"url": "https://files.pythonhosted.org/packages/63/89/c13dbfa3223d8f4858f6eda387939896c48b9227c691aab33b7dd0b9151e/hesspix-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-05 11:25:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "hesspix"
}