66import h5py
77
88import kwave
9+ from kwave .options .simulation_execution_options import SimulationExecutionOptions
910from kwave .utils .dotdictionary import dotdict
1011
1112
1213class Executor :
13- def __init__ (self , execution_options , simulation_options ):
14+ def __init__ (self , execution_options : SimulationExecutionOptions , simulation_options ):
1415 self .execution_options = execution_options
1516 self .simulation_options = simulation_options
1617
@@ -21,15 +22,15 @@ def __init__(self, execution_options, simulation_options):
2122 self ._make_binary_executable ()
2223
2324 def _make_binary_executable (self ):
24- try :
25- self .execution_options .binary_path .chmod (self .execution_options .binary_path .stat ().st_mode | stat .S_IEXEC )
26- except FileNotFoundError as e :
25+ binary_path = self .execution_options .binary_path
26+ if not binary_path .exists ():
2727 if kwave .PLATFORM == "darwin" and self .execution_options .is_gpu_simulation :
2828 raise ValueError (
29- "GPU simulations are currently not supported on MacOS. Try running the simulation on CPU by setting is_gpu_simulation=False."
30- ) from e
31- else :
32- raise e
29+ "GPU simulations are currently not supported on MacOS. "
30+ "Try running the simulation on CPU by setting is_gpu_simulation=False."
31+ )
32+ raise FileNotFoundError (f"Binary not found at { binary_path } " )
33+ binary_path .chmod (binary_path .stat ().st_mode | stat .S_IEXEC )
3334
3435 def run_simulation (self , input_filename : str , output_filename : str , options : str ):
3536 command = [str (self .execution_options .binary_path ), "-i" , input_filename , "-o" , output_filename , options ]
0 commit comments