mailRe: [sr #3195] Fitting of saturation recovery experiment


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

Header


Content

Posted by Edward d'Auvergne on November 29, 2014 - 17:11:
Hi Andras,

If you update relax and recompile the C modules:

$ svn up
$ scons clean_all
$ scons

Then run your system test:

$ relax -sd Relax_fit.test_saturation_recovery

You should now see that the test passes.  I have implemented the
saturation recovery equations, gradients, and Hessians in the new
target_functions/exponential_sat.c file.  If you would like to create
Sparky files for the inversion recovery experiment, where I0 < Iinf, I
could do the same thing for this curve type as well.

Cheers,

Edward




On 29 November 2014 at 16:58, Edward d'Auvergne <edward@xxxxxxxxxxxxx> wrote:
Hi Andras,

I've now added this:

- The script has been added
(http://article.gmane.org/gmane.science.nmr.relax.scm/24570).
- Modified the script to work as a system test
(http://article.gmane.org/gmane.science.nmr.relax.scm/24572).
- Updated the copyright notice with your name
(http://article.gmane.org/gmane.science.nmr.relax.scm/24574).
- Created the system test
(http://article.gmane.org/gmane.science.nmr.relax.scm/24575).

Your script can now be run by typing:

$ relax -sd Relax_fit.test_saturation_recovery

Regards,

Edward



On 29 November 2014 at 15:23, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Dear Edward,

thanks a lot for the great explanations.

Unfortunately, I cannot figure out, what to paste where and rename to what.

I won't feel offended though, if you implement it.

Best,
Andras
________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On Behalf Of 
Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 1:24 PM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi Andras,

To push changes into the source code repository, you'd have to become
a relax developer.  If you are interested, I'd recommend first reading
of the 'open source infrastructure' and 'relax development' chapters
of the manual.  These chapters outline the procedure in full detail.
Do you have experience with CVS, subversion, git, or other source code
revision control systems?

The first step to have changes made to relax is to upload either files
or patches to a relax task, and ask for it to be included or applied.
For example I could take the script you have just attached to the task
in the 'saturation_recovery.tar.gaz' file (https://gna.org/task/?7415,
https://gna.org/task/download.php?file_id=22997), and place this into
the relax system test directories.  However, if you feel adventurous,
you could try to create your own system test from this!  I could then
incorporate your self designed test and add this to relax.  Creating
this test is rather straight forward:


- Firstly you will need a copy of the relax trunk in your home
directory that you can modify yourself.  The /sw/lib/ version is no
good for this.


- Copy your script to the new file
test_suite/system_tests/scripts/relax_fit_saturation_recovery.py.  Add
this to the repository by typing:

$ svn add test_suite/system_tests/scripts/relax_fit_saturation_recovery.py

You can then see the status of the relax source code by typing:

$ svn st

which will show your newly added script.


- The next step would be to add a copyright notice.  Open any relax
*.py file and copy the notice from the top into your script.  Remove
all authors and place your name and the year there.  You could also
include the link to your Gna! profile in brackets after your name
(https://gna.org/users/andras).


- Then to create the test itself.  I would suggest that this is called
Relax_fit.test_saturation_recovery.  Open the
test_suite/system_tests/relax_fit.py in a text editor (preferably
something such as gvim or emacs where source code is recognised, and
coloured, and the programs help you with the code).  Copy the 11 lines
of the test_zooming_grid_search() method
(http://www.nmr-relax.com/api/3.3/test_suite.system_tests.relax_fit-pysrc.html#Relax_fit.test_zooming_grid_search)
and paste and rename it to test_saturation_recovery().  Be sure that
alphabetical order is preserved.  Change the script name to your
script, and the chi-squared value to 0.0, and the I0 and Rx values to
your values.  As you are changing this file, add a new line to the
copyright notice with your name and the year.


- Try running the test with:

$ relax -s Relax_fit.test_saturation_recovery


- This will probably not run straight away, as you need to fix the
paths in the script.  Open your script and the
test_suite/system_tests/scripts/relax_fit_zooming_grid.py script
side-by-side (run 'svn up' now as I just simplified this reference
script for you).  Note the use of the relax status object (used to
find where relax is installed) and the os.sep Python module to support
all operating systems, as '/' in Windows is '\' (fortunately Macs
don't use ':' as a folder separator any more).  After this the test
should run and be complete.  Yet it will fail due to the chi-squared
and parameter check, and because the saturation-recovery equations are
not implemented yet.


- Finally prepare a patch by typing:

$ svn diff > patch

This will contain all the changes, including the new script file.
Upload the 'patch' file to the task, remembering to add a comment
describing the patch.  You may even wish to create your own commit
message - see the development chapter.


- Code review.  I'll look at the patch and make suggestions for
improvements.  Changes can be made and a new patch created and
uploaded.


- Once the patch is in a good state,  I can apply it to the relax
trunk and permanently commit the change to the repository.


This is essentially the starting procedure for becoming a developer.
Many more details are given in the development chapter.  The reason
I'm mentioning all of this now is because it's 7 pm Friday evening
here and I won't have a chance to look at this until next week.  For
me, creating this test is less than 5 min of work.  If you have the
interest, feel free to try it out yourself.

Regards,

Edward


P. S.  As for deleting files, this is not possible.  The
infrastructure that relax uses, and open source infrastructure in
general, is deliberately designed so that everything is permanent.



On 28 November 2014 at 18:38, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Hi,

great, this really helped.

The script runs now for exponential fitting 'exp' and throws an error for 
inversion recovery fitting 'inv'.

I uploaded a new saturation recovery folder:

file #22997:  saturation_recovery.tar.gaz

Is there a way to remove the old one? And is there a way for me to push 
changes through svn?

Best,
Andras
____________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On Behalf 
Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 12:16 PM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi,

Ok, then you're almost there.  You'll need to obtain a copy of minfx
(https://gna.org/projects/minfx/) and bmrblib
(https://gna.org/projects/bmrblib/).  These used to be relax packages,
but they have been spun out into their own for others to take
advantage of.  For this, type:

$ cd /sw/lib/relax-trunk/
$ svn co http://svn.gna.org/svn/minfx/tags/1.0.11/minfx
$ svn co http://svn.gna.org/svn/bmrblib/tags/1.0.3/bmrblib

This is performed when a new relax release is made so that minfx and
bmrblib are bundled with relax, but this needs to be performed
manually when using the most cutting edge code.  Note that it is much
better to place the relax-trunk into your home directory as this will
be constantly modified by the relax developers.  Then, as a normal
user (without sudo), you can obtain the latest code by typing:

$ svn up

Regards,

Edward


P. S.  The command for showing the PATH environmental variable is
"echo $PATH" rather than just "$PATH".







On 28 November 2014 at 18:07, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Hi,

so I aliased relax to the trunk relax and can start it now, but here is 
the problem:

 File "/sw/lib/relax-trunk/relax", line 4, in <module>
    import relax
  File "/sw/lib/relax-trunk/relax.py", line 37, in <module>
    import dep_check
  File "/sw/lib/relax-trunk/dep_check.py", line 90, in <module>
    if not minfx.__version__ == 'trunk' and 
version_comparison(minfx.__version__, min_version) == -1:
AttributeError: 'module' object has no attribute '__version__'

which relax now gives:

which relax
relax:   aliased to /sw/lib/relax-trunk/relax

and $PATH:

/sw/bin:/sw/sbin:.:/Applications/NMRpipe/nmrbin.mac:/Applications/NMRpipe/com:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/xplor-nih-2.33/bin:/opt/X11/bin:
 Command not found.


The locations are:

/sw/lib/relax-py27/relax_gui_mode.py
/sw/lib/relax-py27/relax_gui_mode.pyo
/sw/lib/relax-trunk/relax_gui_mode.py

I installed relax previously with fink. Unfortunately, fink does't 
support yosemite yet, so I can't install newer versions this way, except 
for the app.

Best regards,
Andras
________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On Behalf 
Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 11:46 AM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi,

Hmmm, this might be difficult to work out due to the number of
possibilities (Fink, Homebrew, framework installs, standard installs,
etc.).  So I'd need a bit more information.  Which method did you use
to obtain the code for the relax trunk?  Do you have Xcode, Scons,
subversion, Python, etc. installed all via DMG packages?  How did you
install relax to start with?  Are you the administrator for your
computer?  To find the different relax installations, maybe type:

$ sudo /usr/libexec/locate.updatedb
$ locate relax_gui_mode.py

Could you copy and paste the output of this into a mail?  This should
find all places where relax is located (the relax_gui_mode.py script
is simply a unique file name).  Then to find out where the default
relax is, type:

$ which relax

This will be the version that runs when you type 'relax'.  If you have
the relax trunk in the ~/relax-trunk directory (where ~ is your home
directory), then to run this version type:

$ ~/relax-trunk/relax

Does this work for you?  You can sometimes override the version
installed in /usr/local/ by creating a 'bin' directory and linking the
main relax file:

$ cd ~
$ mkdir bin
$ cd bin
$ ln -s ~/relax-trunk/relax
$ cd
$ which relax

Replace "~/relax-trunk" with any path you wish.  Normally ~/bin will
come before /usr/local in your $PATH environmental variable.  To be
sure, could you tell me what you see when you type:

$ echo $PATH

Note that in all of the above commands, that the '$ ' is the terminal
or prompt and that you should not type this.

Regards,

Edward








On 28 November 2014 at 17:30, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Hi,

would you happen to know where all these things install themselfes to. 
I am at a complete loss.

Best,
Andras
________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On Behalf 
Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 9:53 AM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi,

Somehow the relax-trunk version is not located on the system path or
it doesn't have priority over the installed 3.1.7 version.  You could
supply the full path to override this, uninstall the 3.1.7 version, or
change the order of the directories in the $PATH environmental
variable.

Regards,

Edward



On 28 November 2014 at 15:47, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Well I installed the relax-trunk version, but I am not sure if that is 
what I am running.

When I type relax -i

I get this header:

relax 3.1.7

                              Molecular dynamics by NMR data analysis

                             Copyright (C) 2001-2006 Edward d'Auvergne
                         Copyright (C) 2006-2014 the relax development 
team

This is free software which you are welcome to modify and redistribute 
under the conditions of the
GNU General Public License (GPL).  This program, including all 
modules, is licensed under the GPL
and comes with absolutely no warranty.  For details type 'GPL' within 
the relax prompt.

Assistance in using the relax prompt and scripting interface can be 
accessed by typing 'help' within
the prompt.

Processor fabric:  Uni-processor.

Best,
Andras

________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On 
Behalf Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 9:44 AM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi,

What do you see when you run:

$ relax -i

Are you using the latest relax trunk version?  Or the 3.3.3 version?
I only see this on versions 3.2.3 or earlier, in relax 3.3.0 and later
this works.

Regards,

Edward



On 28 November 2014 at 15:40, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
That's exactly what I see.

But you seem to be getting that error too, or am I mixing something 
up now?

Best,
Andras
________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On 
Behalf Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Friday, November 28, 2014 9:34 AM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi Andras,

That message is what happens when you execute the minimise.grid_search
user function on an old relax version.  Could you check if you are
running the latest:

$ relax -i

This is what I see with the last 3.1 relax release:

"""
                                            relax 3.1.7

                              Molecular dynamics by NMR data analysis

                             Copyright (C) 2001-2006 Edward d'Auvergne
                         Copyright (C) 2006-2014 the relax 
development team

This is free software which you are welcome to modify and redistribute
under the conditions of the
GNU General Public License (GPL).  This program, including all
modules, is licensed under the GPL
and comes with absolutely no warranty.  For details type 'GPL' within
the relax prompt.

Assistance in using the relax prompt and scripting interface can be
accessed by typing 'help' within
the prompt.

Processor fabric:  Uni-processor.

relax> minimise.grid_search()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'Uf_object' object has no attribute 'grid_search'
"""

Regards,

Edward




On 28 November 2014 at 15:18, Boeszoermenyi, Andras
<Andras_Boeszoermenyi@xxxxxxxxxxxxxxx> wrote:
Hi Edward,

I upgraded everything to newest.

I tried to updated the script too, but when I run it I get this 
error message:

File "/sw/lib/relax-py27/multi/processor.py", line 494, in run
    self.callback.init_master(self)
  File "/sw/lib/relax-py27/multi/__init__.py", line 318, in 
default_init_master
    self.master.run()
  File "/sw/lib/relax-py27/relax.py", line 194, in run
    self.interpreter.run(self.script_file)
  File "/sw/lib/relax-py27/prompt/interpreter.py", line 275, in run
    return run_script(intro=self.__intro_string, local=locals(), 
script_file=script_file, show_script=self.__show_script, 
raise_relax_error=self.__raise_relax_error)
  File "/sw/lib/relax-py27/prompt/interpreter.py", line 578, in 
run_script
    return console.interact(intro, local, script_file, 
show_script=show_script, raise_relax_error=raise_relax_error)
  File "/sw/lib/relax-py27/prompt/interpreter.py", line 477, in 
interact_script
    exec_script(script_file, local)
  File "/sw/lib/relax-py27/prompt/interpreter.py", line 352, in 
exec_script
    runpy.run_module(module, globals)
  File "/sw/lib/python2.7/runpy.py", line 180, in run_module
    fname, loader, pkg_name)
  File "/sw/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File 
"/Users/andrasboeszoermenyi/relax-trunk/test_suite/shared_data/curve_fitting/saturation_recovery/relax_sym.py",
 line 106, in <module>
    minimise.grid_search(inc=11)
AttributeError: 'Uf_object' object has no attribute 'grid_search'

Not sure if that could be related to my recent upgrade to Yosemite, 
but I think it shouldn't.

I uploaded the project as:

file #22996:  saturation_recovery.tar.gz

Best,
Andras

________________________________________
From: edward.dauvergne@xxxxxxxxx [edward.dauvergne@xxxxxxxxx] On 
Behalf Of Edward d'Auvergne [edward@xxxxxxxxxxxxx]
Sent: Thursday, November 27, 2014 1:16 PM
To: Boeszoermenyi, Andras
Cc: relax-devel@xxxxxxx; Sébastien M
Subject: Re: [sr #3195] Fitting of saturation recovery experiment

Hi Andras,

I have now included your files in relax
(http://article.gmane.org/gmane.science.nmr.relax.scm/24542).  If you
have the trunk source code copy of relax and type:

$ svn up

You will see the files appear in the
test_suite/shared_data/curve_fitting/saturation_recovery directory.
If you could update your script for the latest relax version, I could
add it to the test_suite/system_tests/scripts/ directory.  This would
then be very simple to set up as a system test by duplicating and
modifying this test:

http://www.nmr-relax.com/api/3.3/test_suite.system_tests.relax_fit-pysrc.html#Relax_fit.test_zooming_grid_search

Cheers,

Edward


On 27 November 2014 at 19:06, Edward d'Auvergne 
<edward@xxxxxxxxxxxxx> wrote:
Hi Andras,


ok I uploaded a tar file with synthetic peaks for one spin system:

file #22989

Cheers!  The permanent link to the file is
http://gna.org/task/download.php?file_id=22989, and this is attached
to the task #7415 (http://gna.org/task/?7415).


The saturation recovery formula is:

 I0*(1 - exp(?R1*t))

The parameters I used were

I0 = 1000000000000000.00

and

R1 = 0.5

I'm wondering if this equation is correct.  Should this not be:

I(t) = I_inf*(1 - exp(?R1*t))

Is the magnitisation not returning to the steady-state of I_inf?  I
guess that in this experiment I0 == I_inf.


Obviously, the same numbers also work for the inversion recovery 
experiment:

I(t) = I? ? I0*exp(?R1*t)

with I? set to 1000000000000000.00 as well. Not sure how much that 
helps though.

If I0 is set to something less than I_inf, this would give different
I(t) values.  Such a data set could be used to implement the 
inversion
recovery experiment.


If "inv" is not implemented, then that would explain the weird 
results :)

More of a warning is probably required.  Or a synthetic data set,
relax script, and system test created, and then this equation 
finally
implemented.


Unfortunately, I have no primary reference for the saturation 
recovery experiment either.

It's a pity.  The ancient primary references for all these basic and
old experiment types would be great for adding to the relax manual 
and
user function documentation.  I can see that lots of people discuss
this older method, but I also don't see any references.

I was wondering if you were able to update to the latest version of
relax (3.3.3 at http://www.nmr-relax.com/download.html#Mac_OS_X), or
even better to use the relax trunk source code
(http://thread.gmane.org/gmane.science.nmr.relax.devel/3693/focus=7348).
Could you try to update the scripts to run with these versions?  The
newest relax versions will tell you how the user functions have been
renamed.

Cheers,

Edward



Related Messages


Powered by MHonArc, Updated Sun Nov 30 01:40:16 2014