Ticket #2129 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Allow algorithms to be "ReductionSteps" - name to be improved

Reported by: Nick Draper Owned by: Mathieu Doucet
Priority: major Milestone: Iteration 27
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Whitty

Description

This requires algorithms to not store themselves in the history of a workspace.

It was also discussed that they should store a list of the algorithms to be used and the options of underlying algorithms.

Change History

comment:1 Changed 10 years ago by Mathieu Doucet

  • Status changed from new to accepted

comment:2 Changed 10 years ago by Mathieu Doucet

(In [8858]) Modified python algorithm functions to allow algorithm object to be created without being run. Re #2129

comment:3 Changed 10 years ago by Mathieu Doucet

From python, we can now create an algorithm object without executing it by calling

 algo = [algorithm name]( [parameters...], execute=False)

For example:

 algo = Load("myfile.txt", "mywksp", execute=False)

Once created, the algorithm can be run by doing

mantidsimple.execute_algorithm(algo)

The Reducer has been modified so that Mantid algorithms can be passed to append_step(). Previously, this method only accepted ReductionStep objects.

r = Reducer()
r.append_step(Load, "myfile.txt", "mywksp")

The Reducer will create the algorithm and only execute it when reduce() is called. Note that ReductionStep objects can still be passed to append_step() and this change is fully backward compatible. Also note that the input and output workspaces, when defined, will be over-written by the Reducer. Still, dummy values should be passed according to the algorithm's syntax.

comment:4 Changed 10 years ago by Mathieu Doucet

(In [8865]) Minor tweak to mantidsimple to allow not to set mandatory properties when the algo is not to be executed immediately. Re #2129

comment:5 Changed 10 years ago by Mathieu Doucet

Any Reducer method with a signature of the type

 def some_method(reduction_step)

where reduction_step is a ReductionStep object, can now take a mantidsimple algorithm function and its parameters by decorating the method with @validate_step

 @validate_step
 def some_method(reduction_step)

comment:6 Changed 10 years ago by Mathieu Doucet

(In [8866]) Make sure a new algorithm is created every time a reduction step is executed. Re #2129

comment:7 Changed 10 years ago by Mathieu Doucet

(In [8867]) Cleaning up. Re #2129

comment:8 Changed 10 years ago by Martyn Gigg

(In [8872]) Minor fix for reducer module so that it is compatible with python 2.5. Apparently 2.5 doesn't accept something sensible like func(*args, execute=False, kwargs) while 2.6 is perfectly happy with this. Refs #2129

comment:9 Changed 10 years ago by Mathieu Doucet

(In [8890]) validate_step decorator will now work for any combination of mandatory/optional arguments. Re #2129

comment:10 Changed 10 years ago by Mathieu Doucet

Needs unit tests, otherwise the needed functionality should be complete. I have created a new ticket (#2270) to deal with history logging issue of python sub-algorithms.

comment:11 Changed 10 years ago by Mathieu Doucet

(In [8907]) Added unit tests. Re #2129

comment:12 Changed 10 years ago by Mathieu Doucet

(In [8910]) Forgot mtd.initialise(). Re #2129

comment:13 Changed 10 years ago by Mathieu Doucet

(In [8912]) Added test. Re #2129

comment:14 Changed 10 years ago by Mathieu Doucet

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:15 Changed 10 years ago by Michael Whitty

  • Status changed from verify to verifying
  • Tester set to Michael Whitty

comment:16 Changed 10 years ago by Michael Whitty

  • Status changed from verifying to closed

tested in [9528] - allows base algorithms to be set as reduction steps.

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2976

Note: See TracTickets for help on using tickets.