Skip to content

Commit a03a807

Browse files
committed
Merge remote-tracking branch 'origin/main' into dafni-dev
# Conflicts: # dafni/src/main_dafni.py
2 parents 3cd85ae + 1cdfb78 commit a03a807

File tree

90 files changed

+2709
-5538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2709
-5538
lines changed

.github/workflows/ci-tests-drafts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: |
3131
pytest --cov=causal_testing --cov-report=xml
3232
- name: "Upload coverage to Codecov"
33-
uses: codecov/codecov-action@v2
33+
uses: codecov/codecov-action@v5
3434
with:
3535
fail_ci_if_error: true
3636
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ci-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: |
3737
pytest --cov=causal_testing --cov-report=xml
3838
- name: "Upload coverage to Codecov"
39-
uses: codecov/codecov-action@v2
39+
uses: codecov/codecov-action@v5
4040
with:
4141
fail_ci_if_error: true
4242
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/joss.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: JOSS article compilation
2+
on:
3+
push:
4+
paths:
5+
- paper/**
6+
- images/schematic.png
7+
- .github/workflows/draft-pdf.yml
8+
9+
jobs:
10+
paper:
11+
runs-on: ubuntu-latest
12+
name: Paper Draft
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build draft PDF
17+
uses: openjournals/openjournals-draft-action@master
18+
with:
19+
journal: joss
20+
# This should be the path to the paper within your repo.
21+
paper-path: paper/paper.md
22+
- name: Upload
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: paper
26+
# This is the output path where Pandoc will write the compiled
27+
# PDF. Note, this should be the same directory as the input
28+
# paper.md
29+
path: paper/paper.pdf

.github/workflows/lint-format.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Archive production artifacts
2727
if: ${{ success() }} || ${{ failure() }}
28-
uses: actions/upload-artifact@v3
28+
uses: actions/upload-artifact@v4
2929
with:
3030
name: MegaLinter reports
3131
path: |

README.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,46 @@ pip install . # For core API only
5252
pip install -e . # For editable install, useful for development work
5353
```
5454
For more information on how to use the Causal Testing Framework, please refer to our [documentation](https://causal-testing-framework.readthedocs.io/en/latest/?badge=latest).
55+
56+
>[!NOTE]
57+
>We recommend you use a 64 bit OS (standard in most modern machines) as we have had reports of the installation crashing on some 32 bit Debian installations.
58+
59+
## Usage
60+
>[!NOTE]
61+
> Example usage can be found in the `examples` directory.
62+
63+
1. To run the causal testing framework, you need some runtime data from your system, some causal test cases, and a causal DAG that specifies the expected causal relationships between the variables in your runtime data (and any other relevant variables that are _not_ recorded in the data but are known to be relevant).
64+
65+
2. If you do not already have causal test cases, you can convert your causal DAG to causal tests by running the following command.
66+
67+
```
68+
python causal_testing/testing/metamorphic_relation.py --dag_path $PATH_TO_DAG --output_path $PATH_TO_TESTS
69+
```
70+
71+
3. You can now execute your tests by running the following command.
72+
```
73+
python -m causal_testing --dag_path $PATH_TO_DAG --data_paths $PATH_TO_DATA --test_config $PATH_TO_TESTS --output $OUTPUT
74+
```
75+
The results will be saved for inspection in a JSON file located at `$OUTPUT`.
76+
In the future, we hope to add a visualisation tool to assist with this.
77+
5578
## How to Cite
5679
If you use our framework in your work, please cite the following:
5780

58-
``This research has used version X.Y.Z (software citation) of the
81+
``This research has used version X.Y.Z (software citation) of the
5982
Causal Testing Framework (paper citation).``
6083

61-
The paper citation should be the Causal Testing Framework [paper](https://dl.acm.org/doi/10.1145/3607184),
84+
The paper citation should be the Causal Testing Framework [paper](https://dl.acm.org/doi/10.1145/3607184),
6285
and the software citation should contain the specific Figshare [DOI](https://orda.shef.ac.uk/articles/software/CITCOM_Software_Release/24427516) of the version used in your work.
6386

6487

6588

6689
<details>
6790
<summary><b>BibTeX Citations</b></summary>
68-
91+
6992
<details>
7093
<summary>Paper</summary>
71-
94+
7295
```
7396
@ARTICLE{Clark_etal_2023,
7497
author = {Clark, Andrew G. and Foster, Michael and Prifling, Benedikt and Walkinshaw, Neil and Hierons, Robert M.
@@ -85,10 +108,10 @@ and the software citation should contain the specific Figshare [DOI](https://ord
85108
```
86109

87110
</details>
88-
111+
89112
<details>
90113
<summary>Software (example)</summary>
91-
114+
92115
```
93116
@ARTICLE{Wild2023,
94117
author = {Foster, Michael and Clark, Andrew G. and Somers, Richard and Wild, Christopher and Allian, Farhad and Hierons, Robert M. and Wagg, David and Walkinshaw, Neil},
@@ -110,15 +133,15 @@ To contribute to our work, please ensure the following:
110133
1. [Fork the repository](https://help.github.com/articles/fork-a-repo/) into your own GitHub account, and [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it to your local machine.
111134
2. [Create a new branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository) in your forked repository. Give this branch an appropriate name, and create commits that describe the changes.
112135
3. [Push your changes](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository) to your new branch in your remote fork, compare with `CausalTestingFramework/main`, and ensure any conflicts are resolved.
113-
4. Create a draft [pull request](https://docs.github.com/en/get-started/quickstart/hello-world#opening-a-pull-request) from your branch, and ensure you have [linked](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls) it to any relevant issues in your description.
136+
4. Create a draft [pull request](https://docs.github.com/en/get-started/quickstart/hello-world#opening-a-pull-request) from your branch, and ensure you have [linked](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls) it to any relevant issues in your description.
114137

115138
We use the [unittest]() module to develop our tests and the [pytest](https://pytest.org/en/latest/) framework as our test discovery, [pylint](https://pypi.org/project/pylint/) for our code analyser, and [black](https://pypi.org/project/black/) for our code formatting.
116139
To find the other (optional) developer dependencies, please check `pyproject.toml`.
117140

118141

119142

120-
## Acknowledgements
143+
## Acknowledgements
121144

122145
The Causal Testing Framework is supported by the UK's Engineering and Physical Sciences Research Council (EPSRC),
123-
with the project name [CITCOM](https://gow.epsrc.ukri.org/NGBOViewGrant.aspx?GrantRef=EP/T030526/1) - "_Causal Inference for Testing of Computational Models_"
146+
with the project name [CITCOM](https://gow.epsrc.ukri.org/NGBOViewGrant.aspx?GrantRef=EP/T030526/1) - "_Causal Inference for Testing of Computational Models_"
124147
under the grant EP/T030526/1.

causal_testing/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""
22
This is the CausalTestingFramework Module
33
It contains 5 subpackages:
4-
data_collection
5-
generation
6-
json_front
4+
estimation
75
specification
6+
surrogate
87
testing
8+
utils
99
"""
1010

1111
import logging

causal_testing/__main__.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""This module contains the main entrypoint functionality to the Causal Testing Framework."""
2+
3+
import logging
4+
from .main import setup_logging, parse_args, CausalTestingPaths, CausalTestingFramework
5+
6+
7+
def main() -> None:
8+
"""
9+
10+
Main entry point for the Causal Testing Framework
11+
12+
"""
13+
14+
# Parse arguments
15+
args = parse_args()
16+
17+
# Setup logging
18+
setup_logging(args.verbose)
19+
20+
# Create paths object
21+
paths = CausalTestingPaths(
22+
dag_path=args.dag_path,
23+
data_paths=args.data_paths,
24+
test_config_path=args.test_config,
25+
output_path=args.output,
26+
)
27+
28+
# Create and setup framework
29+
framework = CausalTestingFramework(paths, ignore_cycles=args.ignore_cycles, query=args.query)
30+
framework.setup()
31+
32+
# Load and run tests
33+
framework.load_tests()
34+
35+
if args.batch_size > 0:
36+
logging.info(f"Running tests in batches of size {args.batch_size}")
37+
results = framework.run_tests_in_batches(batch_size=args.batch_size, silent=args.silent)
38+
else:
39+
logging.info("Running tests in regular mode")
40+
results = framework.run_tests(silent=args.silent)
41+
42+
# Save results
43+
framework.save_results(results)
44+
45+
logging.info("Causal testing completed successfully.")
46+
47+
48+
if __name__ == "__main__":
49+
main()

causal_testing/data_collection/__init__.py

Whitespace-only changes.

causal_testing/data_collection/data_collector.py

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)