scikit-hep / fastjet

Jet-finding in the Scikit-HEP ecosystem.
https://fastjet.readthedocs.io
BSD 3-Clause "New" or "Revised" License
21 stars 14 forks source link

Possible to suppress FastJet banner? #180

Open matthewfeickert opened 1 year ago

matthewfeickert commented 1 year ago

This might be something to take up with the FastJet authors themselves, but anytime that fastjet.ClusterSequence is called the FastJet banner gets printed to stdout.

For fastjet v3.4.0.5

import awkward as ak
import fastjet

jetdef = fastjet.JetDefinition(fastjet.kt_algorithm, 0.6)

array = 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},
    ],
)

cluster = fastjet.ClusterSequence(array, jetdef)  # Banner print is here
inclusive_jets = cluster.inclusive_jets()
print(inclusive_jets)

produces

#--------------------------------------------------------------------------
#                         FastJet release 3.4.0
#                 M. Cacciari, G.P. Salam and G. Soyez                  
#     A software package for jet finding and analysis at colliders      
#                           http://fastjet.fr                           
#                                                                         
# Please cite EPJC72(2012)1896 [arXiv:1111.6097] if you use this package
# for scientific work and optionally PLB641(2006)57 [hep-ph/0512210].   
#                                                                       
# FastJet is provided without warranty under the GNU GPL v2 or higher.  
# It uses T. Chan's closest pair algorithm, S. Fortune's Voronoi code,
# CGAL and 3rd party plugin jet algorithms. See COPYING file for details.
#--------------------------------------------------------------------------
[{px: 64.7, py: 127, pz: 1.09e+03, E: 48.7}, {px: 1.2, py: 3.2, ...}]

To have additional output beyond what was asked for is pretty annoying. While the removal is ultimately something to discuss with the FastJet authors the banner isn't something that is required in the license to produce at runtime, so can it be caught and suppressed until it can be removed altogether?

edit: Well, depending on how you interpret "modified program" in

c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

chrispap95 commented 1 year ago

Well, in a given thread it appears once, I don't think that's too bad and if we are going to (somehow) suppress it we should definitely get the authors' approval since this behavior would deviate from the default C++ behavior. What I think is annoying is when working in multithreading environments, e.g., using futures in coffea, a banner is printed for each thread so you end up with a long print out in the beginning. However, I suspect it won't be easy to fix this.

matthewfeickert commented 1 year ago

Well, in a given thread it appears once, I don't think that's too bad ... What I think is annoying is when working in multithreading environments, e.g., using futures in coffea, a banner is printed for each thread so you end up with a long print out in the beginning.

It is annoying and really unnecessary. The example you give about multithreading just emphasizes this all the more.

and if we are going to (somehow) suppress it we should definitely get the authors' approval since this behavior would deviate from the default C++ behavior.

I think this should be followed up on. We've successfully gotten Wouter and David Kirkby to happily approve the removal of the RooFit banner (c.f. https://github.com/root-project/root/issues/9954, https://github.com/root-project/root/pull/9965) and the segment of the license that stipulates the banner bit is from 2007 (c.f. https://gitlab.com/fastjet/fastjet/-/commit/8d7e09471180735c78fbe64ec9ad215eab517ed7). As David Kirkby noted in https://github.com/root-project/root/issues/9954#issuecomment-1049023607

No serious library nowadays has such a banner, why should RooFit have it.

I agree with that assessment today, but the open-source landscape was quite different when that banner originated, over 20 years ago.

It is unfortunate that the FastJet authors have disabled Issues on the FastJet GitLab so the only way to discuss this with them would be over email.