scikit-hep / pyhepmc

Easy-to-use Python bindings for HepMC3
https://scikit-hep.org/pyhepmc/
BSD 3-Clause "New" or "Revised" License
21 stars 12 forks source link

ValueError: vector::_M_default_append #14

Closed romanovzky closed 2 years ago

romanovzky commented 4 years ago

Hi there, I was trying out this library in python using with a file I generated. This is the code I ran:

import pyhepmc_ng

adapter = pyhepmc_ng.ReaderAsciiHepMC2(filename="file.hepmc")

evt = pyhepmc_ng.GenEvent(
    momentum_unit=pyhepmc_ng.Units.GEV, length_unit=pyhepmc_ng.Units.MM
)

adapter.read_event(evt)

which returns the error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-12-9f5860f373ad> in <module>
      7 )
      8 
----> 9 adapter.read_event(evt)

ValueError: vector::_M_default_append

Disclaimer: I am not versed in hepmc, I was following the logic from here.

Cheers

HDembinski commented 4 years ago

Hi, thanks for trying this out. Unfortunately, we couldn't turn this project into the default Python API for HepMC3, they have their own independent Python bindings. Therefore, I cannot offer much support. I don't see something that you did wrong at first glance, it looks like a bug in our library.

tl;dr: I do not have time to support this library at the moment, so if you are doing serious work, I would recommend the official HepMC3 Python API for now.

romanovzky commented 4 years ago

Hi @HDembinski thank you very much for your reply.

I'm sadden to hear that, I was looking forward to having a python interface that wouldn't required installing HepMC...

All the best!

HDembinski commented 3 years ago

@romanovzky For my curiosity, did you find a solution or did you switch to the official HepMC3 Python bindings?

romanovzky commented 3 years ago

Hi @HDembinski neither to be honest. I was attempting this route to avoid having to use C++, but I just went on with it. I'm still very keen on a working python interface/wrapper, as almost all my work and workflow is strictly pythonic.


Also, I was bound to hepmc2 files, and the only hepmc3 seemed to have working python3 bindings?

HDembinski commented 3 years ago

Thanks for the heads up. I think you can read the HepMC2 format with HepMC3.

romanovzky commented 3 years ago

Now that you say that, I think I tried to use HepMC3 python bindings but had a similar issue. I can't recall the details as I was already not really convinced about the approach anymore. In any case, I did need to put together a FastJet routine, so using C++ was the obvious way. I just wanted to explore a python approach.

HDembinski commented 2 years ago

I cannot reproduce this in the latest version, so hopefully updating will fix things for you.