-
Notifications
You must be signed in to change notification settings - Fork 51
[DO NOT MERGE] Collect & Compare Example Inputs/Outputs #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| from kwave.kWaveSimulation import kWaveSimulation | ||
| from kwave.kWaveSimulation_helper import retract_transducer_grid_size, save_to_disk_func | ||
| from kwave.options.simulation_execution_options import SimulationExecutionOptions | ||
| from kwave.options.simulation_options import SimulationOptions | ||
| from kwave.options.simulation_options import SimulationOptions, resolve_filenames_for_run | ||
| from kwave.utils.dotdictionary import dotdict | ||
| from kwave.utils.interp import interpolate3d | ||
| from kwave.utils.pml import get_pml | ||
|
|
@@ -313,6 +313,7 @@ def kspaceFirstOrder3D( | |
| if options.save_to_disk: | ||
| # store the pml size for resizing transducer object below | ||
| retract_size = [[options.pml_x_size, options.pml_y_size, options.pml_z_size]] | ||
| input_filename, output_filename = resolve_filenames_for_run(k_sim.options) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find resolve_filenames_for_run function definition
ast-grep --pattern 'def resolve_filenames_for_run($_)'Repository: waltsims/k-wave-python Length of output: 3388 🏁 Script executed: #!/bin/bash
# Read the function with its docstring
sed -n '439,480p' kwave/options/simulation_options.pyRepository: waltsims/k-wave-python Length of output: 1828 🏁 Script executed: #!/bin/bash
# Search for patterns where SimulationOptions might be reused across multiple runs
rg -n 'SimulationOptions' --type py | grep -E '(for|while|loop|multiple)' | head -20Repository: waltsims/k-wave-python Length of output: 2091 🏁 Script executed: #!/bin/bash
# Look for examples that might reuse options objects
fd -e py -path '*/example*' -x grep -l 'resolve_filenames_for_run\|SimulationOptions' {} \;Repository: waltsims/k-wave-python Length of output: 234 🏁 Script executed: #!/bin/bash
# Search examples directory for patterns of SimulationOptions reuse
find examples -name "*.py" -exec grep -l 'SimulationOptions' {} \;Repository: waltsims/k-wave-python Length of output: 1258 🏁 Script executed: #!/bin/bash
# Check one of the example files to see if options are reused
head -150 examples/ivp_photoacoustic_waveforms/ivp_photoacoustic_waveforms.pyRepository: waltsims/k-wave-python Length of output: 4295 🏁 Script executed: #!/bin/bash
# Search for patterns where the same SimulationOptions variable is used in multiple simulation calls
rg -A 30 'simulation_options\s*=' examples/ | grep -B 5 'kspaceFirstOrder.*simulation_options' | head -60Repository: waltsims/k-wave-python Length of output: 5289 🏁 Script executed: #!/bin/bash
# Check the checkpoint example which might reuse options
cat examples/checkpointing/checkpoint.py | head -200Repository: waltsims/k-wave-python Length of output: 5058 Undocumented side-effect: At line 440–441 of |
||
|
|
||
| # run subscript to save files to disk | ||
| save_to_disk_func( | ||
|
|
@@ -361,6 +362,7 @@ def kspaceFirstOrder3D( | |
| "cuboid_corners": k_sim.cuboid_corners, | ||
| } | ||
| ), | ||
| input_filename=input_filename, | ||
| ) | ||
|
|
||
| # run subscript to resize the transducer object if the grid has been expanded | ||
|
|
@@ -372,5 +374,5 @@ def kspaceFirstOrder3D( | |
|
|
||
| executor = Executor(simulation_options=simulation_options, execution_options=execution_options) | ||
| executor_options = execution_options.as_list(sensor=k_sim.sensor) | ||
| sensor_data = executor.run_simulation(k_sim.options.input_filename, k_sim.options.output_filename, options=executor_options) | ||
| sensor_data = executor.run_simulation(input_filename, output_filename, options=executor_options) | ||
| return sensor_data | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded
/tmppath is not portable to Windows.Path("/tmp/...")won't work on Windows. Consider usingtempfile.gettempdir()orPath(tempfile.gettempdir())for cross-platform compatibility.Proposed fix
🤖 Prompt for AI Agents