Skip to content

Commit cff4460

Browse files
committed
Use --append if scanning with NeXus
1 parent 20824d1 commit cff4460

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

tools/Python/mcrun/optimisation.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ def run(self):
278278
mcstas_dir = self.mcstas.options.dir
279279
if mcstas_dir == '':
280280
mcstas_dir = '.'
281-
282281

283282
with open(self.outfile, 'w') as outfile:
284283
for i, point in enumerate(self.points):
@@ -288,11 +287,18 @@ def run(self):
288287
LOG.debug("%s: %s", key, point[key])
289288
par_values.append(point[key])
290289

291-
LOG.info(', '.join(f'{name}: {value}' for name, value in point.items()))
292-
# Change subdirectory as an extra option (dir/1 -> dir/2)
293-
current_dir = f'{mcstas_dir}/{i}'
294-
LOG.info(f"Output step into scan directory {current_dir}")
295-
self.mcstas.run(pipe=False, extra_opts={'dir': current_dir})
290+
if not self.mcstas.options.format.lower() == 'nexus':
291+
LOG.info(', '.join(f'{name}: {value}' for name, value in point.items()))
292+
# Change subdirectory as an extra option (dir/1 -> dir/2)
293+
current_dir = f'{mcstas_dir}/{i}'
294+
LOG.info(f"Output step into scan directory {current_dir}")
295+
self.mcstas.run(pipe=False, extra_opts={'dir': current_dir})
296+
else:
297+
current_dir = mcstas_dir
298+
LOG.info(f"NeXus output step into scan directory {current_dir}")
299+
self.mcstas.options.append=True
300+
self.mcstas.run(pipe=False, extra_opts={'dir': current_dir})
301+
296302
LOG.info("Finish running step, get detectors")
297303
detectors = mcsimdetectors(current_dir)
298304
if detectors is not None:

0 commit comments

Comments
 (0)