[prev in list] [next in list] [prev in thread] [next in thread] 

List:       relax-devel
Subject:    Re: r5251 - /1.3/specific_fns/jw_mapping.py
From:       Sébastien_Morin <sebastien.morin.1 () domain ! hid>
Date:       2008-04-11 18:44:57
Message-ID: 47FFB1A9.8020202 () domain ! hid
[Download RAW message or body]

Hi Ed,

I just commited some changes as you told me in this mail (see below). 
The revision is 5594. Could you check if I clearly understood before I 
continue for the entire "specific_fns/jw_mapping.py" code.

Thanks !


Séb  :)



Edward d'Auvergne wrote:
> These functions are a little more complex to shift to the new design.
> The problem is that the structure 'cdp.res[instance]' does not exist.
> The way forwards with any of the specific functions which take the
> 'instance' argument is to replace this argument with the 'spin'
> argument.  Then the SpinContainer object will be passed into the
> function, the cdp will not need to be accessed, and only the necessary
> elements of the SpinContainer will be accessed or modified.  This will
> simplify the code in these functions.
> 
> Cheers,
> 
> Edward
> 
> 
> On Thu, Apr 3, 2008 at 4:47 AM,  <sebastien.morin.1@domain.hid> wrote:
> 
> > Author: semor
> > Date: Thu Apr  3 04:47:51 2008
> > New Revision: 5251
> > 
> > URL: http://svn.gna.org/viewcvs/relax?rev=5251&view=rev
> > Log:
> > Modified the overfit_deselect(), set_frq(), set_error(), sim_return_param() and \
> > sim_return_selected() functions from specific_fns.jw_mapping to the new design. 
> > 
> > Modified:
> > 1.3/specific_fns/jw_mapping.py
> > 
> > Modified: 1.3/specific_fns/jw_mapping.py
> > URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/jw_mapping.py?rev=5251&r1=5250&r2=5251&view=diff
> >  ==============================================================================
> > --- 1.3/specific_fns/jw_mapping.py (original)
> > +++ 1.3/specific_fns/jw_mapping.py Thu Apr  3 04:47:51 2008
> > @@ -238,12 +238,12 @@
> > return '1H'
> > 
> > 
> > -    def overfit_deselect(self, run):
> > +    def overfit_deselect(self):
> > """Function for deselecting residues without sufficient data to support \
> > calculation""" 
> > # Test the sequence data exists:
> > -        if not relax_data_store.res.has_key(run):
> > -            raise RelaxNoSequenceError, run
> > +        if not exists_mol_res_spin_data():
> > +            raise RelaxNoSequenceError
> > 
> > # Loop over residue data:
> > for residue in relax_data_store.res[run]:
> > @@ -374,83 +374,83 @@
> > __docformat__ = "plaintext"
> > 
> > 
> > -    def set_frq(self, run=None, frq=None):
> > +    def set_frq(self, frq=None):
> > """Function for selecting which relaxation data to use in the J(w) mapping."""
> > 
> > -        # Run argument.
> > -        self.run = run
> > +        # Alias the current data pipe.
> > +        cdp = relax_data_store[relax_data_store.current_pipe]
> > 
> > # Test if the run exists.
> > if not self.run in relax_data_store.run_names:
> > raise RelaxNoPipeError, self.run
> > 
> > # Test if the run type is set to 'jw'.
> > -        function_type = \
> > relax_data_store.run_types[relax_data_store.run_names.index(self.run)] +        \
> > function_type = relax_data_store.run_types[cdp.run_names.index] if function_type \
> > != 'jw': raise RelaxFuncSetupError, \
> > self.relax.specific_setup.get_string(function_type) 
> > # Test if the frequency has been set.
> > -        if hasattr(relax_data_store, 'jw_frq') and \
> >                 relax_data_store.jw_frq.has_key(self.run):
> > -            raise RelaxError, "The frequency for the run " + `self.run` + " has \
> > already been set." +        if hasattr(cdp, 'jw_frq'):
> > +            raise RelaxError, "The frequency for the run has already been set."
> > 
> > # Create the data structure if it doesn't exist.
> > -        if not hasattr(relax_data_store, 'jw_frq'):
> > -            relax_data_store.jw_frq = {}
> > +        if not hasattr(cdp, 'jw_frq'):
> > +           cdp.jw_frq = {}
> > 
> > # Set the frequency.
> > -        relax_data_store.jw_frq[self.run] = frq
> > -
> > -
> > -    def set_error(self, run, instance, index, error):
> > +        cdp.jw_frq = frq
> > +
> > +
> > +    def set_error(self, instance, spin, error):
> > """Function for setting parameter errors."""
> > 
> > -        # Arguments.
> > -        self.run = run
> > +        # Alias the current data pipe.
> > +        cdp = relax_data_store[relax_data_store.current_pipe]
> > 
> > # Return J(0) sim data.
> > if index == 0:
> > -            relax_data_store.res[self.run][instance].j0_err = error
> > +            cdp.res[instance].j0_err = error
> > 
> > # Return J(wX) sim data.
> > if index == 1:
> > -            relax_data_store.res[self.run][instance].jwx_err = error
> > +            cdp.res[instance].jwx_err = error
> > 
> > # Return J(wH) sim data.
> > if index == 2:
> > -            relax_data_store.res[self.run][instance].jwh_err = error
> > -
> > -
> > -    def sim_return_param(self, run, instance, index):
> > +            cdp.res[instance].jwh_err = error
> > +
> > +
> > +    def sim_return_param(self, instance, index):
> > """Function for returning the array of simulation parameter values."""
> > 
> > -        # Arguments.
> > -        self.run = run
> > +        # Alias the current data pipe.
> > +        cdp = relax_data_store[relax_data_store.current_pipe]
> > 
> > # Skip unselected residues.
> > -        if not relax_data_store.res[self.run][instance].select:
> > +        if not cdp.res[instance].select:
> > return
> > 
> > # Return J(0) sim data.
> > if index == 0:
> > -            return relax_data_store.res[self.run][instance].j0_sim
> > +            return cdp.res[instance].j0_sim
> > 
> > # Return J(wX) sim data.
> > if index == 1:
> > -            return relax_data_store.res[self.run][instance].jwx_sim
> > +            return cdp.res[instance].jwx_sim
> > 
> > # Return J(wH) sim data.
> > if index == 2:
> > -            return relax_data_store.res[self.run][instance].jwh_sim
> > +            return cdp.res[instance].jwh_sim
> > 
> > 
> > def sim_return_selected(self, run, instance):
> > """Function for returning the array of selected simulation flags."""
> > 
> > -        # Arguments.
> > -        self.run = run
> > +        # Alias the current data pipe.
> > +        cdp = relax_data_store[relax_data_store.current_pipe]
> > 
> > # Multiple instances.
> > -        return relax_data_store.res[self.run][instance].select_sim
> > +        return cdp.res[instance].select_sim
> > 
> > 
> > def set_selected_sim(self, run, instance, select_sim):
> > 
> > 
> > _______________________________________________
> > relax (http://nmr-relax.com)
> > 
> > This is the relax-commits mailing list
> > relax-commits@domain.hid
> > 
> > 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://nmr-relax.com)
> 
> This is the relax-devel mailing list
> relax-devel@domain.hid
> 
> 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
> 
> 


[Attachment #3 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Ed,<br>
<br>
I just commited some changes as you told me in this mail (see below).
The revision is 5594. Could you check if I clearly understood before I
continue for the entire "specific_fns/jw_mapping.py" code.<br>
<br>
Thanks !<br>
<br>
<br>
S&eacute;b&nbsp; :)<br>
<br>
<br>
<br>
Edward d'Auvergne wrote:
<blockquote
 cite="mid:7f080ed10804030909m3b540ee3y1d60009542c09694@domain.hid"
 type="cite">
  <pre wrap="">These functions are a little more complex to shift to the new design.
The problem is that the structure 'cdp.res[instance]' does not exist.
The way forwards with any of the specific functions which take the
'instance' argument is to replace this argument with the 'spin'
argument.  Then the SpinContainer object will be passed into the
function, the cdp will not need to be accessed, and only the necessary
elements of the SpinContainer will be accessed or modified.  This will
simplify the code in these functions.

Cheers,

Edward


On Thu, Apr 3, 2008 at 4:47 AM,  <a class="moz-txt-link-rfc2396E" \
href="mailto:sebastien.morin.1@domain.hid">&lt;sebastien.morin.1@domain.hid&gt;</a> \
wrote:  </pre>
  <blockquote type="cite">
    <pre wrap="">Author: semor
 Date: Thu Apr  3 04:47:51 2008
 New Revision: 5251

 URL: <a class="moz-txt-link-freetext" \
href="http://svn.gna.org/viewcvs/relax?rev=5251&view=rev">http://svn.gna.org/viewcvs/relax?rev=5251&amp;view=rev</a>
  Log:
 Modified the overfit_deselect(), set_frq(), set_error(), sim_return_param() and \
sim_return_selected() functions from specific_fns.jw_mapping to the new design.


 Modified:
    1.3/specific_fns/jw_mapping.py

 Modified: 1.3/specific_fns/jw_mapping.py
 URL: <a class="moz-txt-link-freetext" \
href="http://svn.gna.org/viewcvs/relax/1.3/specific_fns/jw_mapping.py?rev=5251&r1=5250 \
&r2=5251&view=diff">http://svn.gna.org/viewcvs/relax/1.3/specific_fns/jw_mapping.py?rev=5251&amp;r1=5250&amp;r2=5251&amp;view=diff</a>
  ==============================================================================
 --- 1.3/specific_fns/jw_mapping.py (original)
 +++ 1.3/specific_fns/jw_mapping.py Thu Apr  3 04:47:51 2008
 @@ -238,12 +238,12 @@
             return '1H'


 -    def overfit_deselect(self, run):
 +    def overfit_deselect(self):
         """Function for deselecting residues without sufficient data to support \
calculation"""

         # Test the sequence data exists:
 -        if not relax_data_store.res.has_key(run):
 -            raise RelaxNoSequenceError, run
 +        if not exists_mol_res_spin_data():
 +            raise RelaxNoSequenceError

         # Loop over residue data:
         for residue in relax_data_store.res[run]:
 @@ -374,83 +374,83 @@
         __docformat__ = "plaintext"


 -    def set_frq(self, run=None, frq=None):
 +    def set_frq(self, frq=None):
         """Function for selecting which relaxation data to use in the J(w) \
mapping."""

 -        # Run argument.
 -        self.run = run
 +        # Alias the current data pipe.
 +        cdp = relax_data_store[relax_data_store.current_pipe]

         # Test if the run exists.
         if not self.run in relax_data_store.run_names:
             raise RelaxNoPipeError, self.run

         # Test if the run type is set to 'jw'.
 -        function_type = \
relax_data_store.run_types[relax_data_store.run_names.index(self.run)]  +        \
function_type = relax_data_store.run_types[cdp.run_names.index]  if function_type != \
                'jw':
             raise RelaxFuncSetupError, \
self.relax.specific_setup.get_string(function_type)

         # Test if the frequency has been set.
 -        if hasattr(relax_data_store, 'jw_frq') and \
                relax_data_store.jw_frq.has_key(self.run):
 -            raise RelaxError, "The frequency for the run " + `self.run` + " has \
already been set."  +        if hasattr(cdp, 'jw_frq'):
 +            raise RelaxError, "The frequency for the run has already been set."

         # Create the data structure if it doesn't exist.
 -        if not hasattr(relax_data_store, 'jw_frq'):
 -            relax_data_store.jw_frq = {}
 +        if not hasattr(cdp, 'jw_frq'):
 +           cdp.jw_frq = {}

         # Set the frequency.
 -        relax_data_store.jw_frq[self.run] = frq
 -
 -
 -    def set_error(self, run, instance, index, error):
 +        cdp.jw_frq = frq
 +
 +
 +    def set_error(self, instance, spin, error):
         """Function for setting parameter errors."""

 -        # Arguments.
 -        self.run = run
 +        # Alias the current data pipe.
 +        cdp = relax_data_store[relax_data_store.current_pipe]

         # Return J(0) sim data.
         if index == 0:
 -            relax_data_store.res[self.run][instance].j0_err = error
 +            cdp.res[instance].j0_err = error

         # Return J(wX) sim data.
         if index == 1:
 -            relax_data_store.res[self.run][instance].jwx_err = error
 +            cdp.res[instance].jwx_err = error

         # Return J(wH) sim data.
         if index == 2:
 -            relax_data_store.res[self.run][instance].jwh_err = error
 -
 -
 -    def sim_return_param(self, run, instance, index):
 +            cdp.res[instance].jwh_err = error
 +
 +
 +    def sim_return_param(self, instance, index):
         """Function for returning the array of simulation parameter values."""

 -        # Arguments.
 -        self.run = run
 +        # Alias the current data pipe.
 +        cdp = relax_data_store[relax_data_store.current_pipe]

         # Skip unselected residues.
 -        if not relax_data_store.res[self.run][instance].select:
 +        if not cdp.res[instance].select:
                 return

         # Return J(0) sim data.
         if index == 0:
 -            return relax_data_store.res[self.run][instance].j0_sim
 +            return cdp.res[instance].j0_sim

         # Return J(wX) sim data.
         if index == 1:
 -            return relax_data_store.res[self.run][instance].jwx_sim
 +            return cdp.res[instance].jwx_sim

         # Return J(wH) sim data.
         if index == 2:
 -            return relax_data_store.res[self.run][instance].jwh_sim
 +            return cdp.res[instance].jwh_sim


     def sim_return_selected(self, run, instance):
         """Function for returning the array of selected simulation flags."""

 -        # Arguments.
 -        self.run = run
 +        # Alias the current data pipe.
 +        cdp = relax_data_store[relax_data_store.current_pipe]

         # Multiple instances.
 -        return relax_data_store.res[self.run][instance].select_sim
 +        return cdp.res[instance].select_sim


     def set_selected_sim(self, run, instance, select_sim):


 _______________________________________________
 relax (<a class="moz-txt-link-freetext" \
href="http://nmr-relax.com">http://nmr-relax.com</a>)

 This is the relax-commits mailing list
 <a class="moz-txt-link-abbreviated" \
href="mailto:relax-commits@domain.hid">relax-commits@domain.hid</a>

 To unsubscribe from this list, get a password
 reminder, or change your subscription options,
 visit the list information page at
 <a class="moz-txt-link-freetext" \
href="https://mail.gna.org/listinfo/relax-commits">https://mail.gna.org/listinfo/relax-commits</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
relax (<a class="moz-txt-link-freetext" \
href="http://nmr-relax.com">http://nmr-relax.com</a>)

This is the relax-devel mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:relax-devel@domain.hid">relax-devel@domain.hid</a>

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
<a class="moz-txt-link-freetext" \
href="https://mail.gna.org/listinfo/relax-devel">https://mail.gna.org/listinfo/relax-devel</a>


  </pre>
</blockquote>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic