Skip to content

fix: resolve broken imports in cardiac_pm.py (#290)#526

Merged
pradeeban merged 2 commits intoControlCore-Project:devfrom
GaneshPatil7517:fix/cardiac-pm-imports-290
Apr 1, 2026
Merged

fix: resolve broken imports in cardiac_pm.py (#290)#526
pradeeban merged 2 commits intoControlCore-Project:devfrom
GaneshPatil7517:fix/cardiac-pm-imports-290

Conversation

@GaneshPatil7517
Copy link
Copy Markdown

cardiac_pm.py in humanc/ and tools/ (symlinked by linktest/) imported pulsatile_model_functions and healthy_params directly, but these modules only exist inside the cardiac_pm.dir/ subdirectories.

Add sys.path manipulation to insert the cardiac_pm.dir/ directory into the import path so the modules are found both during development and after deployment via mkconcore.py.

cardiac_pm.py in humanc/ and tools/ (symlinked by linktest/) imported
pulsatile_model_functions and healthy_params directly, but these modules
only exist inside the cardiac_pm.dir/ subdirectories.

Add sys.path manipulation to insert the cardiac_pm.dir/ directory into
the import path so the modules are found both during development and
after deployment via mkconcore.py.
Copilot AI review requested due to automatic review settings April 1, 2026 03:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes runtime import failures for the cardiac pulsatile model scripts by ensuring their sibling cardiac_pm.dir/ directories are discoverable on sys.path, aligning behavior across dev runs and mkconcore.py deployments.

Changes:

  • Add sys/os imports and a sys.path.insert(...) to include the local cardiac_pm.dir/ directory before importing model modules.
  • Reorder/move logging import in tools/cardiac_pm.py to accommodate the path setup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tools/cardiac_pm.py Prepends tools/cardiac_pm.dir/ to sys.path so pulsatile_model_functions/healthy_params imports resolve.
humanc/cardiac_pm.py Prepends humanc/cardiac_pm.dir/ to sys.path so pulsatile_model_functions/healthy_params imports resolve.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Guard sys.path.insert with a duplicate check to avoid accumulating
  entries on repeated imports/reloads (Copilot review suggestion).
- Replace bare except with except (ValueError, SyntaxError) in
  sample/PZ/pm.py and sample/src/pm.py to fix ruff E722.
@pradeeban pradeeban merged commit c05e02d into ControlCore-Project:dev Apr 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants