Skip to content

Commit e00eaba

Browse files
Clean up k-wave files #435
Closes #435
1 parent 2956efd commit e00eaba

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/openlifu/sim/kwave_if.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import logging
44
from copy import deepcopy
5+
from pathlib import Path
56
from typing import List
67

78
import numpy as np
@@ -222,6 +223,11 @@ def run_simulation(arr: xdc.Transducer,
222223
coords=[pcoords[dim] for dim in ['t','x','y','z']],
223224
attrs={'units':'Pa', 'long_name':'Pressure'})
224225

226+
# clean up temporary files created by k-wave
227+
for filename in [simulation_options.input_filename, simulation_options.output_filename]:
228+
Path(filename).unlink(missing_ok=True)
229+
230+
225231
ds = xa.Dataset(ds_dict)
226232
if return_kwave_outputs and return_kwave_inputs:
227233
return ds, output, inputs

0 commit comments

Comments
 (0)