Skip to content

Commit

Permalink
chore: more aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Beforerr committed Nov 19, 2024
1 parent 6f766bf commit ca05834
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/aliases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

const ELECTRON_ALIASES = ("electron", "e-", "e")
const PROTON_ALIASES = ("proton", "p+", "p", "H+")
const POSITRON_ALIASES = ("positron", "e+")
const NEUTRON_ALIASES = ("neutron", "n")
const MUON_ALIASES = ("muon", "μ", "μ-", "mu-", "mu")

"""
PARTICLE_ALIASES
Expand All @@ -10,23 +14,20 @@ 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(
"e+" => ("e", 1, 0),
"positron" => ("e", 1, 0),
"neutron" => :Neutron,
"n" => :Neutron,
(PROTON_ALIASES .=> Ref(("H", 1, 1)))...,
(ELECTRON_ALIASES .=> :Electron)...,
(NEUTRON_ALIASES .=> :Neutron)...,
(POSITRON_ALIASES .=> :Positron)...,
(MUON_ALIASES .=> :Muon)...,
"alpha" => ("He", 2, 4),
"deuteron" => ("H", 1, 2),
"D+" => ("H", 1, 2),
"tritium" => ("H", 0, 3),
"T" => ("H", 0, 3),
"triton" => ("H", 1, 3),
"T+" => ("H", 1, 3),
"mu-" => ("μ", -1, 0),
"muon" => ("μ", -1, 0),
"mu-" => :Muon,
"muon" => :Muon,
"antimuon" => ("μ", 1, 0),
"mu+" => ("μ", 1, 0),
)

ELECTRON_ALIASES_DICT = Dict(str => :Electron 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 ca05834

Please sign in to comment.