Skip to content

Commit

Permalink
Search included input files for GENMODEL and GENTYPE if not present i…
Browse files Browse the repository at this point in the history
…n base_path
  • Loading branch information
OmegaLambda1998 committed Feb 27, 2024
1 parent 3b2e058 commit 651920a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pippin/snana_sim.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import os, sys
import shutil
import subprocess
import tempfile
Expand All @@ -8,6 +8,8 @@
from pippin.config import chown_dir, copytree, mkdirs, get_data_loc, get_hash, read_yaml, get_config
from pippin.task import Task

sys.path.insert(1, os.path.expandvars("$SNANA_DIR/util/submit_batch"))
import submit_util as util

class SNANASimulation(ConfigBasedExecutable):
""" Merge fitres files and aggregator output
Expand Down Expand Up @@ -108,9 +110,19 @@ def __init__(self, name, output_dir, config, global_config, combine="combine.inp
genmodel = genmodel or d.get("GENMODEL")

if not gentype:
Task.fail_config(f"Cannot find GENTYPE for component {k} and base file {base_path}")
gentype_sublist = util.get_simInput_key_values(base_path, ['GENTYPE'])
self.logger.debug(f"gentype_sublist: {gentype_sublist}")
if len(gentype_sublist) == 0:
Task.fail_config(f"Cannot find GENTYPE for component {k} and base file {base_path}, or any included files")
else:
gentype = gentype_sublist[0]
if not genmodel:
Task.fail_config(f"Cannot find GENMODEL for component {k} and base file {base_path}")
genmodel_sublist = util.get_simInput_key_values(base_path, ['GENMODEL'])["GENMODEL"]
self.logger.debug(f"genmodel_sublist: {genmodel_sublist}")
if len(genmodel_sublist) == 0:
Task.fail_config(f"Cannot find GENMODEL for component {k} and base file {base_path}, or any included files")
else:
genmodel = genmodel_sublist[0]

type2 = 100 + gentype
if "SALT" in genmodel:
Expand Down

0 comments on commit 651920a

Please sign in to comment.