Skip to content

Commit

Permalink
centralize org2py.awk
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Feb 27, 2024
1 parent 833e8c3 commit ad054ed
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ __pycache__/
calorimeters/test/
*.d
*.pcm

# org2py output
benchmarks/backgrounds/ecal_backwards.py
benchmarks/ecal_gaps/ecal_gaps.py
12 changes: 12 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ rule matplotlibrc:
fp.write("backend: Agg\n")
# interactive mode prevents plt.show() from blocking
fp.write("interactive : True\n")


rule org2py:
input:
notebook=workflow.basedir + "/{NOTEBOOK}.org",
converter=workflow.source_path("benchmarks/common/org2py.awk"),
output:
"{NOTEBOOK}.py"
shell:
"""
awk -f {input.converter} {input.notebook} > {output}
"""
13 changes: 1 addition & 12 deletions benchmarks/backgrounds/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,12 @@ ddsim \
"""


rule backgrounds_org2py:
input:
notebook=workflow.source_path("ecal_backwards.org"),
converter=workflow.source_path("./org2py.awk"),
output:
"ecal_backwards.py"
shell:
"""
awk -f {input.converter} {input.notebook} > {output}
"""

DETECTOR_CONFIG=os.environ["DETECTOR_CONFIG"]

rule backgrounds_ecal_backwards:
input:
matplotlibrc=".matplotlibrc",
script="ecal_backwards.py",
script="benchmarks/backgrounds/ecal_backwards.py",
electron_beam_gas_gen="input/backgrounds/beam_gas_electron.hepmc",
electron_beam_gas_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/beam_gas_electron.edm4hep.root",
physics_signal_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_1.edm4hep.root",
Expand Down
File renamed without changes.
13 changes: 1 addition & 12 deletions benchmarks/ecal_gaps/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,12 @@ eicrecon {input} -Ppodio:output_file={output} \
"""


rule ecal_gaps_org2py:
input:
notebook=workflow.source_path("ecal_gaps.org"),
converter=workflow.source_path("./org2py.awk"),
output:
"ecal_gaps.py"
shell:
"""
awk -f {input.converter} {input.notebook} > {output}
"""

DETECTOR_CONFIG=os.environ["DETECTOR_CONFIG"]

rule ecal_gaps:
input:
matplotlibrc=".matplotlibrc",
script="ecal_gaps.py",
script="benchmarks/ecal_gaps/ecal_gaps.py",
# TODO pass as a file list?
_=expand(
"sim_output/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root",
Expand Down
22 changes: 0 additions & 22 deletions benchmarks/ecal_gaps/org2py.awk

This file was deleted.

0 comments on commit ad054ed

Please sign in to comment.