Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lorentz vectors, particle PDG, jet-clustering, oh my! -> some problems with examples #55

Open
JacekHoleczek opened this issue Aug 7, 2023 · 5 comments
Labels

Comments

@JacekHoleczek
Copy link
Contributor

JacekHoleczek commented Aug 7, 2023

I've met some problems with the examples in the "Lorentz vectors, particle PDG, jet-clustering, oh my!" chapter.

In the "Particle PDG" section:
particle.Particle.from_string("p~")
z_boson = particle.Particle.from_string("Z0")
and in the "Jet clustering" section:
probable_mass = particle.Particle.from_string("pi+").mass / GeV
generate warnings in the form:
<stdin>:1: DeprecationWarning: Call to deprecated class method from_string. (This method is deprecated and will be removed from version 0.23.0. Use finditer or findall instead.) -- Deprecated since version 0.22.

In the "Jet clustering" section, in the "fastjet" example:
good_pseudojets = pseudojets[pseudojets.pt > 0.1]
generates an error in the form:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../tutorial/lib/python3.11/site-packages/awkward/highlevel.py", line 1108, in __getattr__
    raise AttributeError(f"no field named {where!r}")
AttributeError: no field named 'pt'. Did you mean: 'px'?

Then I cannot "import fastjet" ... and when I try to "install fastjet" (from conda-forge), I get:

error    libmamba Could not solve for environment specs
    The following package could not be installed
    └─ fastjet does not exist (perhaps a typo or a missing channel).
critical libmamba Could not solve for environment specs
@jpivarski
Copy link
Collaborator

Then I cannot "import jetset"

I don't know what "jetset" is. Do you mean fastjet?

AttributeError: no field named 'pt'. Did you mean: 'px'?

It sounds like an array of Lorentz vectors was loaded without

vector.register_awkward()

Call to deprecated class method from_string.

Again, the tutorial is showing its age. If Particle is deprecating from_string, it should be replaced with finditer or findall. Both of these allow for the possibility of multiple matches. Maybe

particle.Particle.from_string("pi+")

should become

next(particle.Particle.finditer("pi+"))

(to bake-in the assumption that there's only one, or we're only interested in the first)?

@eduardo-rodrigues
Copy link
Member

See also https://github.com/scikit-hep/particle#getting-started-particles and of course the extensive docstrings :-).

@jpivarski
Copy link
Collaborator

Sorry, I get GitHub notifications via email, which can be out of date.

On fastjet in conda-forge—you're right, it's not done: scikit-hep/fastjet#133.

@JacekHoleczek
Copy link
Contributor Author

JacekHoleczek commented Aug 7, 2023

To my new pull request, I added the missing "vector.register_vawkward()" call (in the last example to make it fully self-contained), and I replaced from_string with findall in one place (as it returns a bit funny result there for the "p~").
I'm not sure if finditer or findall should be used elsewhere, so please fix the 2 remaining from_string places.
I assume, when replacing "particle.Particle.from_string("name")", one should use "particle.Particle.findall("name")[0]" or "next(particle.Particle.finditer("name"))" (not sure what to do when these methods return a list with more than one entries, like for the "p~").

@stale
Copy link

stale bot commented Oct 7, 2023

This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.

@stale stale bot added the stale label Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants