From 8543da9ce9ba2ed0463a20b9f1adaf272dbf9298 Mon Sep 17 00:00:00 2001 From: jdebacker Date: Mon, 5 Nov 2018 23:15:25 -0500 Subject: [PATCH] latest reg tests --- regression/run_reg_reforms.py | 27 ++++++++++++++------------- regression/test_regression.py | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/regression/run_reg_reforms.py b/regression/run_reg_reforms.py index 1227ab1e4..5df4baaa9 100644 --- a/regression/run_reg_reforms.py +++ b/regression/run_reg_reforms.py @@ -112,14 +112,15 @@ def run_micro_macro(user_params, reform=None, baseline_dir=BASELINE_DIR, ------------------------------------------------------------------------ ''' print('path exists', not os.path.exists(baseline_dir), ok_to_run_baseline) - if not os.path.exists(baseline_dir) and ok_to_run_baseline: + # if not os.path.exists(baseline_dir) and ok_to_run_baseline: + if ok_to_run_baseline: output_base = baseline_dir input_dir = baseline_dir kwargs={'output_base':baseline_dir, 'baseline_dir':baseline_dir, 'test':False, 'time_path':True, 'baseline':True, 'analytical_mtrs':False, 'age_specific':True, 'user_params':user_params,'guid':'baseline', - 'run_micro':True, 'small_open': False, 'budget_balance':False, + 'run_micro':False, 'small_open': False, 'budget_balance':False, 'baseline_spending':False, 'data': data} #p1 = Process(target=runner, kwargs=kwargs) #p1.start() @@ -143,21 +144,21 @@ def run_micro_macro(user_params, reform=None, baseline_dir=BASELINE_DIR, ans = postprocess.create_diff(baseline_dir=baseline_dir, policy_dir=reform_dir) - print "total time was ", (time.time() - start_time) - print 'Percentage changes in aggregates:', ans + print("total time was ", (time.time() - start_time)) + print('Percentage changes in aggregates:', ans) def run_reforms(ref_idxs=REF_IDXS, path_prefix="", cpu_count=CPU_COUNT, data=DATA): # make sure we have a baseline result before other reforms are run - # ok_to_run_baseline = True - # run_micro_macro({}, - # reforms[0], - # "./{0}OUTPUT_BASELINE".format(path_prefix), - # "./{0}OUTPUT_REFORM_{1}".format(path_prefix, 0), - # str(0), - # data, - # ok_to_run_baseline,) + ok_to_run_baseline = True + run_micro_macro({}, + reforms[0], + "./{0}OUTPUT_BASELINE".format(path_prefix), + "./{0}OUTPUT_REFORM_{1}".format(path_prefix, 0), + str(0), + data, + ok_to_run_baseline,) # run reforms in parallel pool = Pool(processes=cpu_count) # results = [] @@ -185,7 +186,7 @@ def run_reforms(ref_idxs=REF_IDXS, path_prefix="", cpu_count=CPU_COUNT, results = [] ok_to_run_baseline = False - for i in range(0, len(reforms)): + for i in range(1, len(reforms)): args = ({}, reforms[i], "./{0}OUTPUT_BASELINE".format(path_prefix), diff --git a/regression/test_regression.py b/regression/test_regression.py index 63a589804..7e4e4dc5c 100644 --- a/regression/test_regression.py +++ b/regression/test_regression.py @@ -11,7 +11,7 @@ REG_BASELINE = os.path.join(CURDIR, 'regression_results/REG_OUTPUT_BASELINE') REG_REFORM = os.path.join(CURDIR, 'regression_results/REG_OUTPUT_REFORM_{ref_idx}') # REF_IDXS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -REF_IDXS = [0, 1, 2] +REF_IDXS = [0, 1, 2, 3, 4, 5, 6, 7] BASELINE = os.path.join(CURDIR, 'OUTPUT_BASELINE') REFORM = os.path.join(CURDIR, 'OUTPUT_REFORM_{ref_idx}')