Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tools/Python/mcrun/mcrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def add_mcrun_options(parser):
type=int, metavar='NP',
help='Set number of scan points')

add('--seeds',
metavar='SEEDS',
help='Set range of seeds to scan (each must be: SEED != 0)')

add('-L', '--list',
action='store_true',
help='Use a fixed list of points for linear scanning')
Expand Down Expand Up @@ -541,6 +545,9 @@ def main():
mcstas.prepare(options)

(fixed_params, intervals) = get_parameters(options)
# Add --seeds as an 'interval', to allow scanning simulation seed
if options.seeds:
intervals['--seed']=options.seeds.split(',')

# Indicate end of setup / start of computations
LOG.info('===')
Expand All @@ -561,6 +568,10 @@ def main():
if options.list and options.numpoints:
raise OptionValueError('--numpoints cannot be used with --list')

# Can't both do list and --seeds scanning
if options.list and options.seeds:
raise OptionValueError('--seeds cannot be used with --list')

if options.list:
if len(intervals) == 0:
raise OptionValueError(
Expand All @@ -569,7 +580,7 @@ def main():
points = len(pointlist[0])
if not (all(map(lambda i: len(i) == points, intervals.values()))):
raise OptionValueError(
'All variables much have an equal amount of points.')
'All variables must have an equal amount of points.')
interval_points = LinearInterval.from_list(
points, intervals)

Expand Down
6 changes: 4 additions & 2 deletions tools/Python/mcrun/optimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def build_header(options, params, intervals, detectors):
# Date format: Fri Aug 26 12:21:39 2011
date = datetime.strftime(datetime.now(), '%a %b %d %H %M %Y')

xvars = ', '.join(params)
# Strip header keys of -- (to make --seed -> seed
hdrparams = {key.lstrip('-') for key in params}
xvars = ', '.join(hdrparams)
lst = intervals[list(params)[0]]
xmin = min(lst)
xmax = max(lst)
Expand All @@ -56,7 +58,7 @@ def build_header(options, params, intervals, detectors):

scantype = 'multiarray_1d(%d)' % N

variables = list(params)
variables = list(hdrparams)
for detector in detectors:
variables += [detector + '_I', detector + '_ERR']

Expand Down