added a bash script example#8
Conversation
WalkthroughThis 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
README.mdscripts/batch_interpolate.py
| > **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. |
There was a problem hiding this comment.
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.
| > **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.
| 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 |
There was a problem hiding this comment.
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.
Description
Adds a python script example to perform a "batch" interpolation without using the GUI
Summary by CodeRabbit
New Features
Documentation