-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding demo files and a few fixes (#35)
- Loading branch information
Showing
4 changed files
with
368 additions
and
9 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
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,348 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"![DecayLanguage](../images/DecayLanguage.png)\n", | ||
"\n", | ||
"### Henry Schreiner and Eduardo Rodrigues\n", | ||
"\n", | ||
"The demos assume you have run `python -m pip install decaylanguage`. The demos use Python 3, though the package also supports Python 2 for now." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"DecayLanguage was designed to support manipulating decay structures in Python. It started with a <font color=\"green\">specific focus</font>, and is <font color=\"green\">slowly generalizing</font>. The current package has:\n", | ||
"\n", | ||
"* **Decay**: Amplitude Analysis decay language\n", | ||
" - Input based on AmpGen\n", | ||
" - Current output formats:\n", | ||
" * GooFit C++\n", | ||
"* **Dec**: DecFile parsers\n", | ||
" - Read DecFiles, such as the LHCb master DecFile\n", | ||
" - Manipulate in Python" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"## DecayLanuage: Decay\n", | ||
"\n", | ||
"This takes a file in the <font color=\"green\">\"AmpGen\" format</font> and converts it to a DecayChain. Currently one output converter is included: <font color=\"green\">GooFit C++</font>." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with open('simple_model.txt') as f:\n", | ||
" print(f.read())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"!python3 -m decaylanguage -G goofit simple_model.txt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"source": [ | ||
"You can query this information from Python too:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from decaylanguage.decay.goofit import GooFitChain" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"lines, all_states = GooFitChain.read_ampgen('simple_model.txt')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"lines[0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"## DecayLanguage: DecFile\n", | ||
"\n", | ||
"<font color=\"red\">Under heavy development, syntax may change</font>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from decaylanguage.dec import DecFileParser\n", | ||
"from decaylanguage.dec.dec import ChargeConjugateReplacement" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"with open('../tests/data/test_example_Dst.dec') as f:\n", | ||
" print(f.read())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"parser = DecFileParser('../tests/data/test_example_Dst.dec')\n", | ||
"parser" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.parse()\n", | ||
"parser" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"d = parser.build_decay_chain('D+')\n", | ||
"d" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.print_decay_modes('D*+')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.list_decay_mother_names()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.list_decay_modes('D*+')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"source": [ | ||
"#### Charge conj:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"parser._parsed_dec_file.children[0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ChargeConjugateReplacement().visit(parser._parsed_dec_file.children[0])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ChargeConjugateReplacement().visit(parser._parsed_dec_file.children[0])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"### Large DecFiles\n", | ||
"\n", | ||
"Now let's read in a 11,000 line dec file." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%time\n", | ||
"parser = DecFileParser('../decaylanguage/data/DECAY_LHCB.DEC')\n", | ||
"parser.parse(include_ccdecays=False)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"parser" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.dict_aliases()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "subslide" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"parser.dict_charge_conjugates()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"slideshow": { | ||
"slide_type": "slide" | ||
} | ||
}, | ||
"source": [ | ||
"Stay tuned, follow the development and/or contribute!" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"celltoolbar": "Slideshow", | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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,8 @@ | ||
EventType D0 K- pi+ pi+ pi- | ||
|
||
D0[D]{K*(892)bar0{K-,pi+},rho(770)0{pi+,pi-}} 2 1 0 2 0 0 | ||
D0[D]{rho(1450)0{pi+,pi-},K*(892)bar0{K-,pi+}} 0 0.648936 0.0205762 0 -0.271637 0.0342107 | ||
D0[P]{K*(892)bar0{K-,pi+},rho(770)0{pi+,pi-}} 0 0.362058 0.00237314 0 -1.79607 0.00663691 | ||
D0[P]{rho(1450)0{pi+,pi-},K*(892)bar0{K-,pi+}} 0 0.642781 0.00570074 0 1.69828 0.00900026 | ||
|
||
D0_radius 2 0.0037559 0 |