diff --git a/gprMax/config.py b/gprMax/config.py index 9f326c23..e32c3ac7 100644 --- a/gprMax/config.py +++ b/gprMax/config.py @@ -91,9 +91,6 @@ class ModelConfig: self.appendmodelnumber = '' if sim_config.single_model else str(model_num + 1) # Indexed from 1 self.set_output_file_path() - # Specify a snapshot directory - self.set_snapshots_dir() - # Numerical dispersion analysis parameters # highestfreqthres: threshold (dB) down from maximum power (0dB) of main frequency used # to calculate highest frequency for numerical dispersion analysis @@ -167,9 +164,15 @@ class ModelConfig: self.output_file_path_ext = self.output_file_path.with_suffix('.h5') def set_snapshots_dir(self): - """Set directory to store any snapshots.""" + """Set directory to store any snapshots. + + Returns: + snapshot_dir (Path): directory to store snapshot files in. + """ parts = self.output_file_path.with_suffix('').parts - self.snapshot_dir = Path(*parts[:-1], parts[-1] + '_snaps') + snapshot_dir = Path(*parts[:-1], parts[-1] + '_snaps') + + return snapshot_dir class SimulationConfig: diff --git a/gprMax/model_build_run.py b/gprMax/model_build_run.py index 7095b99d..339ba75a 100644 --- a/gprMax/model_build_run.py +++ b/gprMax/model_build_run.py @@ -216,11 +216,11 @@ class ModelBuildRun: # Write any snapshots to file if self.G.snapshots: # Create directory for snapshots - config.get_model_config().set_snapshots_file_path() - snapshotdir = config.get_model_config().snapshot_file_path + snapshotdir = config.get_model_config().set_snapshots_dir() snapshotdir.mkdir(exist_ok=True) - logger.info('') + logger.info(f'Snapshot directory: {snapshotdir.resolve()}') + for i, snap in enumerate(self.G.snapshots): fn = snapshotdir / Path(snap.filename) snap.filename = fn.with_suffix('.vti')