Hi Troels,

It'd be good to add an empty line before the comment (for the
whitespace conventions in relax,
http://www.nmr-relax.com/manual/Whitespace.html).  You can also speed
this up by removing a test.  The line

+                        elif index != None and mi == index:

Can be changed to:

+                        elif mi == index:

The index must not equal None at this point, otherwise it would be in
the first part of the if-else statement.  So the "index != None" check
is unnecessary.

Regards,

Edward


On 25 April 2014 15:38,  <[email protected]> wrote:
> Author: tlinnet
> Date: Fri Apr 25 15:38:06 2014
> New Revision: 22856
>
> URL: http://svn.gna.org/viewcvs/relax?rev=22856&view=rev
> Log:
> Extended api value.set to use index in value setting.
>
> Feature request: #3151, (https://gna.org/support/index.php?3151) - User 
> function to set the R20 parameters in the default grid search using the 
> minimum R2eff value.
>
> The index used is expected to match the spectrometer frequency.
>
> 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=22856&r1=22855&r2=22856&view=diff
> ==============================================================================
> --- trunk/specific_analyses/relax_disp/api.py   (original)
> +++ trunk/specific_analyses/relax_disp/api.py   Fri Apr 25 15:38:06 2014
> @@ -874,7 +874,7 @@
>          @type param:        list of str
>          @keyword value:     The parameter value list.
>          @type value:        list
> -        @keyword index:     The index for parameters which are of the 
> list-type.  This is unused.
> +        @keyword index:     The index for parameters which are of the 
> list-type.
>          @type index:        None or int
>          @keyword spin_id:   The spin identification string, only used for 
> spin specific parameters.
>          @type spin_id:      None or str
> @@ -908,7 +908,7 @@
>                  # Handle the R20 parameters.
>                  if param[i] in PARAMS_R20:
>                      # Loop over the current keys.
> -                    for exp_type, frq in loop_exp_frq():
> +                    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)
>
> @@ -917,8 +917,13 @@
>                              setattr(spin, obj_name, {})
>
>                          # Set the value.
> -                        obj = getattr(spin, obj_name)
> -                        obj[key] = value[i]
> +                        if index == None:
> +                            obj = getattr(spin, obj_name)
> +                            obj[key] = value[i]
> +                        # If the index is specified, let it mathc the 
> frequency index
> +                        elif index != None and mi == index:
> +                            obj = getattr(spin, obj_name)
> +                            obj[key] = value[i]
>
>                  # Handle the R2eff and I0 parameters.
>                  elif param[i] in ['r2eff', 'i0'] and not 
> isinstance(value[i], dict):
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-commits mailing list
> [email protected]
>
> 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
[email protected]

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