Skip to content

Commit

Permalink
Merge e480635 into e8e7889
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Aug 13, 2018
2 parents e8e7889 + e480635 commit aa92b06
Show file tree
Hide file tree
Showing 29 changed files with 4,087 additions and 340 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include tox.ini .travis.yml .appveyor.yml
recursive-include decaylanguage *.py
recursive-include decaylanguage *.csv
recursive-include decaylanguage *.txt
recursive-include decaylanguage *.lark

recursive-include images *.pdf
recursive-include images *.png
Expand Down
12 changes: 5 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

attrs = ">=17.0"
pandas = ">=0.22"
plumbum = ">=1.6.6"
numpy = ">=1.12"
six = ">=1.11"
pathlib2 = {version = ">=2.3", markers="python_version < '3.5'"}
enum34 = {version = ">=1.1", markers="python_version < '3.4'"}

lark-parser = ">=0.6.3"

[dev-packages]

graphviz = ">=0.8.2""
graphviz = ">=0.8.2"
pytest = "*"
jupyter = {extras = ["all"]}
sphinx = "*"
sphinx-rtd-theme = "*"

jupyterlab = "*"
ipykernel = "*"
decaylanguage = {editable = true, path = "."}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ particle. There are lots of printing choices, `describe()`,
`programmatic_name()`, `html_name()`, html printing outs in notebooks,
and of course `repr` and `str` support.

You can quickly search for particles from the command line with:

```
python -m decaylanguage.particle 311
```

You can put one or more PDG ID numbers here, or string names.

## Decays

The most common way to create a decay chain is to read in an [AmpGen]
Expand Down
2 changes: 1 addition & 1 deletion decaylanguage/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class DecayLanguageDecay(cli.Application):
generator = cli.SwitchAttr('-G,--generator', cli.Set('goofit'))
generator = cli.SwitchAttr(['-G','--generator'], cli.Set('goofit'), mandatory=True)

def main(self, filename):
if self.generator == 'goofit':
Expand Down
12 changes: 0 additions & 12 deletions decaylanguage/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,3 @@
from importlib.resources import open_text
except ImportError:
from importlib_resources import open_text


def get_mass_width():
return open_text('decaylanguage.data', 'mass_width_2008.csv')


def get_special():
return open_text('decaylanguage.data', 'MintDalitzSpecialParticles.csv')


def get_latex():
return open_text('decaylanguage.data', 'pdgID_to_latex.txt')
60 changes: 60 additions & 0 deletions decaylanguage/data/ampgen.lark
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
start : _NEWLINE? (line _NEWLINE)+

?line : cplx_decay_line | cart_decay_line | invert_line | constant | variable | options | event_type

options : fast_coherent_sum | output | nevents

fast_coherent_sum : "FastCoherentSum::UseCartesian" INT
output : "Output" ESCAPED_STRING
nevents : "nEvents" INT
event_type : "EventType" particle particle+

constant : particle SIGNED_NUMBER
variable : particle fix SIGNED_NUMBER SIGNED_NUMBER
cplx_decay_line : decay fixed_cplx fixed_cplx
cart_decay_line : decay fixed_cplx

// Particle could have a number in front
// TODO: This could pull out the - or -NUMBER* part
invert_line : particle "=" particle

fixed_cplx : fix SIGNED_NUMBER SIGNED_NUMBER

fix : "0" -> free
| "2" -> fixed

decay : particle ( decaytype? subdecay )?

decaytype : "[" (spinfactor | lineshape) (";" lineshape)? "]"

spinfactor : SPIN
lineshape : LINESHAPE

particle : LABEL

subdecay : "{" decay "," decay "}"

// Terminal defintions

%import common.WS_INLINE
%import common.SIGNED_NUMBER
%import common.DIGIT
%import common.INT
%import common.LETTER
%import common.ESCAPED_STRING

SPIN : "S" | "P" | "D"
LINESHAPE : CHAR (CHAR | ".")+
CHAR : LETTER | DIGIT | "_" | "/"
PRIME : "'"
STAR : "*"
PARENS : "(" | ")"
LABEL : ( CHAR | DIGIT | PRIME | STAR | "::" | "+" | "-" | PARENS )+
COMMENT : /[#][^\n]*/
_NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+

// We should ignore comments
%ignore COMMENT

// Disregard spaces in text
%ignore WS_INLINE
56 changes: 56 additions & 0 deletions decaylanguage/data/decfile.lark
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
start : _NEWLINE? (line _NEWLINE)+ ("End" _NEWLINE)?
?line : define | pythia_def | alias | chargeconj | commands | decay | cdecay | setlspw

pythia_def : "PythiaBothParam" LABEL ":" LABEL "=" (LABEL | SIGNED_NUMBER)

setlspw : "SetLineshapePW" label label label value

cdecay : "CDecay" label

define : "Define" label value

alias : "Alias" label label

chargeconj : "ChargeConj" label label

?commands : global_photos

global_photos : boolean_photos

boolean_photos : "yesPhotos" -> yes
| "noPhotos" -> no

decay : "Decay" particle _NEWLINE decayline+ "Enddecay"
decayline : value particle* photos? model _NEWLINE // There is always a ; here
value : SIGNED_NUMBER
photos : "PHOTOS"

label : LABEL
particle : LABEL // Add full particle parsing here

model : MODEL_NAME model_options?
model_options : (value | LABEL)+

// model : model_generic
// model_helamp : "HELAMP" (SIGNED_NUMBER SIGNED_NUMBER)+

// Terminal defintions
// To use a fast parser, we need to avoid conflicts

%import common.WS_INLINE
%import common.SIGNED_NUMBER

// New lines filter our comments too, and multiple new lines
_NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+

// We must set priorities here to use lalr - match model name above label, and label above something else
MODEL_NAME.2 : "BaryonPCR"|"BTO3PI_CP"|"BTOSLLALI"|"BTOSLLBALL"|"BTOXSGAMMA"|"BTOXSLL"|"CB3PI-MPP"|"CB3PI-P00"|"D_DALITZ"|"ETA_DALITZ"|"GOITY_ROBERTS"|"HELAMP"|"HQET"|"ISGW2"|"OMEGA_DALITZ"|"PARTWAVE"|"PHSP"|"PI0_DALITZ"|"PYTHIA"|"SLN"|"STS"|"SVP_HELAMP"|"SVS"|"SVV_HELAMP"|"TAUHADNU"|"TAULNUNU"|"TAUSCALARNU"|"TAUVECTORNU"|"TSS"|"TVS_PWAVE"|"VLL"|"VSP_PWAVE"|"VSS"|"VSS_BMIX"|"VUB"|"VVP"|"VVPIPI"|"VVS_PWAVE"

LABEL : /[a-zA-Z0-9\/\-+*_()']+/
COMMENT : /[;#][^\n]*/

// We should ignore comments
%ignore COMMENT

// Disregard spaces in text
%ignore WS_INLINE
Loading

0 comments on commit aa92b06

Please sign in to comment.