mailRe: looping the optimization in full_analysis.py


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

Header


Content

Posted by Douglas Kojetin on August 29, 2007 - 18:37:
Hi,

It happened again. relax goes through sphere/init and sphere/round_1 ok, but it fails on the execution of the next round. I'll submit a bug report shortly.

Doug


On Aug 29, 2007, at 11:55 AM, Edward d'Auvergne wrote:

Hi,

This is definitely a bug and will occur whenever there is a spin
system loaded into the system but which has not been used in the
analysis (because of deselection or missing relaxation data).  The
problem is that self.relax.data.res[run][i].model does not exist for
all spin systems in your system.  Would you be able to create a bug
report for this issue?  Thanks.  There are three places in the
'convergence()' function in which this failure will occur, but I'll
fix all of these once the bug report is complete so I can point to the
bug report in the SVN commit messages.

Cheers,

Edward


On 8/29/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
Hi Edward,

I am just picking back up on my relaxation analysis, and noticed that
the CONV_LOOP = 1 function is full_analysis.py does not seem to work
properly.  I get the following error:

"""
#####################
# Convergence tests #
#####################


Chi-squared test:
     chi2 (k-1): 164.3021658998544
     chi2 (k):   168.91097779838205
     The chi-squared value has not converged.

Identical model-free models test:
Traceback (most recent call last):
   File "/opt/relax/1.2/relax", line 454, in ?
     Relax()
   File "/opt/relax/1.2/relax", line 166, in __init__
     self.interpreter.run()
   File "/opt/relax/1.2/prompt/interpreter.py", line 213, in run
     run_script(intro=self.relax.intro_string, local=self.local,
script_file=self.relax.script_file, quit=1)
File "/opt/relax/1.2/prompt/interpreter.py", line 388, in run_script
     console.interact(intro, local, script_file, quit)
   File "/opt/relax/1.2/prompt/interpreter.py", line 340, in
interact_script
     execfile(script_file, local)
   File "full_analysis.py", line 574, in ?
     Main(self.relax)
   File "full_analysis.py", line 247, in __init__
     converged = self.convergence(run=name)
   File "full_analysis.py", line 368, in convergence
     curr_models = curr_models + self.relax.data.res[run][i].model
AttributeError: Element instance has no attribute 'model'
"""

Thanks,
Doug

On Jun 27, 2007, at 11:22 AM, Edward d'Auvergne wrote:

Hi,

To commit changes to the repository, you need to become a relax
developer.  There is detailed information in the relax manual about
this long process.  Alternatively if you run the command svn diff to
create a patch file, I can then apply the patch and make the commit
for you.  In this case however I am making the changes to the 1.3
repository line and then back porting to the 1.2 line (this is the
origin of the relax_data_store error you saw before).  Therefore if
you post what the changes are, I will manually apply them to 1.3 and
then back port to 1.2.

Cheers,

Edward


P.S.  The change to line 290 was unnecessary as far as I can see (I
could be wrong though).  And I also replaced the looping over
LOCAL_TM_MODELS and MF_MODELS with a single test within the model- free
model loop which already exists - just to simplify the code.  The
changes have been committed to the repository.




On 6/27/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
Another update.  I had to change a few more lines, but the script
seems to work properly now.

% diff OLD.py NEW.py
229a230,231
                    if name in self.relax.data.run_names:
                        run.delete(name)
290a293,294
            if 'final' in self.relax.data.run_names:
                run.delete('final')
524a529,531
            for name_to_remove in LOCAL_TM_MODELS:
                if name_to_remove in self.relax.data.run_names:
                    run.delete(name_to_remove)
526a534,536
            for name_to_remove in MF_MODELS:
                if name_to_remove in self.relax.data.run_names:
                    run.delete(name_to_remove)


If you would like me to commit these changes, just let me know where
I can find instructions on how to do so.

Thanks,

Doug



On Jun 26, 2007, at 3:58 AM, Edward d'Auvergne wrote:

Whoops, that should have been 'self.relax.data.run_names'!  It's
all
fixed in the repository.

Cheers,

Edward


On 6/25/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
Hi Edward,

A new error, that appears before the first round of iteration
starts
after executing the script:


------------------------------------------------------------------- --
---
----------------------------
Traceback (most recent call last):
   File "/home/dkojetin/bin/relax", line 454, in ?
     Relax()
   File "/home/dkojetin/bin/relax", line 166, in __init__
     self.interpreter.run()
   File "/opt/relax/1.2/prompt/interpreter.py", line 213, in run
     run_script(intro=self.relax.intro_string, local=self.local,
script_file=self.relax.script_file, quit=1)
   File "/opt/relax/1.2/prompt/interpreter.py", line 388, in
run_script
     console.interact(intro, local, script_file, quit)
   File "/opt/relax/1.2/prompt/interpreter.py", line 340, in
interact_script
     execfile(script_file, local)
   File "n3.py", line 578, in ?
     Main(self.relax)
   File "n3.py", line 230, in __init__
     self.load_tensor()
   File "n3.py", line 499, in load_tensor
     if 'previous' in self.relax.data.runs:
AttributeError: Data instance has no attribute 'runs'


Doug



On Jun 25, 2007, at 8:54 AM, Edward d'Auvergne wrote:

Hi,

Sorry, that relax_data_store was 1.3 line specific and I
forgot to
change that for the 1.2 line.  The repository code should now
have
that fixed.

Cheers,

Edward


On 6/25/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx> wrote:
Hello,

Here is the error reported by the modified full_analysis.py
script
(named n.py in the below Traceback):

#--start


------------------------------------------------------------------- --
---
----------------------------
Traceback (most recent call last):
   File "/home/dkojetin/bin/relax", line 454, in ?
     Relax()
   File "/home/dkojetin/bin/relax", line 166, in __init__
     self.interpreter.run()
   File "/opt/relax/1.2/prompt/interpreter.py", line 213, in
run
     run_script(intro=self.relax.intro_string,
local=self.local,
script_file=self.relax.script_file, quit=1)
   File "/opt/relax/1.2/prompt/interpreter.py", line 388, in
run_script
     console.interact(intro, local, script_file, quit)
   File "/opt/relax/1.2/prompt/interpreter.py", line 340, in
interact_script
     execfile(script_file, local)
   File "n.py", line 577, in ?
     Main(self.relax)
   File "n.py", line 229, in __init__
     self.load_tensor()
   File "n.py", line 498, in load_tensor
     if relax_data_store.has_key('previous'):
NameError: global name 'relax_data_store' is not defined

#--end

Thanks,
Doug


On Jun 25, 2007, at 4:42 AM, Edward d'Auvergne wrote:
Hi,

I've just made modifications to the 1.2 and 1.3 repository
lines to
hopefully fix this problem.  Could you try again to see if
the
script
works this time?

Cheers,

Edward


On 6/25/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx>
wrote:
Hi Edward,

I gave the new script a try, setting CONV_LOOP = 1, but it
reported
an error after optimizing the first round:

"""
Convergence:
     [ No ]

relax> run.create(run='previous', run_type='mf')
RelaxError: The run 'previous' already exists.
"""

If you have any suggestions for changes to the script, send
them my
way and I'll give it a try.

Doug



On Jun 24, 2007, at 11:47 AM, Edward d'Auvergne wrote:

Hi,

The simplest way to do this would be to use a while loop
using a
modified version of the convergence() function which
returns
1 or 0
depending on whether the results have converged
(exactly like
your
suggestion).  I have added this looping ability to the
full_analysis.py script in the relax repository (to both
the 1.2
and
1.3 lines).  This is not activated by default though
and the
scripts
in the repository are significantly different from that in
the
relax
1.2.10 version (all the variables which should be
modified by
the user
have been shifted to the top of the script).  Would you be
able to
test if this automatic looping over all rounds of
optimisation
until
convergence actually works?  There could possibly be bugs
lurking
there.  Thanks.

The problem that you encountered with the calling of the
__init__()
function is because this function should not be called.
Using that
type of approach, the looping should have been outside
of the
Main
class to work.

Cheers,

Edward


On 6/16/07, Douglas Kojetin <douglas.kojetin@xxxxxxxxx>
wrote:
Hi All,

Is it possible to edit full_analysis.py so the
optimization of
MII to
MV (self.round > 0) is done automatically by looping
until
convergence?

Do you mean that the script will automatically


 I tried to do this by modifying the following in
convergence() [near the end]:

"""
         # Final print out.
         ##################

         print "\nConvergence:"
         if chi2_converged and models_converged and
params_converged:
             print "    [ Yes ]"
             return 1
         else:
             print "    [ No ]"
             return 0
"""

then modifying __init__(), at the end of the "elif
DIFF_MODEL ==
'sphere' or DIFF_MODEL == 'prolate' or DIFF_MODEL ==
'oblate' or
DIFF_MODEL == 'ellipsoid':" statement:

"""
                 # Test for convergence.
                 test=self.convergence(run=name)

                 if test == 0:
                     __init__(self.relax)
                     #Main(self.relax)
"""

but it did not work properly.  I think the problem has
something to
do with the call to __init__() or Main().  I'll see if
I can
dig up
the error reported by relax.

Thanks,
Doug

_______________________________________________
relax (http://nmr-relax.com)

This is the relax-users mailing list
relax-users@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-users















Related Messages


Powered by MHonArc, Updated Wed Aug 29 19:00:54 2007