-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
598 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "."} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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 SIGNED_NUMBER | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Forms: | ||
# ampgen | ||
# decfile | ||
|
||
start : prebar? name family? spin? mass? bar? charge | ||
|
||
name : PNAME | ||
charge : CHARGE | ||
prebar : "anti-" | ||
bar : "~" | ||
|
||
spin : spin_brackets | spin_underscore | spin_star | ||
family : family_brackets | family_underscore | ||
|
||
spin_brackets : "(" DIGIT ")" | ||
spin_underscore : "_" DIGIT | ||
spin_star : "*" | ||
|
||
family_brackets : "(" CNAME ")" | ||
|
||
mass : "(" MASS ")" | ||
|
||
bar : BAR | ||
star : STAR | ||
prime : PRIME | ||
PRIME : "'" | ||
STAR : "*" | ||
|
||
MASS : DIGIT DIGIT+ | ||
BAR : "bar" | ||
PNAME : (LETTER | "/")+ | ||
CHARGE : "--" | "+" | "0" | "-" | "--" | ||
|
||
%import common.CNAME | ||
%import common.DIGIT |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from lark import Transformer, Tree | ||
|
||
def get_from_parser(parser, key): | ||
return [v.children for v in parser.find_data(key)] | ||
|
||
class AmpGenTransformer(Transformer): | ||
def constant(self, lines): | ||
particle, value = lines | ||
return Tree('constant', [str(particle.children[0]), float(value)]) | ||
def event_type(self, lines): | ||
return Tree('event_type', [str(p.children[0]) for p in lines]) | ||
def fixed(self, lines): | ||
return False | ||
def free(self, lines): | ||
return True | ||
def variable(self, lines): | ||
p, free, value, error = lines | ||
return Tree('variable', [str(p.children[0]), free, float(value), float(error)]) | ||
def cplx_decay_line(self, lines): | ||
decay, real, imag = lines | ||
real_free, real_val, real_err = real.children | ||
imag_free, imag_val, imag_err = imag.children | ||
|
||
decay['fix'] = not (real_free and imag_free) | ||
decay['amp'] = complex(float(real_val), float(imag_val)) | ||
decay['err'] = complex(float(real_err), float(imag_err)) | ||
|
||
return Tree('cplx_decay_line', decay) | ||
|
||
def decay(self, lines): | ||
particle, = lines[0].children | ||
dic = {'name' : str(particle), 'daughters' : []} | ||
|
||
for line in lines[1:]: | ||
if line.data == 'subdecay': | ||
dic['daughters'] += line.children | ||
elif line.data == 'decaytype': | ||
for children in line.children: | ||
if children.data == 'spinfactor': | ||
dic['spinfactor'], = children.children | ||
elif children.data == 'lineshape': | ||
dic['lineshape'], = children.children | ||
|
||
return dic |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.