A fast, generic, and easy to use clusterizer to cluster hits of a pixel matrix in Python. The clustering happens with numba on numpy arrays to increase the speed.
Project description
# Pixel Clusterizer [![Build Status](https://travis-ci.org/SiLab-Bonn/pixel_clusterizer.svg?branch=master)](https://travis-ci.org/SiLab-Bonn/pixel_clusterizer) [![Build Status](https://ci.appveyor.com/api/projects/status/github/SiLab-Bonn/pixel_clusterizer)](https://ci.appveyor.com/project/SiLab-Bonn/pixel_clusterizer) [![Coverage Status](https://coveralls.io/repos/github/SiLab-Bonn/pixel_clusterizer/badge.svg?branch=master)](https://coveralls.io/github/SiLab-Bonn/pixel_clusterizer?branch=master)
Pixel_clusterizer is an easy to use pixel hit-clusterizer for Python. It clusters hits on an event basis in space and time.
The hits have to be defined as a numpy recarray. The array has to have the following fields:
- event_number
- frame
- column
- row
- charge
or a mapping of the names has to be provided. The data type does not matter.
The result of the clustering is the hit array extended by the following fields:
- cluster_ID
- is_seed
- cluster_size
- n_cluster
A new array with cluster information is also created created and has the following fields:
- event_number
- ID
- size
- charge
- seed_column
- seed_row
- mean_column
- mean_row
# Installation
The stable code is hosted on PyPI and can be installed by typing:
pip install pixel_clusterizer
# Usage
```
import numpy as np
from pixel_clusterizer import clusterizer
hits = np.ones(shape=(3, ), dtype=clusterizer.hit_data_type) # Create some data with std. hit data type
cr = clusterizer.HitClusterizer() # Initialize clusterizer
hits_clustered, cluster = cr.cluster_hits(hits) # Cluster hits # add hits to clusterizer
print (cluster) # Print cluster
print (hits_clustered) # Print hits + cluster info
Also take a look at the example folder!
```
# Test installation
```
nosetests pixel_clusterizer
```
Pixel_clusterizer is an easy to use pixel hit-clusterizer for Python. It clusters hits on an event basis in space and time.
The hits have to be defined as a numpy recarray. The array has to have the following fields:
- event_number
- frame
- column
- row
- charge
or a mapping of the names has to be provided. The data type does not matter.
The result of the clustering is the hit array extended by the following fields:
- cluster_ID
- is_seed
- cluster_size
- n_cluster
A new array with cluster information is also created created and has the following fields:
- event_number
- ID
- size
- charge
- seed_column
- seed_row
- mean_column
- mean_row
# Installation
The stable code is hosted on PyPI and can be installed by typing:
pip install pixel_clusterizer
# Usage
```
import numpy as np
from pixel_clusterizer import clusterizer
hits = np.ones(shape=(3, ), dtype=clusterizer.hit_data_type) # Create some data with std. hit data type
cr = clusterizer.HitClusterizer() # Initialize clusterizer
hits_clustered, cluster = cr.cluster_hits(hits) # Cluster hits # add hits to clusterizer
print (cluster) # Print cluster
print (hits_clustered) # Print hits + cluster info
Also take a look at the example folder!
```
# Test installation
```
nosetests pixel_clusterizer
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pixel_clusterizer-2.4.0.tar.gz
(27.3 kB
view hashes)
Built Distributions
Close
Hashes for pixel_clusterizer-2.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c328472d18817c52f6397b4a40959edee3d8e0695f25f128b7ea67813f13348a |
|
MD5 | ce23d40962515d954e06e101fb7bee2a |
|
BLAKE2b-256 | 6f2700be845088356a7c23f9700ba370ae3402626cd06188d34fa7b244068bd0 |
Close
Hashes for pixel_clusterizer-2.4.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 551ecb773fa544685cca89f274aee2412119935754fa1a12c24e4aec64d96096 |
|
MD5 | 53e52f7c102be9d2eb94d0d575a3192c |
|
BLAKE2b-256 | 9f9c92e68fae76be0ff14148409315270cdd58105ce7e127da28429f49f14300 |