gridfm / gridfm/gridfm-graphkit

ImportError in contingency-analysis tutorial: `visualization.py` imports missing symbols (`PBELoss`, `PQ/PV/REF`)

Open
#42 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Open examples/notebooks/Tutorial_contingency_analisys.ipynb
  2. Run the imports cell containing:
    • from gridfm_graphkit.utils.visualization import (...)
  3. 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:

  • PBELoss no longer exists (or was renamed/removed) in training.loss
  • bus type constants are now PQ_H, PV_H, REF_H in datasets.globals

Suggested fix

  • Make PBELoss import optional (or remove hard dependency from module import path)
  • Update constant imports in visualization.py to PQ_H, PV_H, REF_H (or provide backward-compatible aliases)

Environment

  • OS: Linux
  • Python: 3.12
  • Installed from current main checkout

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.