GithubHelp home page GithubHelp logo

scikit-hep / numpythia Goto Github PK

View Code? Open in Web Editor NEW
36.0 7.0 11.0 12.37 MB

The interface between PYTHIA and NumPy

License: GNU General Public License v3.0

Makefile 2.05% Python 13.47% C++ 18.39% C 0.84% Cython 65.25%
python numpy cython hep cern generators scikit-hep

numpythia's Introduction

scikit-hep: metapackage for Scikit-HEP

image

image

image

image

image

image

image

Project info

The Scikit-HEP project is a community-driven and community-oriented project with the aim of providing Particle Physics at large with an ecosystem for data analysis in Python embracing all major topics involved in a physicist's work. The project started in Autumn 2016 and its packages are actively developed and maintained.

It is not just about providing core and common tools for the community. It is also about improving the interoperability between HEP tools and the Big Data scientific ecosystem in Python, and about improving on discoverability of utility packages and projects.

For what concerns the project grand structure, it should be seen as a toolset rather than a toolkit.

Getting in touch

There are various ways to get in touch with project admins and/or users and developers.

scikit-hep package

scikit-hep is a metapackage for the Scikit-HEP project.

Installation

You can install this metapackage from PyPI with `pip`:

or you can use Conda through conda-forge:

All the normal best-practices for Python apply; you should be in a virtual environment, etc.

Package version and dependencies

Please check the setup.cfg and requirements.txt files for the list of Python versions supported and the list of Scikit-HEP project packages and dependencies included, respectively.

For any installed scikit-hep the following displays the actual versions of all Scikit-HEP dependent packages installed, for example:

Note on the versioning system:

This package uses Calendar Versioning (CalVer).

numpythia's People

Contributors

delgadoandrea avatar dependabot[bot] avatar eduardo-rodrigues avatar henryiii avatar marinang avatar ndawe avatar smeehan12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

numpythia's Issues

M1 support and/or Docker Image

Hi all,

thanks for this awesome package. I tried installing this on a M1 Mac, and it unsurprisingly failed. I was curious, would it be possible to provide a docker image or similar for numpythia?

Parents/Children ID Filters

Hi.
I would be nice to have filters to select particles with a specific mother ID or with specific children IDs.

Also when I do event.all(), it returns a numpy ndarray but it would be nice to have either more dtypes (like eta, ancestors_id, children_id ...) or if we do event.all()[i] we get a GenParticle.

What I basically need to do, is to select decay particles from a specific mother and check and they pass an acceptance cut and then write the events passing into an HepMC ascii file.

Matt

Expose end vertex

Hi there,

Thanks for your work on this project.

I see that you expose the production vertex for the particles, and was just wondering whether it is possible to do the same for the end vertices. Ideally, it would be great to have the ability to extract the vertices, and their in / out particles, preferably with an id attached to them so there's no need to do any dodgy boolean comparisons against floating point structured arrays (to identify unique particles / vertices amongst duplicates).

Kind regards,
Jacan.

Single Filters Fail

Hi. While using this package, I believe I have stumbled across a bug with the behavior of the filters. Consider the following code:

[. . .]
for event in pythia(events=n):
  selection = (STATUS == 1)
  selected_particles = event.all(selection)

selected_particles contains all particles from event, regardless of the status code. If you repeat the same condition twice, i.e., let selection = (STATUS == 1) & (STATUS == 1), selected_particles contains only particles with status code = 1, as expected.

I also tested this with PDG_ID and observed a similar error. If this is a difficult issue to fix, I would be happy to help in a few weeks when I have more time.

Ability to use an external Pythia installation

Similarly to what has been done for pyjet, it would be very useful to be able to use numpythia with an external Pythia installation. Indeed different experiments use different MC configurations, so this flexibility is a requirement to broaden the usability of the package.
There is already interest from LHCb, cf. raised interest from @cvazquezs.

HepMC3 output format incompatible with pyhepmc_ng

Hi there,

I tried out writing to HepMC with this package today, and then reading back in with pyhepmc_ng, but ran into an issue. Although the HepMC file says it's version 3.0.0 in the header, it still appears to use the deprecated IO_GenEvent prefix to START_EVENT_LISTING, vs the newer Asciiv3 prefix. There is some discussion of their usage here:
https://www.sciencedirect.com/science/article/pii/S0010465520301181

If I manually change the text in the header, it reads without issue.

Is this on purpose? Or would it be possible to update the header?

Kind regards,
Jacan.

Improve README/doc

By looking again a the code at I found out that most of the things I was looking for (in #2 for instance) but it is not documented.
You can for instance do a full a generator level study with numpythia which I thought was not possible.
Things that would be nice to show are:

  • more general way to use events without using hepmc_write, hepmc_read, just with pythia(events=nevts)
  • Then says something about GenEvent and GenParticle and their attributes (numpythia interface to HepMC GenEvent. and GenParticle)
  • Write all possible filters

Also an example section can be added.

Read in pre generated hepmc?

Hi,
Just wondering if it is possible to read in a pre generated hepmc file (in my case from madgraph5+pythia8)? I try the hepmc_read() function and get an error

ERROR::ReaderAscii: too few or too many particles were parsed
ERROR::ReaderAscii: too few or too many vertices were parsed
ERROR::ReaderAscii: event parsing failed. Returning empty event
DEBUG(1)::Parsing failed at line:
E 0 -1 -1.0000000000000000e+00 -1.0000000000000000e+00 -1.0000000000000000e+00 0 0 180 1 2 0 1 2.3174000000000004e-02

Best regards,
Billy Ford

Contribution Guide

After encountering #20, I started exploring the code to see if it was feasible for me to submit a PR that fixes the issue. Related to that, it would be nice if there were a 'contribute' section in the README or elsewhere that gave a short guide on how to get started contributing to the project.

A few paragraphs containing (1) how to setup the necessary tools, (2) how the code is structured, and (3) a link to a Cython reference or guide might help encourage contributions from new authors.

"Or" filter

Hi there! Thanks for creating/maintaining this package, it's a really nice way to run Pythia8 (and easy to set up via pip, which makes it more portable than the fullblown Pythia8).

The example code shown in the readme demonstrates how to and conditions (&) and, I assume, how to negate conditions (~) (although these are not explicitly explained). However, it's not clear if there is any way to or operators as this does not seem to be mentioned or demonstrated in the documentation, and I'm not sure I entirely understood the Cython code, though I do see what looks like the logic for and starting at line 69 of that file.

If the functionality is not there, it would be really great to be able to apply or logic to filters -- for example, if the user wants to pick a particle whose ID matches one of many options:

selection = (numpythia.PDG_ID == 1) | (numpythia.PDG_ID == 2)

It would actually be great to perform this using some sort of list matching, e.g.

selection = numpythia.PDG_ID in [1,2,3]

as the other example could get unwieldy if the list of requested PDG_ID's is very long / configurable, but I imagine this would perhaps be more complicated to implement.

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.