toughanimator 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: toughanimator
3
+ Version: 0.1.2
4
+ Summary: A tool for visualizing TOUGH simulation outputs.
5
+ Home-page: https://github.com/scarletref/toughanimator
6
+ Author: Your Name
7
+ Author-email: your.email@example.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: numpy
14
+ Requires-Dist: pandas
15
+ Requires-Dist: vtk
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: requires-dist
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+ # ToughAnimator
27
+
28
+ ## Installation
29
+
30
+ 1. **Clone the Repository**:
31
+
32
+ ```bash
33
+ git clone https://stride-c.synology.me:50000/ytkuof/toughanimator.git
34
+ cd toughanimator
35
+ ```
36
+
37
+ 2. **Create a Python Virtual Environment**:
38
+
39
+ ```bash
40
+ python -m venv .env
41
+ ```
42
+
43
+ 3. **Activate the Virtual Environment**:
44
+
45
+ - **Windows**:
46
+ ```bash
47
+ .env\Scripts\activate.bat
48
+ ```
49
+ - **Linux/Mac**:
50
+ ```bash
51
+ source .env/bin/activate
52
+ ```
53
+
54
+ 4. **Install Dependencies**:
55
+
56
+ ```bash
57
+ pip install -r requirements.txt
58
+ ```
59
+
60
+ 5. **Install ToughAnimator Locally**:
61
+
62
+ ```bash
63
+ pip install .
64
+ ```
65
+
66
+ This will install ToughAnimator in your Python virtual environment.
67
+
68
+ ## Run Your Own Case with ToughAnimator
69
+
70
+ 1. **Create a New Case**:
71
+
72
+ - Create a new folder under `unresolve`. Name the folder according to your case (e.g., `unresolve/your_case_name`).
73
+ - Copy all necessary TOUGH result files into the new folder.
74
+ - Copy the `config.json` file from an existing case in the `test_cases` directory or create a new `config.json` file in the new folder. The file should have the following structure:
75
+
76
+ ```json
77
+ {
78
+ "case_name": "your_case_name",
79
+ "input_files": [
80
+ "name_of_your_input_file (e.g., flow.inp)",
81
+ "MESH", // For a separate mesh file, if applicable
82
+ "INCON" // For a separate INCON file, if applicable
83
+ ],
84
+ "output_files": [
85
+ "name_of_your_output_file (e.g., conn.csv)",
86
+ "name_of_another_output_file (e.g., mesh.csv)",
87
+ "name_of_other_output_file (add or remove as needed)"
88
+ ],
89
+ "corners_file": "name_of_your_corners_file (e.g., corners.csv)",
90
+ "nas_path": "path/to/nas",
91
+ "notes": "Any additional notes"
92
+ }
93
+ ```
94
+
95
+ - The `config.json` file should contain these fields:
96
+ - **case_name**: The name of your case.
97
+ - **input_files**: A list of TOUGH input files (e.g., `flow.inp`). You can include multiple input files, but they must contain the `INCON`, `ELEME`, and `CONNE` blocks.
98
+ - **output_files**: A list of output files (e.g., `conn.csv`, `mesh.csv`). Only CSV format files are currently supported.
99
+ - **corners_file**: The name of the corners file (e.g., `corners.csv`). This field is optional and can be omitted if not applicable.
100
+ - To obtain the corners file, open the **3D Results** in your PetraSim project, select **Export Data** from the **File** menu, and on the right side of the file-saving window, set the **Interpolation type** to **Interpolate to cell corners**. Save the file as CSV.
101
+
102
+ ![Exporting corners file from PetraSim](../figures/export_results_data.png)
103
+
104
+ - **nas_path**: The path to the NAS (Network Attached Storage) location where the case files are stored. This field is optional.
105
+ - **notes**: Any additional notes or comments about the case. This field is optional.
106
+
107
+ 2. **Run the Script**:
108
+
109
+ - Ensure the virtual environment is activated.
110
+ - Open `toughanimator/run.py` in VS Code and select **Run Without Debugging** (Ctrl+F5) or run the script from the command line:
111
+
112
+ ```bash
113
+ python run.py
114
+ ```
115
+
116
+ ## Run an Existing Case with ToughAnimator
117
+
118
+ 1. **Set Name and Directory**:
119
+
120
+ - Open `toughanimator/run.py`.
121
+ - Modify the `dir_name` and `case_name` variables to match your case directory and name.
122
+
123
+ 2. **Run the Script**:
124
+
125
+ - Ensure the virtual environment is activated.
126
+ - Open `toughanimator/run.py` in VS Code and select **Run Without Debugging** (Ctrl+F5) or run the script from the command line:
127
+
128
+ ```bash
129
+ python run.py
130
+ ```
131
+
132
+ ## Acknowledgments
133
+
134
+ Special thanks to the TOUGH3 development team for their outstanding work on the TOUGH suite of tools.
135
+
@@ -0,0 +1,110 @@
1
+ # ToughAnimator
2
+
3
+ ## Installation
4
+
5
+ 1. **Clone the Repository**:
6
+
7
+ ```bash
8
+ git clone https://stride-c.synology.me:50000/ytkuof/toughanimator.git
9
+ cd toughanimator
10
+ ```
11
+
12
+ 2. **Create a Python Virtual Environment**:
13
+
14
+ ```bash
15
+ python -m venv .env
16
+ ```
17
+
18
+ 3. **Activate the Virtual Environment**:
19
+
20
+ - **Windows**:
21
+ ```bash
22
+ .env\Scripts\activate.bat
23
+ ```
24
+ - **Linux/Mac**:
25
+ ```bash
26
+ source .env/bin/activate
27
+ ```
28
+
29
+ 4. **Install Dependencies**:
30
+
31
+ ```bash
32
+ pip install -r requirements.txt
33
+ ```
34
+
35
+ 5. **Install ToughAnimator Locally**:
36
+
37
+ ```bash
38
+ pip install .
39
+ ```
40
+
41
+ This will install ToughAnimator in your Python virtual environment.
42
+
43
+ ## Run Your Own Case with ToughAnimator
44
+
45
+ 1. **Create a New Case**:
46
+
47
+ - Create a new folder under `unresolve`. Name the folder according to your case (e.g., `unresolve/your_case_name`).
48
+ - Copy all necessary TOUGH result files into the new folder.
49
+ - Copy the `config.json` file from an existing case in the `test_cases` directory or create a new `config.json` file in the new folder. The file should have the following structure:
50
+
51
+ ```json
52
+ {
53
+ "case_name": "your_case_name",
54
+ "input_files": [
55
+ "name_of_your_input_file (e.g., flow.inp)",
56
+ "MESH", // For a separate mesh file, if applicable
57
+ "INCON" // For a separate INCON file, if applicable
58
+ ],
59
+ "output_files": [
60
+ "name_of_your_output_file (e.g., conn.csv)",
61
+ "name_of_another_output_file (e.g., mesh.csv)",
62
+ "name_of_other_output_file (add or remove as needed)"
63
+ ],
64
+ "corners_file": "name_of_your_corners_file (e.g., corners.csv)",
65
+ "nas_path": "path/to/nas",
66
+ "notes": "Any additional notes"
67
+ }
68
+ ```
69
+
70
+ - The `config.json` file should contain these fields:
71
+ - **case_name**: The name of your case.
72
+ - **input_files**: A list of TOUGH input files (e.g., `flow.inp`). You can include multiple input files, but they must contain the `INCON`, `ELEME`, and `CONNE` blocks.
73
+ - **output_files**: A list of output files (e.g., `conn.csv`, `mesh.csv`). Only CSV format files are currently supported.
74
+ - **corners_file**: The name of the corners file (e.g., `corners.csv`). This field is optional and can be omitted if not applicable.
75
+ - To obtain the corners file, open the **3D Results** in your PetraSim project, select **Export Data** from the **File** menu, and on the right side of the file-saving window, set the **Interpolation type** to **Interpolate to cell corners**. Save the file as CSV.
76
+
77
+ ![Exporting corners file from PetraSim](../figures/export_results_data.png)
78
+
79
+ - **nas_path**: The path to the NAS (Network Attached Storage) location where the case files are stored. This field is optional.
80
+ - **notes**: Any additional notes or comments about the case. This field is optional.
81
+
82
+ 2. **Run the Script**:
83
+
84
+ - Ensure the virtual environment is activated.
85
+ - Open `toughanimator/run.py` in VS Code and select **Run Without Debugging** (Ctrl+F5) or run the script from the command line:
86
+
87
+ ```bash
88
+ python run.py
89
+ ```
90
+
91
+ ## Run an Existing Case with ToughAnimator
92
+
93
+ 1. **Set Name and Directory**:
94
+
95
+ - Open `toughanimator/run.py`.
96
+ - Modify the `dir_name` and `case_name` variables to match your case directory and name.
97
+
98
+ 2. **Run the Script**:
99
+
100
+ - Ensure the virtual environment is activated.
101
+ - Open `toughanimator/run.py` in VS Code and select **Run Without Debugging** (Ctrl+F5) or run the script from the command line:
102
+
103
+ ```bash
104
+ python run.py
105
+ ```
106
+
107
+ ## Acknowledgments
108
+
109
+ Special thanks to the TOUGH3 development team for their outstanding work on the TOUGH suite of tools.
110
+
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,25 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name='toughanimator', # Package name on PyPI
5
+ version='0.1.2',
6
+ description='A tool for visualizing TOUGH simulation outputs.',
7
+ long_description=open('README.md').read(),
8
+ long_description_content_type='text/markdown',
9
+ author='Your Name',
10
+ author_email='your.email@example.com',
11
+ url='https://github.com/scarletref/toughanimator',
12
+ packages=find_packages(),
13
+ include_package_data=True,
14
+ install_requires=[
15
+ 'numpy',
16
+ 'pandas',
17
+ 'vtk',
18
+ ],
19
+ python_requires='>=3.7',
20
+ classifiers=[
21
+ 'Programming Language :: Python :: 3',
22
+ 'License :: OSI Approved :: MIT License',
23
+ 'Operating System :: OS Independent',
24
+ ],
25
+ )
@@ -0,0 +1,61 @@
1
+ import os
2
+ import json
3
+ import pytest
4
+ #from toughanimator.tough_classes import VisSetting, vis_reader
5
+ import logging
6
+ import toughanimator as ta
7
+ import shutil
8
+
9
+ logging.basicConfig(level=logging.DEBUG)
10
+
11
+ # Directory containing all test cases
12
+ parent_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
13
+ TEST_CASES_DIRS = [
14
+ #os.path.join(parent_path, "test_cases"),
15
+ os.path.join(parent_path, "unresolved"),
16
+ ]
17
+
18
+
19
+ def discover_test_cases():
20
+ """
21
+ Discover all test cases and load configurations.
22
+ Each test case must have a config.json file.
23
+ """
24
+ logging.debug("This is a debug log")
25
+ cases = []
26
+ for test_cases_dir in TEST_CASES_DIRS:
27
+ logging.debug(f"cases_dir: {test_cases_dir}")
28
+ if os.path.exists(test_cases_dir):
29
+ for case_name in os.listdir(test_cases_dir):
30
+ logging.debug(f"case_name: {case_name}")
31
+ case_dir = os.path.join(test_cases_dir, case_name)
32
+ cases.append((case_name, case_dir))
33
+ return cases
34
+
35
+
36
+ @pytest.mark.parametrize("case_name, case_dir", discover_test_cases())
37
+ def test_toughanimator_case(case_name, case_dir):
38
+ """
39
+ Test each case using its configuration file.
40
+ """
41
+ print(f"Running test for case: {case_name}")
42
+
43
+
44
+
45
+ try:
46
+ # Execute the process
47
+ reader = ta.vis_reader(case_dir)
48
+ #reader.write_geometry()
49
+ #reader.write_incon()
50
+ #reader.write_result()
51
+ reader.write_all()
52
+ vis_path = os.path.join(case_dir, "tough_vis")
53
+ # delete the directory if it exists
54
+ if os.path.isdir(vis_path):
55
+ shutil.rmtree(vis_path)
56
+
57
+
58
+
59
+ assert True # If no exceptions, the test passes
60
+ except Exception as e:
61
+ pytest.fail(f"Test failed for case {case_name}: {e}")
@@ -0,0 +1 @@
1
+ from .tough_classes import *
@@ -0,0 +1,23 @@
1
+ import os
2
+ import tough_classes as ta
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+
6
+ dir_name = "unresolved" #"test_cases
7
+ case_name = "3D five spot MINC"
8
+ test_case_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), dir_name)
9
+
10
+ case_dir = os.path.join(test_case_dir, case_name)
11
+ #case_dir = r"D:\Projects\202506\cake"
12
+
13
+ #case_dir = r"D:\Projects\202504\polygonal\poly_test"
14
+ #case_dir = r"D:\Projects\202501\toughanimator\test_cases\P5_eco2n_1D-radial"
15
+ reader = ta.vis_reader(case_dir)
16
+ #reader.write_eleme_conne()
17
+ #reader.write_geometry()
18
+ #reader.write_incon()
19
+ #reader.write_result()
20
+ #reader.
21
+ reader.write_all()
22
+
23
+