-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,314 additions
and
1,477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,78 @@ | ||
# 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 [![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/c8jqu9ow696opevf?svg=true)](https://ci.appveyor.com/project/laborleben/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 | ||
## Intended Use | ||
|
||
or a mapping of the names has to be provided. The data type does not matter. | ||
Pixel_clusterizer is an easy to use pixel hit clusterizer for Python. It clusters hits connected to unique event numbers in space and time. | ||
|
||
The result of the clustering is the hit array extended by the following fields: | ||
- cluster_ID | ||
- is_seed | ||
- cluster_size | ||
- n_cluster | ||
The hits must be provided in a numpy recarray. The array must contain the following columns ("fields"): | ||
- ```event_number``` | ||
- ```frame``` | ||
- ```column``` | ||
- ```row``` | ||
- ```charge``` | ||
|
||
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 | ||
If the column names are different, a mapping of the names to the default names can be provided. The data type of each column can vary and is not fixed. The ```column```/```row``` values can be either indices (integer, default) or positions (float). ```Charge``` can be either integer or float (default). | ||
|
||
After clustering, two new arrays are returned: | ||
1. The cluster hits array is the hits array extended by the following columns: | ||
- ```cluster_ID``` | ||
- ```is_seed``` | ||
- ```cluster_size``` | ||
- ```n_cluster``` | ||
2. The cluster array contains in each row the information about a single cluster. It has the following columns: | ||
- ```event_number``` | ||
- ```ID``` | ||
- ```n_hits``` | ||
- ```charge``` | ||
- ```seed_column``` | ||
- ```seed_row``` | ||
- ```mean_column``` | ||
- ```mean_row``` | ||
|
||
## Installation | ||
|
||
# Installation | ||
Python 2.7 or Python 3 or higher must be used. There are many ways to install Python, though we recommend using [Anaconda Python](https://www.anaconda.com/distribution/) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html). | ||
|
||
The stable code is hosted on PyPI and can be installed by typing: | ||
### Prerequisites | ||
|
||
The following packages are required: | ||
``` | ||
numpy numba>=0.24.0 | ||
``` | ||
|
||
### Installation of pixel_clusterizer | ||
|
||
The stable code is hosted on PyPI and can be installed by typing: | ||
``` | ||
pip install pixel_clusterizer | ||
``` | ||
|
||
# Usage | ||
For developer, clone the pixel_clusterizer git repository and use the following command to install pixel_clusterizer: | ||
``` | ||
pip install -e . | ||
``` | ||
|
||
For testing the basic functionality of pixel_clusterizer, execute the following command: | ||
``` | ||
nosetests 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 | ||
hits = np.ones(shape=(3, ), dtype=clusterizer.default_hits_dtype) # Create some data with std. hit data type | ||
cr = clusterizer.HitClusterizer() # Initialize clusterizer | ||
hits_clustered, cluster = cr.cluster_hits(hits) # Cluster hits | ||
cluster_hits, clusters = cr.cluster_hits(hits) # Cluster hits | ||
``` | ||
Also take a look at the example folder! | ||
Also please have a look at the ```examples``` folder! | ||
|
||
# Test installation | ||
``` | ||
nosetests pixel_clusterizer | ||
``` | ||
## Support | ||
|
||
Please use GitHub's [issue tracker](https://github.com/SiLab-Bonn/pixel_clusterizer/issues) for bug reports/feature requests/questions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# http://stackoverflow.com/questions/17583443/what-is-the-correct-way-to-share-package-version-with-setup-py-and-the-package | ||
from pkg_resources import get_distribution | ||
from pixel_clusterizer.clusterizer import HitClusterizer, default_hits_descr, default_hits_dtype, default_cluster_hits_descr, default_cluster_hits_dtype, default_clusters_descr, default_clusters_dtype | ||
|
||
|
||
__version__ = get_distribution('pixel_clusterizer').version | ||
_all_ = ["HitClusterizer", "default_hits_dtype", "default_cluster_hits_descr", "default_cluster_hits_dtype", "default_clusters_descr", "default_clusters_dtype"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.