All Projects → JuliaPhysics → Corpuscles.jl

JuliaPhysics / Corpuscles.jl

Licence: MIT license
Julia package for particle physics

Programming Languages

julia
2034 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Corpuscles.jl

particle
Package to deal with particles, the PDG particle data table, PDGIDs, etc.
Stars: ✭ 113 (+352%)
Mutual labels:  analysis, pid, particle, high-energy-physics, hep, particle-physics, pdg
decaylanguage
Package to parse decay files, describe and convert particle decays between digital representations.
Stars: ✭ 34 (+36%)
Mutual labels:  analysis, particles, high-energy-physics, hep, particle-physics, hep-ex
UnROOT.jl
Native Julia I/O package to work with CERN ROOT files
Stars: ✭ 52 (+108%)
Mutual labels:  analysis, high-energy-physics, hep, particle-physics, hep-ex
ml-lpi
Materials for ML course at Lebedev Physical Institute
Stars: ✭ 31 (+24%)
Mutual labels:  hep, particle-physics, hep-ex
Statistics-Notes
Personal notes on statistics with a focus on applications to experimental high energy physics
Stars: ✭ 19 (-24%)
Mutual labels:  high-energy-physics, hep
alice-rs
Analyze the public data from the CERN base ALICE collaboration with Rust
Stars: ✭ 81 (+224%)
Mutual labels:  hep, particle-physics
ParticleLib
Multiversion spigot library supporting all particles and their data (1.8-1.18.2)
Stars: ✭ 156 (+524%)
Mutual labels:  particles, particle
Three.proton
three.proton is a magical 3d particle engine using three.js library. It is based on the Proton engine library.
Stars: ✭ 327 (+1208%)
Mutual labels:  particles, particle
Proton
Javascript particle animation library
Stars: ✭ 1,958 (+7732%)
Mutual labels:  particles, particle
Uproot3
ROOT I/O in pure Python and NumPy.
Stars: ✭ 312 (+1148%)
Mutual labels:  analysis, hep
root pandas
A Python module for conveniently loading/saving ROOT files as pandas DataFrames
Stars: ✭ 108 (+332%)
Mutual labels:  analysis, hep
Uproot4
ROOT I/O in pure Python and NumPy.
Stars: ✭ 80 (+220%)
Mutual labels:  analysis, hep
LatticeQCD.jl
A native Julia code for lattice QCD with dynamical fermions in 4 dimension.
Stars: ✭ 85 (+240%)
Mutual labels:  hep, particle-physics
power-mode-input
PowerModeInput can make your text input box more compelling
Stars: ✭ 68 (+172%)
Mutual labels:  particles, particle
pylhe
Lightweight Python interface to read Les Houches Event (LHE) files
Stars: ✭ 29 (+16%)
Mutual labels:  hep, particle-physics
weaver
Streamlined neural network training.
Stars: ✭ 22 (-12%)
Mutual labels:  hep, hep-ex
Scikit Hep
Metapackage of Scikit-HEP project data analysis packages for Particle Physics.
Stars: ✭ 131 (+424%)
Mutual labels:  analysis, hep
phaser-particle-editor-plugin
This plugin creates particles based on JSON data generated by Phaser Particle Editor
Stars: ✭ 28 (+12%)
Mutual labels:  particles, particle
GPU-Fog-Particles
Textureless fog particles using a highly customizable shader to attenuate noise values.
Stars: ✭ 303 (+1112%)
Mutual labels:  particles
vulnscan
A static binary vulnerability scanner
Stars: ✭ 47 (+88%)
Mutual labels:  analysis

Stable Dev Build Status Codecov DOI

Corpuscles.jl

Corpuscles.jl is a package which gives easy access to particle properties and identification codes summarised and defined by the Particle Data Group (PDG) collaboration. The cleaned CSV versions of these data are provided by courtesy of the Scikit-HEP project and are part of the Particle Python module which inspired us to create a similar package for the Julia Language. Corpuscles.jl is by far not as feature complete as Particle, but we add functionality continuously, as needed. Feel free to create an Issue or pull request if you find any bugs or have suggestions to improve.

Usage

The Particle struct can be used to create a particle. If an integer value is passed, it will be interpreted as PDG ID, which is the primary particle encoding in Corpuscles.jl:

julia> using Corpuscles

julia> p = Particle(12)
Particle(12) 'nu(e)'

To get an overview of the available particle information, use print():

julia> print(p)
Name:    K(4)*(2045)
PDG ID:  -319
LaTeX:   $\bar{K}_{4}^{*}(2045)^{0}$
Status:  Common
Width = 198.0 MeV ± 30.0 MeV
Q (charge) = 0//1 e
Composition = Ds
Isospin = 1//2
Mass = 2045.0 MeV ± 9.0 MeV
P (space parity) = 1

The properties are accessible via attributes:

julia> fieldnames(Particle)
(:pdgid, :mass, :width, :charge, :isospin, :parity, :gparity, :cparity, :antiprop, :rank, :status, :name, :quarks, :latex)

julia> p.quarks
"Ds"

julia> p.isospin
1//2

julia> p.mass
2045.0 MeV ± 9.0 MeV

There are tons of helper functions to check other properties:

julia> filter(hasstrange, particles())
257-element Array{Particle,1}:
 Particle(3224) Sigma(1385)
 Particle(23124) Lambda(1890)
 Particle(-13324) Xi(1820)
 Particle(-329) K(4)*(2045)
 ⋮
 Particle(13124) Lambda(1690)
 Particle(-100321) K(1460)
 Particle(20433) D(s1)(2460)
julia> filter(islepton, particles())
16-element Array{Particle,1}:
 Particle(18) nu(tau')
 Particle(15) tau
 Particle(11) e
 Particle(13) mu
 Particle(14) nu(mu)
 Particle(17) tau'Particle(12) nu(e)
 Particle(-14) nu(mu)
 Particle(-16) nu(tau)
 Particle(-12) nu(e)
 Particle(-13) mu

Units

For some properties like mass and width we use the Unitful package, which makes it easy to combine values with physical units:

julia> typeof(p.mass)
Corpuscles.MeasuredValue{𝐋^2 𝐌 𝐓^-2}

julia> p.mass
2045.0 MeV ± 9.0 MeV

julia> p.mass.value
2045.0 MeV

julia> p.mass.lower_limit
9.0 MeV

julia> p.mass.upper_limit
9.0 MeV

and also Base.isless and Base.isapprox are implemented so that the lower and upper limits are taken into account, as seen here:

julia> using Unitful

julia> p.mass
2045.0 MeV ± 9.0 MeV

julia> p.mass > 2036u"MeV"
false

julia> p.mass > 2035u"MeV"
true

Particle Codes

Corpuscles currently supports conversions of Pythia and Geant3 codes to PDG using the Pythia and Geant3ID types. The corresponding number is simply passed to the type and then to the Particle itself. The PDG ID will be converted if possible, otherwise an error will be raised.

julia> Particle(Geant3ID(5))
Particle(-13) 'mu'

Finding Particles

The particles() functions returns a Vector containing all the particles of the currently selected catalog. To search for particles, the filter() function comes in hand which can be combined with string comparison functions like startswith() or occursin().

Here is an example how to find all particles with names starting with "nu":

julia> filter(p->startswith(p.name, "nu"), particles())
6-element Array{Particle,1}:
 Particle(-14) 'nu(mu)'
 Particle(-16) 'nu(tau)'
 Particle(-12) 'nu(e)'
 Particle(14) 'nu(mu)'
 Particle(16) 'nu(tau)'
 Particle(12) 'nu(e)'

A more powerful way to filter particles based on patterns in their name is using [regular expressions](https://docs.julialang.org/en/v1/manual/strings/#Regular-Expressio ns-1) with e.g. occursin():

julia> filter(p->occursin(r"D\(\d*\)", p.name), particles())
10-element Array{Particle,1}:
 Particle(-10421) 'D(0)*(2300)'
 Particle(-10411) 'D(0)*(2300)'
 Particle(425) 'D(2)*(2460)'
 Particle(10411) 'D(0)*(2300)'
 Particle(10421) 'D(0)*(2300)'
 Particle(10423) 'D(1)(2420)'
 Particle(-425) 'D(2)*(2460)'
 Particle(-10423) 'D(1)(2420)'
 Particle(415) 'D(2)*(2460)'
 Particle(-415) 'D(2)*(2460)'

Another useful feature is the Particle(n::String, anti=false) which directly creates a (anti-)particle from a given name -- as long as it exists in the currently loaded particle dataset:

julia> Particle("mu") == Particle(13)
true

julia> -Particle("mu") == Particle(-13)
true

julia> Particle("anti-mu") == Particle(-13)
true

julia> Particle("mu~") == Particle(-13)
true

julia> Particle("muon") == Particle(13)
true

julia> Particle("mu-") == Particle(13)
true

julia> Particle("mu+") == -Particle(13)
true
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].