|
10 | 10 | from causal_testing.testing.estimators import Estimator
|
11 | 11 | from causal_testing.specification.scenario import Scenario
|
12 | 12 | from causal_testing.specification.variable import Input, Output, Meta
|
13 |
| - |
| 13 | +import logging |
14 | 14 | data_path = "data.csv"
|
15 | 15 | dag_path = "dag.dot"
|
16 | 16 | json_path = "causal_tests.json"
|
@@ -105,11 +105,19 @@ def get_args() -> argparse.Namespace:
|
105 | 105 | """
|
106 | 106 | parser = argparse.ArgumentParser(
|
107 | 107 | description="A script for parsing json config files for the Causal Testing Framework")
|
108 |
| - parser.add_argument("-f", help="if included, the script will stop if a test fails", |
109 |
| - action="store_true") |
| 108 | + parser.add_argument( |
| 109 | + "-f", help="if included, the script will stop if a test fails", action="store_true") |
| 110 | + parser.add_argument( |
| 111 | + "--log_path", help="Specify a directory to change the location of the log file", default="./") |
110 | 112 | return parser.parse_args()
|
111 | 113 |
|
112 | 114 |
|
| 115 | +def logger_setup(): |
| 116 | + logger = logging.getLogger(__name__) |
| 117 | + fh = logging.FileHandler() |
| 118 | + logger.addHandler(fh) |
| 119 | + |
| 120 | + |
113 | 121 | inputs = [
|
114 | 122 | {"name": "width", "type": float, "distribution": "uniform"},
|
115 | 123 | {"name": "height", "type": float, "distribution": "uniform"},
|
@@ -188,7 +196,7 @@ def add_modelling_assumptions(self, estimation_model: Estimator):
|
188 | 196 | if __name__ == "__main__":
|
189 | 197 | args = get_args()
|
190 | 198 |
|
191 |
| - json_utility = MyJsonUtility() # Create an instance of the extended JsonUtility class |
| 199 | + json_utility = MyJsonUtility(args.log_path) # Create an instance of the extended JsonUtility class |
192 | 200 | json_utility.set_path(json_path, dag_path, data_path) # Set the path to the data.csv, dag.dot and causal_tests.json file
|
193 | 201 |
|
194 | 202 | # Load the Causal Variables into the JsonUtility class ready to be used in the tests
|
|
0 commit comments