tranpy-ai 0.1.0__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.
Files changed (50) hide show
  1. tranpy_ai-0.1.0/MANIFEST.in +18 -0
  2. tranpy_ai-0.1.0/PKG-INFO +115 -0
  3. tranpy_ai-0.1.0/README.md +51 -0
  4. tranpy_ai-0.1.0/pyproject.toml +111 -0
  5. tranpy_ai-0.1.0/setup.cfg +4 -0
  6. tranpy_ai-0.1.0/src/tranpy/__init__.py +28 -0
  7. tranpy_ai-0.1.0/src/tranpy/data/__init__.py +14 -0
  8. tranpy_ai-0.1.0/src/tranpy/data/cache.py +183 -0
  9. tranpy_ai-0.1.0/src/tranpy/data/datasets/registry.json +52 -0
  10. tranpy_ai-0.1.0/src/tranpy/data/download.py +150 -0
  11. tranpy_ai-0.1.0/src/tranpy/data/models/registry.json +844 -0
  12. tranpy_ai-0.1.0/src/tranpy/datasets/__init__.py +23 -0
  13. tranpy_ai-0.1.0/src/tranpy/datasets/base.py +65 -0
  14. tranpy_ai-0.1.0/src/tranpy/datasets/loaders.py +268 -0
  15. tranpy_ai-0.1.0/src/tranpy/explainers/__init__.py +34 -0
  16. tranpy_ai-0.1.0/src/tranpy/explainers/base.py +65 -0
  17. tranpy_ai-0.1.0/src/tranpy/explainers/dalex.py +247 -0
  18. tranpy_ai-0.1.0/src/tranpy/explainers/lime.py +269 -0
  19. tranpy_ai-0.1.0/src/tranpy/explainers/shap.py +316 -0
  20. tranpy_ai-0.1.0/src/tranpy/models/__init__.py +92 -0
  21. tranpy_ai-0.1.0/src/tranpy/models/base.py +160 -0
  22. tranpy_ai-0.1.0/src/tranpy/models/classical.py +960 -0
  23. tranpy_ai-0.1.0/src/tranpy/models/ensemble.py +195 -0
  24. tranpy_ai-0.1.0/src/tranpy/models/neural.py +293 -0
  25. tranpy_ai-0.1.0/src/tranpy/models/pretrained.py +255 -0
  26. tranpy_ai-0.1.0/src/tranpy/simulation/__init__.py +119 -0
  27. tranpy_ai-0.1.0/src/tranpy/simulation/config.py +340 -0
  28. tranpy_ai-0.1.0/src/tranpy/simulation/dataset_generator.py +320 -0
  29. tranpy_ai-0.1.0/src/tranpy/simulation/events.py +371 -0
  30. tranpy_ai-0.1.0/src/tranpy/simulation/mock_engine.py +364 -0
  31. tranpy_ai-0.1.0/src/tranpy/simulation/model.py +358 -0
  32. tranpy_ai-0.1.0/src/tranpy/simulation/powerfactory_config.py +236 -0
  33. tranpy_ai-0.1.0/src/tranpy/simulation/results.py +287 -0
  34. tranpy_ai-0.1.0/src/tranpy/simulation/simulator.py +501 -0
  35. tranpy_ai-0.1.0/src/tranpy/utils/__init__.py +11 -0
  36. tranpy_ai-0.1.0/src/tranpy/utils/config.py +70 -0
  37. tranpy_ai-0.1.0/src/tranpy/utils/io.py +64 -0
  38. tranpy_ai-0.1.0/src/tranpy/utils/logging.py +144 -0
  39. tranpy_ai-0.1.0/src/tranpy_ai.egg-info/PKG-INFO +115 -0
  40. tranpy_ai-0.1.0/src/tranpy_ai.egg-info/SOURCES.txt +48 -0
  41. tranpy_ai-0.1.0/src/tranpy_ai.egg-info/dependency_links.txt +1 -0
  42. tranpy_ai-0.1.0/src/tranpy_ai.egg-info/requires.txt +46 -0
  43. tranpy_ai-0.1.0/src/tranpy_ai.egg-info/top_level.txt +1 -0
  44. tranpy_ai-0.1.0/tests/test_all_classifiers.py +175 -0
  45. tranpy_ai-0.1.0/tests/test_basic_functionality.py +178 -0
  46. tranpy_ai-0.1.0/tests/test_datasets.py +217 -0
  47. tranpy_ai-0.1.0/tests/test_explainers.py +298 -0
  48. tranpy_ai-0.1.0/tests/test_import.py +3 -0
  49. tranpy_ai-0.1.0/tests/test_models.py +301 -0
  50. tranpy_ai-0.1.0/tests/test_pretrained_models.py +261 -0
@@ -0,0 +1,18 @@
1
+ # Include important package files
2
+ include README.md
3
+ include LICENSE
4
+ include pyproject.toml
5
+
6
+ # Include data files
7
+ recursive-include src/tranpy/data/datasets *.json *.pickle
8
+ recursive-include src/tranpy/data/models *.json *.md
9
+
10
+ # Exclude pretrained models (download from Google Drive instead)
11
+ global-exclude src/tranpy/data/models/pretrained/*.pkl
12
+ prune src/tranpy/data/models/pretrained
13
+
14
+ # Exclude unnecessary files
15
+ global-exclude __pycache__
16
+ global-exclude *.py[co]
17
+ global-exclude .DS_Store
18
+ global-exclude *.so
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: tranpy-ai
3
+ Version: 0.1.0
4
+ Summary: Power System Transient Stability Analysis with Machine Learning and Explainability
5
+ Author-email: Mahmoud Draz <m-draz@tu-berlin.de>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/mahmouddraz/tranpy
8
+ Project-URL: Documentation, https://mahmouddraz.github.io/tranpy
9
+ Project-URL: Repository, https://github.com/mahmouddraz/tranpy
10
+ Project-URL: Issues, https://github.com/mahmouddraz/tranpy/issues
11
+ Project-URL: Changelog, https://github.com/mahmouddraz/tranpy/releases
12
+ Keywords: power-system,stability-analysis,machine-learning,explainability,transient-stability
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: numpy>=1.20.0
26
+ Requires-Dist: pandas>=1.3.0
27
+ Requires-Dist: scikit-learn>=1.0.0
28
+ Requires-Dist: pyyaml>=5.4.0
29
+ Requires-Dist: matplotlib>=3.4.0
30
+ Requires-Dist: requests>=2.25.0
31
+ Requires-Dist: gdown>=5.0.0
32
+ Requires-Dist: seaborn>=0.13.2
33
+ Provides-Extra: explainability
34
+ Requires-Dist: lime>=0.2.0; extra == "explainability"
35
+ Requires-Dist: shap>=0.40.0; extra == "explainability"
36
+ Requires-Dist: dalex>=1.4.0; extra == "explainability"
37
+ Provides-Extra: explainability-lite
38
+ Requires-Dist: lime>=0.2.0; extra == "explainability-lite"
39
+ Provides-Extra: neural
40
+ Requires-Dist: tensorflow>=2.8.0; extra == "neural"
41
+ Provides-Extra: boosting
42
+ Requires-Dist: xgboost>=1.5.0; extra == "boosting"
43
+ Requires-Dist: lightgbm>=3.3.0; extra == "boosting"
44
+ Provides-Extra: all
45
+ Requires-Dist: lime>=0.2.0; extra == "all"
46
+ Requires-Dist: shap>=0.40.0; extra == "all"
47
+ Requires-Dist: dalex>=1.4.0; extra == "all"
48
+ Requires-Dist: xgboost>=1.5.0; extra == "all"
49
+ Requires-Dist: lightgbm>=3.3.0; extra == "all"
50
+ Requires-Dist: tensorflow>=2.8.0; extra == "all"
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
53
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
54
+ Requires-Dist: jupyter>=1.0.0; extra == "dev"
55
+ Requires-Dist: ipykernel>=6.0.0; extra == "dev"
56
+ Requires-Dist: black>=22.0.0; extra == "dev"
57
+ Requires-Dist: isort>=5.10.0; extra == "dev"
58
+ Requires-Dist: nbconvert>=7.0.0; extra == "dev"
59
+ Provides-Extra: docs
60
+ Requires-Dist: sphinx>=5.0.0; extra == "docs"
61
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
62
+ Requires-Dist: sphinx-autodoc-typehints>=1.19.0; extra == "docs"
63
+ Requires-Dist: myst-parser>=0.18.0; extra == "docs"
64
+
65
+ # TranPy
66
+
67
+ Machine learning tool for power system transient stability analysis with a simple, sklearn-style API.
68
+
69
+ ## Quick Start
70
+
71
+ ```bash
72
+ pip install tranpy
73
+ ```
74
+
75
+ ```python
76
+ from tranpy.datasets import load_newengland
77
+ from tranpy.models import SVMClassifier
78
+
79
+ X_train, X_test, y_train, y_test = load_newengland(test_size=0.2, random_state=42)
80
+ model = SVMClassifier(kernel='rbf')
81
+ model.fit(X_train, y_train)
82
+
83
+ accuracy = model.score(X_test, y_test)
84
+ print(f"Accuracy: {accuracy:.4f}")
85
+
86
+ results = model.evaluate(X_test, y_test, verbose=True)
87
+ ```
88
+
89
+ ### XAI
90
+
91
+ ```python
92
+ from tranpy.explainers import SHAPExplainer
93
+
94
+ # Create explainer
95
+ explainer = SHAPExplainer(model, X_train, X_test)
96
+
97
+ # Generate global explanations
98
+ shap_values = explainer.explain_global()
99
+
100
+ # Visualize
101
+ explainer.plot_summary(save_path='shap_summary.png')
102
+
103
+ # Important features
104
+ top_features = explainer.get_top_features(n_features=10)
105
+ print(top_features)
106
+ ``
107
+
108
+ Check out the [examples/](examples/) directory for Jupyter notebooks:
109
+
110
+ - `01_load_dataset.ipynb`
111
+ - `02_train_models.ipynb`
112
+ - `03_explainability.ipynb`
113
+ - `04_generate_data.ipynb` - > Requires PowerFactory local installation
114
+
115
+
@@ -0,0 +1,51 @@
1
+ # TranPy
2
+
3
+ Machine learning tool for power system transient stability analysis with a simple, sklearn-style API.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ pip install tranpy
9
+ ```
10
+
11
+ ```python
12
+ from tranpy.datasets import load_newengland
13
+ from tranpy.models import SVMClassifier
14
+
15
+ X_train, X_test, y_train, y_test = load_newengland(test_size=0.2, random_state=42)
16
+ model = SVMClassifier(kernel='rbf')
17
+ model.fit(X_train, y_train)
18
+
19
+ accuracy = model.score(X_test, y_test)
20
+ print(f"Accuracy: {accuracy:.4f}")
21
+
22
+ results = model.evaluate(X_test, y_test, verbose=True)
23
+ ```
24
+
25
+ ### XAI
26
+
27
+ ```python
28
+ from tranpy.explainers import SHAPExplainer
29
+
30
+ # Create explainer
31
+ explainer = SHAPExplainer(model, X_train, X_test)
32
+
33
+ # Generate global explanations
34
+ shap_values = explainer.explain_global()
35
+
36
+ # Visualize
37
+ explainer.plot_summary(save_path='shap_summary.png')
38
+
39
+ # Important features
40
+ top_features = explainer.get_top_features(n_features=10)
41
+ print(top_features)
42
+ ``
43
+
44
+ Check out the [examples/](examples/) directory for Jupyter notebooks:
45
+
46
+ - `01_load_dataset.ipynb`
47
+ - `02_train_models.ipynb`
48
+ - `03_explainability.ipynb`
49
+ - `04_generate_data.ipynb` - > Requires PowerFactory local installation
50
+
51
+
@@ -0,0 +1,111 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tranpy-ai"
7
+ version = "0.1.0"
8
+ description = "Power System Transient Stability Analysis with Machine Learning and Explainability"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ { name = "Mahmoud Draz", email = "m-draz@tu-berlin.de" }
13
+ ]
14
+ requires-python = ">=3.8"
15
+ dependencies = [
16
+ "numpy>=1.20.0",
17
+ "pandas>=1.3.0",
18
+ "scikit-learn>=1.0.0",
19
+ "pyyaml>=5.4.0",
20
+ "matplotlib>=3.4.0",
21
+ "requests>=2.25.0",
22
+ "gdown>=5.0.0",
23
+ "seaborn>=0.13.2",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 3 - Alpha",
27
+ "Intended Audience :: Science/Research",
28
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Programming Language :: Python :: 3",
31
+ "Programming Language :: Python :: 3.8",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ ]
37
+ keywords = ["power-system", "stability-analysis", "machine-learning", "explainability", "transient-stability"]
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/mahmouddraz/tranpy"
41
+ Documentation = "https://mahmouddraz.github.io/tranpy"
42
+ Repository = "https://github.com/mahmouddraz/tranpy"
43
+ Issues = "https://github.com/mahmouddraz/tranpy/issues"
44
+ Changelog = "https://github.com/mahmouddraz/tranpy/releases"
45
+
46
+ [project.optional-dependencies]
47
+ explainability = [
48
+ "lime>=0.2.0",
49
+ "shap>=0.40.0",
50
+ "dalex>=1.4.0",
51
+ ]
52
+ explainability-lite = [
53
+ "lime>=0.2.0"
54
+ ]
55
+ neural = [
56
+ "tensorflow>=2.8.0"
57
+ ]
58
+ boosting = [
59
+ "xgboost>=1.5.0",
60
+ "lightgbm>=3.3.0"
61
+ ]
62
+ all = [
63
+ "lime>=0.2.0",
64
+ "shap>=0.40.0",
65
+ "dalex>=1.4.0",
66
+ "xgboost>=1.5.0",
67
+ "lightgbm>=3.3.0",
68
+ "tensorflow>=2.8.0"
69
+ ]
70
+ dev = [
71
+ "pytest>=7.0.0",
72
+ "pytest-cov>=3.0.0",
73
+ "jupyter>=1.0.0",
74
+ "ipykernel>=6.0.0",
75
+ "black>=22.0.0",
76
+ "isort>=5.10.0",
77
+ "nbconvert>=7.0.0"
78
+ ]
79
+ docs = [
80
+ "sphinx>=5.0.0",
81
+ "sphinx-rtd-theme>=1.0.0",
82
+ "sphinx-autodoc-typehints>=1.19.0",
83
+ "myst-parser>=0.18.0"
84
+ ]
85
+
86
+ [tool.setuptools.packages.find]
87
+ where = ["src"]
88
+
89
+ [tool.setuptools.package-data]
90
+ tranpy = [
91
+ "data/datasets/*.pickle",
92
+ "data/datasets/registry.json",
93
+ "data/models/registry.json",
94
+ "data/models/README.md",
95
+ # Pretrained models excluded - download from Google Drive instead
96
+ # "data/models/pretrained/*.pkl"
97
+ ]
98
+
99
+ [tool.black]
100
+ line-length = 100
101
+ target-version = ['py38', 'py39', 'py310', 'py311']
102
+
103
+ [tool.isort]
104
+ profile = "black"
105
+ line_length = 100
106
+
107
+ [dependency-groups]
108
+ dev = [
109
+ "ipython>=8.12.3",
110
+ "nbconvert>=7.16.6",
111
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ """
2
+ TranPy: Power System Transient Stability Analysis
3
+
4
+ A modern Python library for power system stability prediction and explainability.
5
+
6
+ Example usage:
7
+ >>> from tranpy.datasets import load_newengland
8
+ >>> from tranpy.models import SVMClassifier
9
+ >>>
10
+ >>> # Load data
11
+ >>> X_train, X_test, y_train, y_test = load_newengland(test_size=0.2)
12
+ >>>
13
+ >>> # Train model
14
+ >>> model = SVMClassifier()
15
+ >>> model.fit(X_train, y_train)
16
+ >>>
17
+ >>> # Evaluate
18
+ >>> accuracy = model.score(X_test, y_test)
19
+ """
20
+
21
+ __version__ = "0.1.0"
22
+
23
+ # Import main modules
24
+ from . import datasets
25
+ from . import models
26
+ from . import explainers
27
+
28
+ __all__ = ['datasets', 'models', 'explainers', '__version__']
@@ -0,0 +1,14 @@
1
+ """
2
+ TranPy Data Management Module
3
+
4
+ Handles data and model storage, caching, and downloading.
5
+ """
6
+
7
+ from .download import download_from_google_drive
8
+ from .cache import get_cache_dir, clear_cache
9
+
10
+ __all__ = [
11
+ 'download_from_google_drive',
12
+ 'get_cache_dir',
13
+ 'clear_cache'
14
+ ]
@@ -0,0 +1,183 @@
1
+ """Cache management for TranPy."""
2
+
3
+ import json
4
+ import shutil
5
+ from pathlib import Path
6
+ from typing import Optional, Dict
7
+ from datetime import datetime
8
+
9
+ from ..utils.logging import get_logger
10
+
11
+ logger = get_logger(__name__)
12
+
13
+
14
+ def get_cache_dir() -> Path:
15
+ """
16
+ Get TranPy cache directory.
17
+
18
+ Returns:
19
+ Path to ~/.tranpy/ cache directory
20
+
21
+ Examples:
22
+ >>> from tranpy.data import get_cache_dir
23
+ >>> cache_dir = get_cache_dir()
24
+ >>> print(cache_dir)
25
+ /Users/username/.tranpy
26
+ """
27
+ cache_dir = Path.home() / '.tranpy'
28
+ cache_dir.mkdir(parents=True, exist_ok=True)
29
+ return cache_dir
30
+
31
+
32
+ def get_models_cache_dir() -> Path:
33
+ """Get directory for cached pretrained models."""
34
+ models_dir = get_cache_dir() / 'models'
35
+ models_dir.mkdir(parents=True, exist_ok=True)
36
+ return models_dir
37
+
38
+
39
+ def get_datasets_cache_dir() -> Path:
40
+ """Get directory for cached datasets."""
41
+ datasets_dir = get_cache_dir() / 'datasets'
42
+ datasets_dir.mkdir(parents=True, exist_ok=True)
43
+ return datasets_dir
44
+
45
+
46
+ def get_cache_info() -> Dict:
47
+ """
48
+ Get information about cached files.
49
+
50
+ Returns:
51
+ Dictionary with cache statistics
52
+
53
+ Examples:
54
+ >>> from tranpy.data import get_cache_info
55
+ >>> info = get_cache_info()
56
+ >>> print(f"Cache size: {info['total_size_mb']:.1f} MB")
57
+ """
58
+ cache_dir = get_cache_dir()
59
+
60
+ if not cache_dir.exists():
61
+ return {
62
+ 'cache_dir': str(cache_dir),
63
+ 'exists': False,
64
+ 'total_size_mb': 0,
65
+ 'num_models': 0,
66
+ 'num_datasets': 0
67
+ }
68
+
69
+ # Calculate total size
70
+ total_size = sum(
71
+ f.stat().st_size for f in cache_dir.rglob('*') if f.is_file()
72
+ )
73
+
74
+ # Count cached items
75
+ models_dir = cache_dir / 'models'
76
+ datasets_dir = cache_dir / 'datasets'
77
+
78
+ num_models = len(list(models_dir.glob('*.pkl'))) if models_dir.exists() else 0
79
+ num_datasets = len(list(datasets_dir.glob('*.pickle'))) if datasets_dir.exists() else 0
80
+
81
+ return {
82
+ 'cache_dir': str(cache_dir),
83
+ 'exists': True,
84
+ 'total_size_mb': total_size / (1024 * 1024),
85
+ 'num_models': num_models,
86
+ 'num_datasets': num_datasets,
87
+ 'models_dir': str(models_dir) if models_dir.exists() else None,
88
+ 'datasets_dir': str(datasets_dir) if datasets_dir.exists() else None
89
+ }
90
+
91
+
92
+ def clear_cache(confirm: bool = True) -> None:
93
+ """
94
+ Clear TranPy cache directory.
95
+
96
+ Args:
97
+ confirm: If True, ask for confirmation before clearing
98
+
99
+ Examples:
100
+ >>> from tranpy.data import clear_cache
101
+ >>> clear_cache() # Will ask for confirmation
102
+ >>> clear_cache(confirm=False) # Clear without asking
103
+ """
104
+ cache_dir = get_cache_dir()
105
+
106
+ if not cache_dir.exists():
107
+ logger.info(f"Cache directory does not exist: {cache_dir}")
108
+ return
109
+
110
+ # Get info before clearing
111
+ info = get_cache_info()
112
+
113
+ if confirm:
114
+ response = input(
115
+ f"Are you sure you want to clear the cache?\n"
116
+ f" Location: {cache_dir}\n"
117
+ f" Size: {info['total_size_mb']:.1f} MB\n"
118
+ f" Models: {info['num_models']}\n"
119
+ f" Datasets: {info['num_datasets']}\n"
120
+ f"Type 'yes' to confirm: "
121
+ )
122
+ if response.lower() != 'yes':
123
+ logger.info("Cache clear cancelled.")
124
+ return
125
+
126
+ # Clear cache
127
+ shutil.rmtree(cache_dir)
128
+ logger.info(f"Cache cleared: {cache_dir}")
129
+
130
+
131
+ def save_cache_metadata(model_id: str, metadata: Dict) -> None:
132
+ """
133
+ Save metadata for a cached model.
134
+
135
+ Args:
136
+ model_id: Model identifier
137
+ metadata: Metadata dictionary
138
+ """
139
+ cache_dir = get_cache_dir()
140
+ metadata_file = cache_dir / 'cache_metadata.json'
141
+
142
+ # Load existing metadata
143
+ if metadata_file.exists():
144
+ with open(metadata_file, 'r') as f:
145
+ all_metadata = json.load(f)
146
+ else:
147
+ all_metadata = {}
148
+
149
+ # Add new metadata
150
+ all_metadata[model_id] = {
151
+ **metadata,
152
+ 'cached_at': datetime.now().isoformat()
153
+ }
154
+
155
+ # Save
156
+ with open(metadata_file, 'w') as f:
157
+ json.dump(all_metadata, f, indent=2)
158
+
159
+
160
+ def get_cache_metadata(model_id: Optional[str] = None) -> Dict:
161
+ """
162
+ Get metadata for cached models.
163
+
164
+ Args:
165
+ model_id: If provided, get metadata for specific model.
166
+ Otherwise, get all metadata.
167
+
168
+ Returns:
169
+ Metadata dictionary
170
+ """
171
+ cache_dir = get_cache_dir()
172
+ metadata_file = cache_dir / 'cache_metadata.json'
173
+
174
+ if not metadata_file.exists():
175
+ return {} if model_id is None else None
176
+
177
+ with open(metadata_file, 'r') as f:
178
+ all_metadata = json.load(f)
179
+
180
+ if model_id:
181
+ return all_metadata.get(model_id)
182
+ else:
183
+ return all_metadata
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": "0.1.0",
3
+ "description": "TranPy Dataset Registry - Power System Stability Datasets",
4
+ "datasets": {
5
+ "NewEngland": {
6
+ "name": "New England 39-Bus System",
7
+ "description": "IEEE New England 39-bus test system for transient stability analysis. Contains voltage magnitudes and phase angles post-fault for stability prediction.",
8
+ "grid_type": "NewEngland",
9
+ "n_buses": 39,
10
+ "n_features": 78,
11
+ "feature_description": "39 voltage magnitudes (bus_X:u) + 39 phase angles (bus_X:phi)",
12
+ "size_mb": 8.9,
13
+ "format": "pickle",
14
+ "google_drive": {
15
+ "file_id": "1eXtw44VXhYM0jQyJGGY5Eevdrg8yui0w",
16
+ "direct_link": "https://drive.google.com/uc?export=download&id=1eXtw44VXhYM0jQyJGGY5Eevdrg8yui0w",
17
+ "view_link": "https://drive.google.com/file/d/1eXtw44VXhYM0jQyJGGY5Eevdrg8yui0w/view?usp=drive_link"
18
+ },
19
+ "filename": "NewEngland.pickle",
20
+ "bundled": true,
21
+ "local_path": "datasets/NewEngland.pickle",
22
+ "metadata": {
23
+ "system_type": "Transmission System",
24
+ "voltage_level": "High Voltage",
25
+ "typical_use": "Transient stability analysis, ML benchmarking"
26
+ }
27
+ },
28
+ "NineBusSystem": {
29
+ "name": "IEEE 9-Bus System",
30
+ "description": "IEEE 9-bus test system (also known as WSCC 9-bus system) for transient stability analysis. Standard benchmark for power system studies.",
31
+ "grid_type": "NineBusSystem",
32
+ "n_buses": 9,
33
+ "n_features": 18,
34
+ "feature_description": "9 voltage magnitudes (bus_X:u) + 9 phase angles (bus_X:phi)",
35
+ "size_mb": 2.1,
36
+ "format": "pickle",
37
+ "google_drive": {
38
+ "file_id": "1-4LrEqmDP6-EcLpL0-6tvzsNSSJOLzG1",
39
+ "direct_link": "https://drive.google.com/uc?export=download&id=1-4LrEqmDP6-EcLpL0-6tvzsNSSJOLzG1",
40
+ "view_link": "https://drive.google.com/file/d/1-4LrEqmDP6-EcLpL0-6tvzsNSSJOLzG1/view?usp=drive_link"
41
+ },
42
+ "filename": "NineBusSystem.pickle",
43
+ "bundled": true,
44
+ "local_path": "datasets/NineBusSystem.pickle",
45
+ "metadata": {
46
+ "system_type": "Distribution System",
47
+ "voltage_level": "Medium Voltage",
48
+ "typical_use": "Educational purposes, algorithm testing"
49
+ }
50
+ }
51
+ }
52
+ }