Skip to content

Commit

Permalink
refactor: Add electron and proton aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Beforerr committed Nov 14, 2024
1 parent b67caab commit ca0b458
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/aliases.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Common particle aliases

const ELECTRON_ALIASES = ("electron", "e-", "e+")
const PROTON_ALIASES = ("proton", "p+", "p", "H+")
"""
PARTICLE_ALIASES
Expand All @@ -7,13 +10,8 @@ Dictionary of common particle aliases and their corresponding (symbol, charge, m
Each entry maps a string alias to a tuple of (symbol, charge, mass_number)
"""
PARTICLE_ALIASES = Dict(
"electron" => ("e", -1, 0),
"e-" => ("e", -1, 0),
"e+" => ("e", 1, 0),
"positron" => ("e", 1, 0),
"proton" => ("H", 1, 1),
"p+" => ("H", 1, 1),
"p" => ("H", 1, 1),
"neutron" => ("n", 0, 1),
"n" => ("n", 0, 1),
"alpha" => ("He", 2, 4),
Expand All @@ -27,4 +25,8 @@ PARTICLE_ALIASES = Dict(
"muon" => ("μ", -1, 0),
"antimuon" => ("μ", 1, 0),
"mu+" => ("μ", 1, 0),
)
)

ELECTRON_ALIASES_DICT = Dict(str => ("e", -1, 0) for str in ELECTRON_ALIASES)
PROTON_ALIASES_DICT = Dict(str => ("H", 1, 1) for str in PROTON_ALIASES)
PARTICLE_ALIASES = merge(PARTICLE_ALIASES, ELECTRON_ALIASES_DICT, PROTON_ALIASES_DICT)

0 comments on commit ca0b458

Please sign in to comment.