Skip to content

Commit

Permalink
Merge pull request #187 from jacanchaplais/feature/fastjet-opt-185
Browse files Browse the repository at this point in the history
Made FastJet an optional dependency #185
  • Loading branch information
jacanchaplais authored Sep 11, 2024
2 parents d6e1a1a + fdbc587 commit a670077
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ wrapped with ``showerpipe``.
More information on the API is available in the
`documentation <https://graphicle.readthedocs.io>`__

Note on FastJet compatibility
-----------------------------
``graphicle`` offers a function wrapper around ``fastjet`` to cluster
``MomentumArray`` objects using their optimised generalised-kT algorithm.
However, this library cannot build wheels for all systems, including Windows
and the latest macOS systems using ARM architectures.
Therefore, in order to use ``graphicle.select.fastjet_clusters()``, you must
install graphicle with ``fastjet`` as an optional dependency.
This enables users who don't want the ``fastjet`` wrapper to ignore it, and
still make the most of ``graphicle`` many other features.
Use the following to get started:

.. code:: bash
pip install "graphicle[fastjet]"
.. |PyPI version| image:: https://img.shields.io/pypi/v/graphicle.svg
:target: https://pypi.org/project/graphicle/
.. |Tests| image:: https://github.com/jacanchaplais/graphicle/actions/workflows/tests.yml/badge.svg
Expand Down
3 changes: 2 additions & 1 deletion graphicle/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import typing as ty

import awkward as ak
import fastjet as fj
import numpy as np
import pandas as pd
import scipy.optimize as opt
Expand Down Expand Up @@ -120,6 +119,8 @@ def fastjet_clusters(
cause undefined behaviour if you apply views on the underlying data
in a ``MaskArray`` without copying it.
"""
import fastjet as fj

if pt_cut is None:
pt_cut = 0.0
elif pt_cut < 0.0:
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies = [
"mcpid",
"typicle >=0.1.4",
"networkx",
"fastjet >=3.4.1.2",
"awkward",
"rich",
"deprecation",
Expand All @@ -36,6 +35,11 @@ dependencies = [
"tabulate",
]

[project.optional-dependencies]
fastjet = [
"fastjet >=3.4.1.2",
]

[project.urls]
repository = "https://github.com/jacanchaplais/graphicle"
documentation = "https://graphicle.readthedocs.io"
Expand Down

0 comments on commit a670077

Please sign in to comment.