gridfm / gridfm/gridfm-graphkit
ImportError in contingency-analysis tutorial: `visualization.py` imports missing symbols (`PBELoss`, `PQ/PV/REF`)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 105
- Forks
- 36
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 9
Description
Summary
Running the contingency tutorial notebook fails during imports because gridfm_graphkit.utils.visualization imports symbols that are not available in the current codebase.
Reproduction
- Open
examples/notebooks/Tutorial_contingency_analisys.ipynb - Run the imports cell containing:
from gridfm_graphkit.utils.visualization import (...)
- Observe the error.
Actual behavior
Import fails with:
ImportError: cannot import name 'PBELoss' from gridfm_graphkit.training.loss- (after fixing that)
ImportError: cannot import name 'PQ' from gridfm_graphkit.datasets.globals
Expected behavior
The tutorial import cell should run without errors in a clean install of the repository.
Root cause (likely)
visualization.py appears to use outdated imports:
PBELossno longer exists (or was renamed/removed) intraining.loss- bus type constants are now
PQ_H,PV_H,REF_Hindatasets.globals
Suggested fix
- Make
PBELossimport optional (or remove hard dependency from module import path) - Update constant imports in
visualization.pytoPQ_H,PV_H,REF_H(or provide backward-compatible aliases)
Environment
- OS: Linux
- Python: 3.12
- Installed from current
maincheckout
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with gridfm_graphkit/utils/visualization.py and the imports cell in examples/notebooks/Tutorial_contingency_analisys.ipynb. Compare its PBELoss import with gridfm_graphkit/training/loss and its bus-type imports with gridfm_graphkit/datasets/globals, then run the notebook imports in a clean install. Done means the import cell completes without ImportError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100