Hi

Here the patch for the file 'maths_fns/consistency.py'


Séb :)



Sebastien Morin wrote:
> Hi again !
>
> Here is again the first patch for the file 'prompt/consistency_tests.py'.
>
> I modified the header for the copyrights.
>
> Also, the former patches were not copied-pasted, but attached using
> Thunderbird after their creation using a command like 'svn diff > patch'
> under Linux. When I send those kinds of files as attachment, I usually
> see them as text in the e-mail, but also as an attachment that can be
> save. Tell me if it is okay and if it is still a problem, I'll put them
> on my lab's website...
>
> Cheers
>
>
> Séb :)
>
>
>
> Edward d'Auvergne wrote:
>   
>> Hi,
>>
>> Just add some text such as 'Copyright (C) 2007 Sebastien Morin
>> <sebastien.morin.1 at ulaval.ca>' underneath the already existent
>> copyright text.  The can be changed later, for example I can give you
>> a [EMAIL PROTECTED] email address which is an alias for any other
>> email address (once voted in as a relax developer).  Could you add
>> this and then resend the patches?  Ta.  If they are attached rather
>> than cut and paste that would be much easier for applying the patches
>> (as email wraps lines).  Also, maybe responding to your original posts
>> will allow the patches to be more easily tracked in the mailing list
>> https://mail.gna.org/public/relax-devel/.
>>
>> Cheers,
>>
>> Edward
>>
>>
>> On 7/9/07, Sebastien Morin <[EMAIL PROTECTED]> wrote:
>>     
>>> Hi !
>>>
>>> I'm about to create the patches to merge the consistency tests code into
>>> the 1.2 branch.
>>>
>>> However, I have one question. How do I treat the copyrights ? Do I leave
>>> the original author from which I copied the code and then modified it or
>>> do I had my name to the code headers..?
>>>
>>> Thanks !
>>>
>>>
>>> Sébastien  :)
>>>
>>>
>>>
>>>
>>> Edward d'Auvergne wrote:
>>>       
>>>> Oh, I've committed your patch at
>>>>
>>>>         
>>> http://maple.rsvs.ulaval.ca/mediawiki/index.php/Patch_consistency_tests_2007-06-26
>>>
>>>       
>>>> as revision r3324, applying it to the 1.2 branch.  I've carefully
>>>> checked the code and none of the changes are detrimental or could
>>>> affect the stability of the stable 1.2 relax codebase.  Note however
>>>> that the code in the branch will not run as the consistency_test.py
>>>> files are still identical copies of the jw_mapping.py files.
>>>>
>>>> Cheers,
>>>>
>>>> Edward
>>>>
>>>>
>>>> On 7/9/07, Edward d'Auvergne <[EMAIL PROTECTED]> wrote:
>>>>         
>>>>> Hi,
>>>>>
>>>>> I've now created two branches within the relax repository for you to
>>>>> play with.  The first is a copy of the 1.2 line and is located at
>>>>> svn.gna.org/svn/relax/branches/consistency_tests_1.2/.  The second is
>>>>> a copy of the 1.3 line and is located at
>>>>> svn.gna.org/svn/relax/branches/consistency_tests_1.3/.  I've
>>>>>           
>>> initially
>>>       
>>>>> used 'svn cp' to create the 5 consistency_tests.py files as described
>>>>> in https://mail.gna.org/public/relax-devel/2007-07/msg00001.html
>>>>> (Message-id:
>>>>> <[EMAIL PROTECTED]>).
>>>>>  Would you be able to create patches for these files (in the 1.2 line
>>>>> first, no need to worry about the 1.3 line yet), and then post the
>>>>> individual patches as text file attachments to the mailing list?
>>>>> Thanks.  I will then be able to commit these patches individually,
>>>>> checking them in fine detail.
>>>>>
>>>>> Things to note in creating the patches from the code at
>>>>> http://maple.rsvs.ulaval.ca/mediawiki/index.php/Relax_development
>>>>> include the copyright preservation, a number of integers in
>>>>> 'maths_fns/consistency_tests.py' which should be floating point
>>>>> numbers (just add '.0' to the end of the number), the addition of
>>>>> Grace plots as an output in the 'sample_scripts/consistency_tests.py'
>>>>> script to be able to create a picture similar to that on your relax
>>>>> development site, maybe only allowing 'Tc' and 'tc' in the
>>>>> return_data_name() function and not 'TC', and 'degrees' instead of
>>>>> 'degree' in the return_units() function.
>>>>>
>>>>> One bug includes:
>>>>>
>>>>>              setattr(self.relax.data.res[self.run][index], 'csa',
>>>>> float(value[0]))
>>>>>              setattr(self.relax.data.res[self.run][index], 'r',
>>>>> float(value[1]))
>>>>> +            setattr(self.relax.data.res[self.run][index],
>>>>> 'orientation', float(value[1]))
>>>>> +            setattr(self.relax.data.res[self.run][index], 'tc',
>>>>> float(value[1]))
>>>>>
>>>>> value[1] has been used twice.  I have a feeling there is another bug
>>>>> somewhere where an index has been repeated a few times when it should
>>>>> be different indices, but I can't find it at the moment.  The
>>>>> individual patches should help.  Finally, I have a feeling that there
>>>>> is unused code which can be deleted as it is a relic from the copy of
>>>>> the J(w) mapping code and is not needed.  For the 1.3 line code I
>>>>> would recommend that identical functions are shifted into files such
>>>>> as 'specific_fns/base_class.py', but for the 1.2 line code I would
>>>>> prefer the duplication as this means that the current stable code
>>>>>           
>>> base
>>>       
>>>>> remains stable.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Edward
>>>>>
>>>>>
>>>>>
>>>>> On 6/26/07, Sebastien Morin <[EMAIL PROTECTED]> wrote:
>>>>>           
>>>>>> Hi,
>>>>>>
>>>>>> I started working on implementing the consistency tests last week
>>>>>>             
>>>>> before
>>>>>           
>>>>>> the last post was made and, hence, I worked on repository line 1.2
>>>>>> (revision 3303).
>>>>>>
>>>>>> I implemented the consistency tests as a new type of run ('ct')
>>>>>>             
>>>>> similar
>>>>>           
>>>>>> to the one for Jw mapping.
>>>>>>
>>>>>> The calculations are made for J(0), F_eta and F_R2 separately
>>>>>>             
>>> for each
>>>       
>>>>>> magnetic field (one at a time). The output results file is
>>>>>>             
>>> similar to
>>>       
>>>>>> the one for Jw mapping. The user then needs to plot them and
>>>>>>             
>>> look for
>>>       
>>>>>> consistency with its own criteria (calculation correlation
>>>>>> coefficients,  mean ratios and standard deviations, etc).
>>>>>>
>>>>>> Please look at the followinr URL for a listing of the
>>>>>>             
>>> modifications to
>>>       
>>>>>> old files and also necessary new files.
>>>>>>
>>>>>> http://maple.rsvs.ulaval.ca/mediawiki/index.php/Relax_development
>>>>>>
>>>>>> The file 'sample_scripts/consistency_tests.py' should be useful to
>>>>>> understand how the new procedure works.
>>>>>>
>>>>>> Even if this was done on repository line 1.2, I think it is
>>>>>>             
>>> quite fine
>>>       
>>>>>> since nothing was deleted but only things added (maybe too much,
>>>>>>             
>>> as I
>>>       
>>>>>> reproduced the Jw mapping approach, maybe too much as I added
>>>>>>             
>>> lines in
>>>       
>>>>>> the codes for grace, molmol, etc, maybe too much also since some
>>>>>>             
>>>>> code is
>>>>>           
>>>>>> duplicated from the Jw mapping code). The test-suite still works
>>>>>> perfectly and, so, I think it could be fine to add the tests to the
>>>>>>             
>>>>> 1.2
>>>>>           
>>>>>> line as well... However, if necessary, I could implement the
>>>>>>             
>>>>> consistency
>>>>>           
>>>>>> testing procedure on line 1.3, following your comments as I am
>>>>>>             
>>>>> quite new
>>>>>           
>>>>>> to Python and maybe made things somehow not perfectly...
>>>>>>
>>>>>> Please tell me what you think about this.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>>
>>>>>> Sébastien  :)
>>>>>>
>>>>>>
>>>>>>
>>>>>> Edward d'Auvergne wrote:
>>>>>>             
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have previously talked about data set consistency.  For example
>>>>>>>               
>>>>> see
>>>>>           
>>>>>>> the post at
>>>>>>>               
>>>>> https://mail.gna.org/public/relax-users/2007-06/msg00001.html
>>>>>           
>>>>>>> in which a few reasons for inconsistencies have been
>>>>>>>               
>>> explained.  I
>>>       
>>>>>>> have, from experience, noticed that small changes in protein
>>>>>>> concentration can change the collected relaxation rates
>>>>>>>               
>>>>> significantly
>>>>>           
>>>>>>> - most likely because of packing interactions.  All samples
>>>>>>>               
>>> should
>>>       
>>>>>>> essentially be identical in all respects for the relaxation
>>>>>>>               
>>> rates to
>>>       
>>>>>>> be compared.  And the temperate should always be fine tuned
>>>>>>>               
>>> between
>>>       
>>>>>>> experiments and spectrometers using methanol (and always checked
>>>>>>>               
>>>>> later
>>>>>           
>>>>>>> on if there is a large time between collecting the same
>>>>>>>               
>>> experiment).
>>>       
>>>>>>> Therefore these tests would be quite useful.  Data consistency is
>>>>>>> essential for the model-free results to be correct (as well as
>>>>>>>               
>>>>> reduced
>>>>>           
>>>>>>> spectral density mapping, SRLS, etc.) as this affects both the
>>>>>>> optimisation and model selection and can result in artificial
>>>>>>>               
>>>>> motions
>>>>>           
>>>>>>> appearing.  However I don't know how these test would
>>>>>>>               
>>> currently fit
>>>       
>>>>>>> within relax.  Maybe a new type of analysis should be created for
>>>>>>>               
>>>>> this
>>>>>           
>>>>>>> (see the pipe.create() user function in the 1.3 line or the
>>>>>>> run.create() user function in the 1.2 line).  These ideas
>>>>>>>               
>>> should all
>>>       
>>>>>>> go into the 1.3 line (via a branch) as the 1.2 line is stable
>>>>>>>               
>>> and no
>>>       
>>>>>>> new major features will be added to this code.  What are the
>>>>>>>               
>>>>> ideas you
>>>>>           
>>>>>>> have been playing with?
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Edward
>>>>>>>
>>>>>>>
>>>>>>> On 6/15/07, Sebastien Morin <[EMAIL PROTECTED]> wrote:
>>>>>>>               
>>>>>>>> Hi everyone
>>>>>>>>
>>>>>>>> During the last months, I was astonished to realize that some
>>>>>>>>                 
>>> spin
>>>       
>>>>>>>> relaxation data I had acquired at different fields were not
>>>>>>>>                 
>>>>> consistent
>>>>>           
>>>>>>>> between each other. The way I realized that was by seeing
>>>>>>>>                 
>>>>> discrepancy
>>>>>           
>>>>>>>> between J(0) values calculated with those different datasets.
>>>>>>>>
>>>>>>>> I looked a little bit in the litterature and found some
>>>>>>>>                 
>>> interesting
>>>       
>>>>>>>> consistency tests in a paper by Fushman (Fushman et al., JACS,
>>>>>>>>                 
>>>>> 1998,
>>>>>           
>>>>>>>> 120:10947-10952).
>>>>>>>>
>>>>>>>> This paper present 2 consistency tests to compare datasets from
>>>>>>>> different magnetic fields / samples / time / etc.
>>>>>>>>
>>>>>>>> I think it would be interesting to implement those simple tests
>>>>>>>>                 
>>>>> in relax
>>>>>           
>>>>>>>> so the user can, before trying to fit their data, know the
>>>>>>>>                 
>>>>> quality of
>>>>>           
>>>>>>>> those... Regrettably, very few people look at the consistency of
>>>>>>>>                 
>>>>> their
>>>>>           
>>>>>>>> datasets before analysis...
>>>>>>>>
>>>>>>>> The underlying principle is the same as when looking at
>>>>>>>>                 
>>>>> consistency for
>>>>>           
>>>>>>>> J(0). Thus, I think that those two tests and a J(0) test
>>>>>>>>                 
>>> should be
>>>       
>>>>>>>> implemented altogether...
>>>>>>>>
>>>>>>>> I'll try to work a bit on this. Mimicking the code for spectral
>>>>>>>>                 
>>>>> density
>>>>>           
>>>>>>>> should be a good starting point.
>>>>>>>>
>>>>>>>> Am I right ?
>>>>>>>> Do you see any value in those tests ?
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>>
>>>>>>>>
>>>>>>>> Sébastien  :)
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> relax (http://nmr-relax.com)
>>>>>>>>
>>>>>>>> This is the relax-devel mailing list
>>>>>>>> relax-devel@gna.org
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>>                 
>>>>>> --
>>>>>>          ______________________________________
>>>>>>      _______________________________________________
>>>>>>     |                                               |
>>>>>>    || Sebastien Morin                               ||
>>>>>>   ||| Etudiant au PhD en biochimie                  |||
>>>>>>  |||| Laboratoire de resonance magnetique nucleaire ||||
>>>>>> ||||| Dr Stephane Gagne                             |||||
>>>>>>  |||| CREFSIP (Universite Laval, Quebec, CANADA)    ||||
>>>>>>   ||| 1-418-656-2131 #4530                          |||
>>>>>>    ||                                               ||
>>>>>>     |_______________________________________________|
>>>>>>          ______________________________________
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>> -- 
>>>          ______________________________________
>>>      _______________________________________________
>>>     |                                               |
>>>    || Sebastien Morin                               ||
>>>   ||| Etudiant au PhD en biochimie                  |||
>>>  |||| Laboratoire de resonance magnetique nucleaire ||||
>>> ||||| Dr Stephane Gagne                             |||||
>>>  |||| CREFSIP (Universite Laval, Quebec, CANADA)    ||||
>>>   ||| 1-418-656-2131 #4530                          |||
>>>    ||                                               ||
>>>     |_______________________________________________|
>>>          ______________________________________
>>>
>>>
>>>
>>>       
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> relax (http://nmr-relax.com)
>
> This is the relax-devel mailing list
> relax-devel@gna.org
>
> 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

-- 
         ______________________________________    
     _______________________________________________
    |                                               |
   || Sebastien Morin                               ||
  ||| Etudiant au PhD en biochimie                  |||
 |||| Laboratoire de resonance magnetique nucleaire ||||
||||| Dr Stephane Gagne                             |||||
 |||| CREFSIP (Universite Laval, Quebec, CANADA)    ||||
  ||| 1-418-656-2131 #4530                          |||
   ||                                               ||
    |_______________________________________________|
         ______________________________________    

Index: maths_fns/consistency_tests.py
===================================================================
--- maths_fns/consistency_tests.py      (revision 3324)
+++ maths_fns/consistency_tests.py      (working copy)
@@ -1,6 +1,7 @@
 ###############################################################################
 #                                                                             #
 # Copyright (C) 2004 Edward d'Auvergne                                        #
+# Copyright (C) 2007 Sebastien Morin <sebastien.morin.1 at ulaval.ca>         #
 #                                                                             #
 # This file is part of the program relax.                                     #
 #                                                                             #
@@ -21,14 +22,14 @@
 ###############################################################################
 
 from Numeric import Float64, zeros
-from math import pi
+from math import pi, cos
 
 from ri_comps import calc_fixed_csa, calc_fixed_dip, comp_csa_const_func, 
comp_dip_const_func
 
 
-class Mapping:
+class Consistency:
     def __init__(self, frq=None, gx=None, gh=None, mu0=None, h_bar=None):
-        """Reduced spectral density mapping."""
+        """Consistency tests for data acquired at different magnetic fields."""
 
         # Initialise the data container.
         self.data = Data()
@@ -67,10 +68,10 @@
         return (noe - 1.0) * r1 * self.data.gx / self.data.gh
 
 
-    def func(self, r=None, csa=None, r1=None, r2=None, noe=None):
-        """Function for calculating the three spectal density values.
+    def func(self, orientation=None, tc=None, r=None, csa=None, r1=None, 
r2=None, noe=None):
+        """Function for calculating the three consistency testing values.
 
-        Three values are returned, J(0), J(wX), and J(wH) (or J(0.87wH)).
+        Three values are returned, J(0), F_eta and F_R2.
         """
 
         # Calculate the fixed component of the dipolar and CSA constants.
@@ -94,11 +95,23 @@
         # Calculate J(wX).
         jwx = 1.0 / (3.0*d + c) * (r1 - 1.4*sigma_noe)
 
-        # Calculate J(wH).
-        jwh = sigma_noe / (5.0*d)
+        # Calculate P_2.
+        p_2 = 0.5 * ((3.0 * (cos(orientation * pi / 180)) ** 2) -1)
 
+        # Calculate eta.
+        eta = ((d * c) ** 0.5) * (4.0 * j0 + 3.0 * jwx) * p_2
+
+        # Calculate F_eta.
+        f_eta = eta * self.data.gh / (self.data.frq_list[0, 3] * (4.0 + 3.0 / 
(1 + (self.data.frq_list[0, 1] * tc) ** 2)))
+
+        # Calculate P_HF.
+        p_hf = 1.3 * (self.data.gx / self.data.gh) * (1.0 - noe) * r1
+
+        # Calculate F_R2.
+        f_r2 = (r2 - p_hf) / ((4.0 + 3.0 / (1 + (self.data.frq_list[0, 1] * 
tc) ** 2)) * (d + c/3.0))
+
         # Return the three values.
-        return j0, jwx, jwh
+        return j0, f_eta, f_r2
 
 
 class Data:
_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
relax-devel@gna.org

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

Reply via email to