mailRe: Redesign of the relax data model: 2. A new run concept


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Gary S. Thompson on January 11, 2007 - 08:19:
Chris MacRaild wrote:

On Sun, 2007-01-07 at 21:14 +0000, gary thompson wrote:

[snip]



 2.  A new run concept

 2.1  Parcelling up an abstract space

 The general idea is to further increase the prominence of the 'run'.
 Rather than relax executing in an abstract space where the 'run' is
 passed into each user function as necessary, the idea is that relax
 executes within a space dedicated to a certain 'run'.  So if at the
 relax prompt, you could type a user function such as:

 relax> run.current()
 'm8'

By working in the 'm8' run space, each user function can be executed
without the need for the 'run' argument. Other user functions, such as
'run.switch()', can be used to change between runs.



[snip]

I'm not sure that the stack idea gains us anything over the run-loop
idea I proposed earlier
https://mail.gna.org/public/relax-devel/2006-10/msg00060.html

The idea of implimenting the run-loop as a functor is a good one though.

We'd have something like:

class Relax_command():
   def __init__(self, function):
       self.function = function
   def __call__(self, *args, **kwds):
       if 'runs' in kwds.keys():
           runs = kwds['runs']
           del kwds['runs']
           current_run = run.current()
           for run_name in runs:
               run.switch(run_name)
               self.function(*args, **kwds)
       else:
           self.function(*args, **kwds)

Then each user command is simply an instance of Relax_command


Chris





Hi Chris ;-) (If you didn't know chris actually sits next to me at work)

There is one thing that your proposal doesn't do that mine does which is to leave the selection state in the same place as you started (also having a stack of runs may also help debugging if there are any problems as the current run nesting isn't hidden in the python call stack)

so I would suggest a stack or

class Relax_command():
   def __init__(self, function):
       self.function = function
   def __call__(self, *args, **kwds):
       if 'runs' in kwds.keys():
           runs = kwds['runs']
           del kwds['runs']
           current_run = run.current()
           for run_name in runs:
               run.switch(run_name)
               self.function(*args, **kwds)
           run.switch(current_run)  #tweak
       else:
           self.function(*args, **kwds)
regards
gary





--
-------------------------------------------------------------------
Dr Gary Thompson
Astbury Centre for Structural Molecular Biology,
University of Leeds, Astbury Building,
Leeds, LS2 9JT, West-Yorkshire, UK             Tel. +44-113-3433024
email: garyt@xxxxxxxxxxxxxxx                   Fax  +44-113-2331407
-------------------------------------------------------------------





Related Messages


Powered by MHonArc, Updated Mon Jan 15 08:01:29 2007