mailRe: r25036 - /trunk/specific_analyses/relax_disp/api.py


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

Header


Content

Posted by Edward d'Auvergne on August 19, 2014 - 17:18:
Hmmm, I don't think it's related.  Maybe it is time to unify
'ri_data', at least between the model-free analysis and relaxation
dispersion.  This might be the best solution for handling fixed and
optimised R1 values as the same thing (as well as optimised R2/R1rho
values).

The 'ri_data' concept is the key behind the relax_data user functions.
The relax_data.read user function is used to read in R1 data and store
it in 'ri_data', so maybe we should use this for the optimised values
as well.  This would of course include the R2 parameter as well.  The
values are then written out with the relax_data.write user function.
For the grace.write function, the relevant key needs to be supplied to
obtain the correct values.

Note that the current relaxation data design creates a number of data
structures.  In the base data pipe 'cdp', it creates the cdp.ri_ids
list and cdp.ri_type dictionary, and stores the spectrometer frequency
in a dictionary.  For the spins it creates the ri_data and ri_data_err
dictionaries which contain the values and errors.  So you would need
to create a key for each R1 data set per experiment and field strength
(it is offset, spin, and dispersion point independent), store the key,
data type, and frequency in cdp, and store the values and errors in
the spin containers.  See the pipe_control.relax_data.pack_data()
function, as that will do it automatically for you:

http://www.nmr-relax.com/api/3.2/pipe_control.relax_data-module.html#pack_data
http://www.nmr-relax.com/api/3.2/pipe_control.relax_data-pysrc.html#pack_data

I think that using this approach will solve all of the strange
problems.  And is will allow you to use the relax_data user functions
so you can access a lot of already implemented infrastructure.  If you
are interested in this clean solution, I would suggest that you copy
the 'r1' and 'r2' parameter object definition into the base class into
a new _add_ri_data() method, as is done for the other analysis
independent parameters, and merge the two into one 'ri_data'
parameter.  Then use the pack_data() function to store data.  You also
have access to the create_frq_label(), delete(), return_value(), and
write() functions.  You could then replace calls to the value.write
user function with relax_data.write.  The grace.write user function
should work without changes, if you pass in the correct key.

Regards,

Edward



On 19 August 2014 16:54, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Hi Edward.

Well, it seemed that my problems was fixed.

I haven't met any problems since then.

There was though an issue, with the test script you just provided.

I could not find any values in the: 'r1rho_prime.out' file.

If I add: 'TP02 R1 fit' to the model list, I get r1.out to also be empty.

I wonder if that was my fix to:
https://gna.org/support/index.php?3121

Best
Troels

2014-08-19 16:36 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,

This is a difficult problem as R1 values are normally stored in the
ri_data dictionary object, the same place that R2 values are stored.
I don't have an easy solution for this, but future attempts at
unifying the handling of relaxation data in all analyses will affect
your current work.  For example the 'r1' parameter here will probably
be converted into 'ri_data', and the 'ri_data' object set up with a
special method in the base Parameter_object class.  The 'ri_data'
object is correctly handled by value.set and grace.write, but the
current implementation in the model-free parameter object is ugly.
Does your implementation now work correctly?

Regards,

Edward



On 15 August 2014 18:54,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Fri Aug 15 18:54:01 2014
New Revision: 25036

URL: http://svn.gna.org/viewcvs/relax?rev=25036&view=rev
Log:
Fix in relax_disp API, how to handle the r1_fit parameter type.

bug #22470(https://gna.org/bugs/index.php?22470): value.set does not work 
for parameter r1_fit.

Modified:
    trunk/specific_analyses/relax_disp/api.py

Modified: trunk/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=25036&r1=25035&r2=25036&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/api.py   (original)
+++ trunk/specific_analyses/relax_disp/api.py   Fri Aug 15 18:54:01 2014
@@ -1001,8 +1001,29 @@
                 if error:
                     obj_name += '_err'

+                # Handle the R10 parameters.
+                if param[i] in ['r1_fit']:
+                    # Loop over the current keys.
+                    for exp_type, frq, ei, mi in 
loop_exp_frq(return_indices=True):
+                        # The parameter key.
+                        key = generate_r20_key(exp_type=exp_type, 
frq=frq)
+
+                        # Initialise the structure if needed.
+                        if not hasattr(spin, obj_name):
+                            setattr(spin, obj_name, {})
+
+                        # Set the value.
+                        if index == None:
+                            obj = getattr(spin, obj_name)
+                            obj[key] = value[i]
+
+                        # If the index is specified, let it match the 
frequency index
+                        elif mi == index:
+                            obj = getattr(spin, obj_name)
+                            obj[key] = value[i]
+
                 # Handle the R20 parameters.
-                if param[i] in PARAMS_R20:
+                elif param[i] in PARAMS_R20:
                     # Loop over the current keys.
                     for exp_type, frq, ei, mi in 
loop_exp_frq(return_indices=True):
                         # The parameter key.


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

This is the relax-commits mailing list
relax-commits@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-commits

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

This is the relax-devel mailing list
relax-devel@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-devel



Related Messages


Powered by MHonArc, Updated Tue Aug 19 17:40:13 2014