Skip to content

added a bash script example#8

Open
dodu94 wants to merge 1 commit into
mainfrom
add-script-example
Open

added a bash script example#8
dodu94 wants to merge 1 commit into
mainfrom
add-script-example

Conversation

@dodu94

@dodu94 dodu94 commented Apr 28, 2026

Copy link
Copy Markdown
Member

Description

Adds a python script example to perform a "batch" interpolation without using the GUI

Summary by CodeRabbit

  • New Features

    • Added a batch interpolation script for automated processing of multiple jobs without the GUI interface.
  • Documentation

    • Updated README with numbered notes and guidance for running the tool in batch mode via the provided script.

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds a batch interpolation script that automates parameter configuration and sequential execution of interpolation workflows, including instantiating an Interpolator, running interpolation checks, exporting results to ANSYS, and optionally exporting to VTK. The README is updated to reference this new batch processing capability.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added two labeled N.B. sections; the second section references the new batch interpolation script for automated processing without GUI.
Batch Processing Script
scripts/batch_interpolate.py
New script that configures interpolation parameters (query method, radius, kernel type, tolerance, multithreading), maps input file columns, creates output directories, instantiates Interpolator, runs full interpolation with checks CSV output, exports to ANSYS, and conditionally exports to VTK when BUILD_VTK is enabled.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hops of joy through batch-mode bliss,
No GUI needed—automation's kiss!
Configure once, let loops run free,
ANSYS exports flow like a river spree,
VTK blooms when the flag says yes,
This script makes interpolation less of a mess! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title says 'added a bash script example' but the actual changes add a Python script (scripts/batch_interpolate.py), not a bash script. The title is misleading. Update the title to accurately reflect that a Python script example was added, e.g., 'add Python batch interpolation script example'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-script-example

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dodu94 dodu94 requested a review from DrGarciaBlanco April 28, 2026 14:27
@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 32-36: The two separate blockquotes ("N.B. (1)" and "N.B. (2)") in
README.md create a blank line between blockquotes which trips markdownlint
MD028; fix by merging them into a single blockquote or converting them to a
compact list so there is no blank line break — e.g., combine the notes under one
"> **N.B.**" block or replace both blockquotes with a short bullet list,
referencing the existing "N.B. (1)" and "N.B. (2)" content so the messages
remain the same.

In `@scripts/batch_interpolate.py`:
- Around line 31-42: The Interpolator is being constructed with the arguments
reversed: pass the EM folder path first and the mechanical mesh path second;
update the Interpolator call in the loop that iterates TO_INTERPOLATE (currently
using mech_path, em_path) to use em_path then mech_path so
Interpolator(mech_path, em_path, CONFIG, FILE_IDX) becomes Interpolator(em_path,
mech_path, CONFIG, FILE_IDX), keeping the rest of the loop (interpolate_all,
dump_interpolation_check, export_to_ansys, export_forces_to_vtk) unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3069233-3e4d-44cc-be7e-8a1caf35e583

📥 Commits

Reviewing files that changed from the base of the PR and between c21d5b9 and 7af7f98.

📒 Files selected for processing (2)
  • README.md
  • scripts/batch_interpolate.py

Comment thread README.md
Comment on lines +32 to +36
> **N.B. (1)**
> The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.

> **N.B. (2)**
> To execute the tool in "batch mode" without using the GUI, have a look to this [python script](/scripts/batch_interpolate.py) example.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Keep the note section markdownlint-safe.

The blank line between the two blockquotes triggers MD028 (no-blanks-blockquote). If docs lint runs in CI, this will fail. Consider rewriting the notes as a short list or removing the blockquote separation.

Suggested fix
-> **N.B. (1)**  
-> The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.
-
-> **N.B. (2)** 
-> To execute the tool in "batch mode" without using the GUI, have a look to this [python script](/scripts/batch_interpolate.py) example.
+- **N.B. (1)** The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.
+- **N.B. (2)** To execute the tool in "batch mode" without using the GUI, see the [Python script](/scripts/batch_interpolate.py) example.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
> **N.B. (1)**
> The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.
> **N.B. (2)**
> To execute the tool in "batch mode" without using the GUI, have a look to this [python script](/scripts/batch_interpolate.py) example.
- **N.B. (1)** The first time you use the tool, it may take a long time to load. This is most likely due to C++ binding compilations from the GUI package. After this initial run, loading times should be much faster.
- **N.B. (2)** To execute the tool in "batch mode" without using the GUI, see the [Python script](/scripts/batch_interpolate.py) example.
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 34-34: Blank line inside blockquote

(MD028, no-blanks-blockquote)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 32 - 36, The two separate blockquotes ("N.B. (1)" and
"N.B. (2)") in README.md create a blank line between blockquotes which trips
markdownlint MD028; fix by merging them into a single blockquote or converting
them to a compact list so there is no blank line break — e.g., combine the notes
under one "> **N.B.**" block or replace both blockquotes with a short bullet
list, referencing the existing "N.B. (1)" and "N.B. (2)" content so the messages
remain the same.

Comment on lines +31 to +42
for mech_path, em_path, output_dir in TO_INTERPOLATE:
print(f"Interpolating on {mech_path}...")
if not Path(output_dir).exists():
Path(output_dir).mkdir(parents=True)
interpolator = Interpolator(mech_path, em_path, CONFIG, FILE_IDX)
interpolator.interpolate_all()
interpolator.dump_interpolation_check(
Path(output_dir, f"{Path(mech_path).stem}_checks.csv")
)
interpolator.export_to_ansys(Path(output_dir))
if BUILD_VTK:
interpolator.export_forces_to_vtk(Path(output_dir)) # a bit heavier

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Swap the Interpolator arguments here.

Interpolator expects path_to_em_folder first and path_to_mech_mesh second, but this call passes the mechanical mesh path first. As written, the batch script will try to load the EM inputs from the mesh file and vice versa, which will break the interpolation run.

Suggested fix
-    interpolator = Interpolator(mech_path, em_path, CONFIG, FILE_IDX)
+    interpolator = Interpolator(em_path, mech_path, CONFIG, FILE_IDX)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/batch_interpolate.py` around lines 31 - 42, The Interpolator is being
constructed with the arguments reversed: pass the EM folder path first and the
mechanical mesh path second; update the Interpolator call in the loop that
iterates TO_INTERPOLATE (currently using mech_path, em_path) to use em_path then
mech_path so Interpolator(mech_path, em_path, CONFIG, FILE_IDX) becomes
Interpolator(em_path, mech_path, CONFIG, FILE_IDX), keeping the rest of the loop
(interpolate_all, dump_interpolation_check, export_to_ansys,
export_forces_to_vtk) unchanged.

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.

1 participant