A tiny library to read HESS pixel info from ROOT files.
Project description
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``
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hesspix-0.2.2.tar.gz.
File metadata
- Download URL: hesspix-0.2.2.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce3b42bea25f61102e50c6d28b0c227d789b8a05984d23228f6d37c4c2d530a9
|
|
| MD5 |
9f63ee8e54531a2e49c1bd4f4e95de81
|
|
| BLAKE2b-256 |
de67908a8367715d014192c96569a8313a505b9671625b73173857ca14c33e0f
|
File details
Details for the file hesspix-0.2.2-py2.py3-none-any.whl.
File metadata
- Download URL: hesspix-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0f9ef61bd976950ef31eacb20201b8ec4c86a638d5a2cb250dde6a646fe0d3d
|
|
| MD5 |
28126afb3748bf3d2a65531c45f4f1f4
|
|
| BLAKE2b-256 |
0ea5248761bbbc372042a0f8be9baa4ef6ffa03f25717caeed25ad40f3a9053d
|