diff options
author | 2023-09-11 10:18:25 -0700 | |
---|---|---|
committer | 2023-09-11 10:18:25 -0700 | |
commit | ac52a762c297712411fec4877b9770e2bf4d4343 (patch) | |
tree | d2a5d0b3cd8c2da8083ac2101386d572f2e1e4f3 /Tools/Parser/input_file_parser.py | |
parent | 2e4d6fdd87615486a7c0da4081b92b2de32af2b5 (diff) | |
download | WarpX-ac52a762c297712411fec4877b9770e2bf4d4343.tar.gz WarpX-ac52a762c297712411fec4877b9770e2bf4d4343.tar.zst WarpX-ac52a762c297712411fec4877b9770e2bf4d4343.zip |
add collider-relevant reduced diags (#4024)
* added collider reduced diags
* added test
* fixed xy_ave and xy_std
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed usage of IntVect and removed print
* Set up automated CI test
To-do:
- Fix bug (erroneous arithmetic operation)
- Remove unused parameters from input file
* Fix warning: set mass only if WARPX_QED
* Use amrex::ParticleReal for mass
* Update Make.package to fix GNU Make build
* reduced_data.value() only once
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Merge `development` into `coll_rel_red_diags`
* updated 3d beam test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated 3d test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* `m_write_header` instead of `m_IsNotRestart`
* added angles
* updated 3d beam test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added 3 particle test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added warning
* updated diags names
* updated analysis multiple particles
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added positrons to test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update CI test
* Reuse input file parser from Tools
* Apply suggestions from code review
* Apply suggestions from code review
* changed order of diags and added docs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply WarpX style conventions
* Fix CodeQL alerts
* assert in RZ and removed fine ref levs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix compilation in 2D
* Fix compilation in RZ
* Update Docs/source/usage/parameters.rst
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Co-authored-by: Luca Fedeli <luca.fedeli.88@gmail.com>
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Co-authored-by: Luca Fedeli <luca.fedeli.88@gmail.com>
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.H
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.H
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* minimized number of kernel launches and parallel ops
* updated constructor of ReduceDiags
* fixed based on comments
* updated docs: if QED not enable
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed ReducedDiags constructor
* two passes instead of one for robusteness
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixed bugs
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix 1D build (typo `wtot` instead of `w_tot`)
* refixed compile in RZ
* check io process in chi_ave computation
* updated test
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Temporary fix: remove IOProcessor
* Update Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Apply suggestions from code review
* Remove `Debug` compilation mode from CI test
* CI test analysis: check all particles have same charge
* Use `m_beam_name` instead of `species_names`
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Luca Fedeli <luca.fedeli.88@gmail.com>
Diffstat (limited to 'Tools/Parser/input_file_parser.py')
-rw-r--r-- | Tools/Parser/input_file_parser.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Tools/Parser/input_file_parser.py b/Tools/Parser/input_file_parser.py new file mode 100644 index 000000000..0ab134f62 --- /dev/null +++ b/Tools/Parser/input_file_parser.py @@ -0,0 +1,32 @@ +def parse_input_file(input_file): + """ + Parse WarpX input file. + + Parameters + ---------- + input_file : string + Path to input file. + + Returns + ------- + input_dict : dictionary + Dictionary storing WarpX input parameters + (parameter's name stored as key, parameter's value stored as value). + """ + input_dict = dict() + with open(input_file) as ff: + for line in ff: + sline = line.split('=') + # skip lines that are commented out, blank, or continuation of previous parameters + skip_line = sline[0].startswith('#') or sline[0].startswith('\n') or len(sline) == 1 + if not skip_line: + key = sline[0].strip() + val = sline[1].split() + # The value corresponding to a given key of input_dict is a list + # of strings, from which we remove any leftover comments + for i in range(len(val)): + if val[i].startswith('#'): + val = val[:i] + break + input_dict[key] = val + return input_dict |