Official FastJet bindings to Python and Awkward Array.
Project description
fastjet
Official FastJet bindings to Python and Awkward Array.
Main features of Fastjet:
- Contains Vectorized as well as Non-Vectorized interface for Fastjet.
- Compiled against the complete Fastjet library in C++.
- Has Awkward Array and Vector as dependency.
- Provides the functionality to cluster multiple events at a time.
- Input data can be in any coordinate system.
Installation
The package can be installed from PyPI using the following command:
python -m pip install fastjet
Overview
Some of the basic functionalities of Fastjet and how to use them are listed below.
import fastjet
import awkward as ak
import vector
The input data can be either a awkward array or a list of Pseudojets.
Awkward Array
input_data = ak.Array(
[
[
{"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
{"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
{"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
],
[
{"px": 1.2, "py": 3.2, "pz": 5.4, "E": 2.5, "ex": 0.78},
{"px": 32.2, "py": 64.21, "pz": 543.34, "E": 24.12, "ex": 0.35},
{"px": 32.45, "py": 63.21, "pz": 543.14, "E": 24.56, "ex": 0.0},
],
],
with_name="Momentum4D",
)
List of PseudoJets
input_data = [fastjet.PseudoJet(1,1,1,1)
,fastjet.PseudoJet(1.2,1.2,1.2,1.2)
,fastjet.PseudoJet(3,3,3,3)
,fastjet.PseudoJet(-1,-12,2,1)
,fastjet.PseudoJet(-1,-12,2.1,0.9)]
Clustering
The classes (clustering and clustering specification) are the same for all the input types:
jetdef = fastjet.JetDefinition(fastjet.antikt_algorithm, 0.6)
cluster = fastjet.ClusterSequence(input_data, jetdef)
Outputs
The output can be extracted using function calls (output can be an Awkward Array or a list of PseudoJets depending on the input).
inclusive_jets = cluster.inclusive_jets()
Installation For Developers
Clone this repository recursively to get the dependencies.
git clone --recursive https://github.com/scikit-hep/fastjet.git
Build dependencies
There are still external build-time dependencies for the C++ components of fastjet
that need to be installed on the build machine.
To install the build-time dependencies run the following installation commands for your respective operating system:
Debian/Ubuntu
sudo apt-get update && sudo apt-get install -y libboost-dev gfortran swig autoconf libtool
Build and install
Then you can build it using the following command:
python -m pip install .[test]
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.