Giter Site home page Giter Site logo

Comments (10)

lyazj avatar lyazj commented on September 17, 2024 1

Hello, @Sinclert ! Please check https://github.com/lyazj/tmp/raw/master/work.tar.gz for details about my run if needed. All exceptions were raised when invoking 'work(.tar.gz)/parton_lhe.py'.

Best wishes~

from madminer.

lyazj avatar lyazj commented on September 17, 2024 1

Yes, it works well after upgrading vector to 0.8.4, with the latest revision of MadMiner. Thanks very much for your effective support and hope the additional tests will be of help to us!

I'll close the issue for its successful completion. Enjoy your holiday!

See you~

from madminer.

Sinclert avatar Sinclert commented on September 17, 2024

Hi @lyazj ,

Thank you for letting us know.

I created a PR to fix the initialization of MadMinerParticle objects, so they use the class-method helpers instead of the usual constructor. For details check PR #471

from madminer.

lyazj avatar lyazj commented on September 17, 2024

Hi @Sinclert ,

Thanks very much! It was an interesting bug. Now it works well in creating MadMinerParticle objects. However, maybe another bug needs fixing with class MadMinerParticle that it doesn't assign a field named 'm' to any of its objects, but the field is referenced by function _smear_particles at line 1034 and 1060, in file 'lhe.py'.

Exception raised as below:

Traceback (most recent call last):
  File "parton_lhe.py", line 102, in <module>
    lhe.analyse_samples()
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 593, in analyse_samples
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 706, in _parse_sample
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 146, in parse_lhe_file
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 346, in _parse_event
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 1034, in _smear_particles
AttributeError: 'MadMinerParticle' object has no attribute 'm'

We came very close to success. Let's try again!

Best wishes~

from madminer.

Sinclert avatar Sinclert commented on September 17, 2024

Yes, that is a different bug, related with the missing properties m (mass) and e (energy).

I believe the the problem relies in the inherited class, which does not provide those properties. I will change the ObjectVector4D by the inmediately descendant class (MomentumObject4D), which does in fact provides those properties.

from madminer.

Sinclert avatar Sinclert commented on September 17, 2024

@lyazj is it solved now?

from madminer.

lyazj avatar lyazj commented on September 17, 2024

Hello, @Sinclert !

Thanks for your effort! The last problem was perfectly solved. However, I noticed a pair of redundant parenthesis, which caused the exception below:

Traceback (most recent call last):
  File "parton_lhe.py", line 102, in <module>
    lhe.analyse_samples()
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 593, in analyse_samples
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 706, in _parse_sample
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 146, in parse_lhe_file
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 346, in _parse_event
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 1052, in _smear_particles
TypeError: 'numpy.float64' object is not callable

It comes from the code below(at line 1052, in file '_smear_particles'):

phi = _smear_variable(particle.phi(), phi_resolutions, pdgid)

I tried removing the redundant parenthesis, but new problem emerged:

Traceback (most recent call last):
  File "parton_lhe.py", line 102, in <module>
    lhe.analyse_samples()
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 593, in analyse_samples
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/lhe/lhe_reader.py", line 706, in _parse_sample
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 146, in parse_lhe_file
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 352, in _parse_event
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/interfaces/lhe.py", line 950, in _get_objects
  File "/home/lyazj/.local/lib/python3.8/site-packages/madminer-0.8.1-py3.8.egg/madminer/utils/particle.py", line 54, in __iadd__
  File "/home/lyazj/.local/lib/python3.8/site-packages/vector/_backends/object_.py", line 197, in __iadd__
    return _replace_data(self, numpy.add(self, other))  # type: ignore
  File "/home/lyazj/.local/lib/python3.8/site-packages/vector/_backends/object_.py", line 245, in __array_ufunc__
    if not isinstance(_handler_of(*inputs), VectorObject):
  File "/home/lyazj/.local/lib/python3.8/site-packages/vector/_methods.py", line 2550, in _handler_of
    elif _handler_priority.index(
ValueError: 'madminer.utils.particle' is not in list

All this comes from following the tutorial, but without Docker. I think I should upload my code(almost as same as that in the tutorial) tomorrow, making debugging more conveniently.

from madminer.

Sinclert avatar Sinclert commented on September 17, 2024

Hi @lyazj ,

Thanks for the detailed explanation 😃

As you said, the parenthesis around particle.phi are just deprecated, as the vector package offer phi as a property.

Regarding the += (__iadd__) operation exception, I am afraid it will be more complicated. Turns out vector has different computing backends (awkward, numba, numpy and pure Python), in hierarchical order. They created a dispatch function so that, when two vectors belong to the same type, the proper backend operation is called, using the vector's __module__ to differentiate themselves.

With the MadMinerParticle class we built on top of MomentumVector4D, __module__ points to madminer.utils.particle.py, which is not recognizes by vector as a valid Python module.


Unless I am mistaken, the definition of derived classes is something that should be allowed in the vector package itself. I will open an issue there for us.

from madminer.

lyazj avatar lyazj commented on September 17, 2024

Hi @Sinclert , thanks a lot! It seems that we have some trouble in solving the latter problem and I guess you will be right. Then let's wait for vector's responding!

Best wishes~

from madminer.

Sinclert avatar Sinclert commented on September 17, 2024

I just merged PR #474, bumping vector to its new version (0.8.4). Hopefully it works now🤞🏻

What this whole thread show me is that we need to include Jupyter notebooks tests into the CI. Otherwise, the set of examples will continue to fall behind and we will not realise it. I will give it a try after I return from holidays. It seems that Papermill is a good package to do so.

from madminer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.