Skip to content

Commit

Permalink
Merge pull request #124 from dessn/#107
Browse files Browse the repository at this point in the history
Moved CreateCov over to submit_batch
  • Loading branch information
OmegaLambda1998 authored Jan 8, 2023
2 parents 52c7c53 + a75ab2b commit f0379d4
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 461 deletions.
2 changes: 1 addition & 1 deletion pippin/cosmofitters/cosmomc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, name, output_dir, config, options, global_config, dependencie
self.path_to_cosmomc = get_output_loc(self.global_config["CosmoMC"]["location"])

self.create_cov_dep = self.get_dep(CreateCov)
self.blind = self.create_cov_dep.output["blind"] if self.create_cov_dep is not None else self.options.get("BLIND", False)
self.blind = np.all(self.create_cov_dep.output["blind"]) if self.create_cov_dep is not None else self.options.get("BLIND", False)
assert isinstance(self.blind, (bool, np.bool_)), "Blind should be set to a boolan value!"
self.ini_prefix = options.get("INI").replace(".ini", "")
self.static = self.ini_prefix.replace(".ini", "") in ["cmb_omw", "cmb_omol"]
Expand Down
3 changes: 1 addition & 2 deletions pippin/cosmofitters/wfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from pippin.config import mkdirs, get_output_loc, get_data_loc, chown_dir, read_yaml
from pippin.create_cov import CreateCov
from pippin.sb_create_cov import SBCreateCov
from pippin.cosmofitters.cosmofit import CosmoFit
from pippin.base import ConfigBasedExecutable
from pippin.task import Task
Expand Down Expand Up @@ -94,7 +93,7 @@ def _run(self):
@staticmethod
def get_tasks(c, prior_tasks, base_output_dir, stage_number, prefix, global_config):

create_cov_tasks = Task.get_task_of_type(prior_tasks, CreateCov) + Task.get_task_of_type(prior_tasks, SBCreateCov)
create_cov_tasks = Task.get_task_of_type(prior_tasks, CreateCov)

def _get_wfit_dir(base_output_dir, stage_number, name):
return f"{base_output_dir}/{stage_number}_COSMOFIT/WFIT/{name}"
Expand Down
319 changes: 161 additions & 158 deletions pippin/create_cov.py

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions pippin/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from pippin.config import get_logger, get_config, get_output_dir, mkdirs, chown_dir, chown_file, get_data_loc
from pippin.cosmofitters.cosmofit import CosmoFit
from pippin.create_cov import CreateCov
from pippin.sb_create_cov import SBCreateCov
from pippin.dataprep import DataPrep
from pippin.merge import Merger
from pippin.snana_fit import SNANALightCurveFit
Expand All @@ -26,13 +25,6 @@ class Manager:
def __init__(self, filename, config_path, config_raw, config, message_store):
self.logger = get_logger()
self.task_index = {t: i for i, t in enumerate(self.task_order)}
debug1 = config["DEBUG1"]
if debug1:
self.logger.warning("DEBUG1 enabled, replacing CREATE_COV with SB_CREATE_COV")
self.task_index[SBCreateCov] = self.task_index.pop(CreateCov)
ind = self.task_index[SBCreateCov]
Manager.task_order[ind] = SBCreateCov
Manager.stages[ind] = "SB_CREATE_COV"
self.message_store = message_store
self.filename = filename
self.filename_path = config_path
Expand Down
285 changes: 0 additions & 285 deletions pippin/sb_create_cov.py

This file was deleted.

5 changes: 0 additions & 5 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ def run(args):

logging.info(f"Running on: {os.environ.get('HOSTNAME', '$HOSTNAME not set')} login node.")

if args.debug1:
logging.warning("DEBUG1 enabled, this is still experimental. Please let Patrick know if anything goes wrong!")
config["DEBUG1"] = args.debug1

manager = Manager(config_filename, yaml_path, config_raw, config, message_store)

# Gracefully hand Ctrl-c
Expand Down Expand Up @@ -241,7 +237,6 @@ def get_args(test=False):
parser.add_argument("-p", "--permission", help="Fix permissions and groups on all output, don't rerun", action="store_true", default=False)
parser.add_argument("-i", "--ignore", help="Dont rerun tasks with this stage or less. Accepts either the stage number of name (i.e. 1 or SIM)", default=None)
parser.add_argument("-S", "--syntax", help="Get the syntax of the given stage. Accepts either the stage number or name (i.e. 1 or SIM). If run without argument, will tell you all stage numbers / names.", default=None, const="options", type=str, nargs='?')
parser.add_argument("--debug1", help="Enable debug option 1: Move CREATE_COV over to submit_batch", action="store_true", default=False)
command_group = parser.add_mutually_exclusive_group()
command_group.add_argument("-C", "--compress", help="Compress pippin output during job. Combine with -c / --check in order to compress completed pippin job.", action="store_true", default=False)
command_group.add_argument("-U", "--uncompress", help="Do not compress pippin output during job. Combine with -c / --check in order to uncompress completed pippin job. Mutually exclusive with -C / --compress", action="store_true", default=False)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_valid_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_createcov_config_valid():
assert isinstance(tasks[-1], CreateCov)

task = tasks[-1]
assert task.output["name"] == "COVTEST_BCOR"
assert task.output["name"] == "COVTEST"
assert len(task.output["covopts"]) == 2
assert "ALL" in task.output["covopts"]
assert "NOSYS" in task.output["covopts"]
Expand All @@ -215,7 +215,7 @@ def test_cosmomc_config_valid():
assert isinstance(tasks[-1], CosmoMC)

task = tasks[-1]
assert task.output["name"] == "COSMOMC_SN_OMW_COVTEST_BCOR"
assert task.output["name"] == "COSMOMC_SN_OMW_COVTEST"
assert len(task.output["covopts"]) == 2
assert "ALL" in task.output["covopts"]
assert "NOSYS" in task.output["covopts"]
Expand Down

0 comments on commit f0379d4

Please sign in to comment.