mailRe: [bug #22017] LinAlgError, for all numerical CPMG models.


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

Header


Content

Posted by Edward d'Auvergne on May 12, 2014 - 09:16:
Hi,

This bug has something to do with setting metadata for spectral
information from two field strengths, but only loading data from one.
In such a case, you will need to very carefully check the data that
the user has input, and complain hard with a RelaxError if something
is wrong.  See specific_analyses.relax_disp.checks for inspiration.
Maybe the checking function is already there, otherwise you'll need to
add it.  This checking is important to avoid user confusion.  The
short RelaxError should tell the user the exact problem, and maybe
suggest a solution.  This is better than seeing a huge traceback with
a "LinAlgError: Array must not contain infs or NaNs" error.

The check with RelaxError is a better solution than handling the
missing data.  It is easier for a user to fix a script after a
RelaxError, than for a user to look back at the log and notice that
they forgot to load some important data.

Regards,

Edward

On 9 May 2014 10:39, Troels E. Linnet <NO-REPLY.INVALID-ADDRESS@xxxxxxx> 
wrote:
Follow-up Comment #2, bug #22017 (project relax):

It is somewhere in:

def return_r2eff_arrays(spins=None, spin_ids=None, fields=None,
field_count=None, sim_index=None):

/specific_analyses/relax_disp/data.py

The looping over time points is misbehaving.

Under the looping:
for exp_type, frq, offset, point, ei, mi, oi, di in
loop_exp_frq_offset_point(return_indices=True)


-------------------------
        # Loop over the R2eff data.
        for exp_type, frq, offset, point, ei, mi, oi, di in
loop_exp_frq_offset_point(return_indices=True):

            # Alias the correct spin.
            current_spin = spin
            if exp_type in [EXP_TYPE_CPMG_PROTON_SQ,
EXP_TYPE_CPMG_PROTON_MQ]:
                current_spin = proton

            # Add the experiment type.
            if exp_type not in exp_types:
                exp_types.append(exp_type)

            # The key.
            key = return_param_key_from_data(exp_type=exp_type, frq=frq,
offset=offset, point=point)
            if mi == 0:
                fact = 60.83831274541046
            else:
                fact = 81.11775032721394

            # The Larmor frequency for this spin (and that of an attached
proton for the MMQ models) and field strength (in MHz*2pi to speed up the 
ppm
to rad/s conversion).
            if frq != None:
                frqs[ei][si][mi] = 2.0 * pi * frq / g1H *
return_gyromagnetic_ratio(spin.isotope) * 1e-6
                frqs_H[ei][si][mi] = 2.0 * pi * frq * 1e-6

            # Missing data.
            if key not in current_spin.r2eff.keys():
                values[ei][si][mi][oi].append(0.0)
                errors[ei][si][mi][oi].append(1.0)
                missing[ei][si][mi][oi].append(1)
                continue
            else:
                missing[ei][si][mi][oi].append(0)

            # The values.
            if sim_index == None:
                values[ei][si][mi][oi].append(current_spin.r2eff[key])
            else:

values[ei][si][mi][oi].append(current_spin.r2eff_sim[sim_index][key])

            # The errors.
            errors[ei][si][mi][oi].append(current_spin.r2eff_err[key])

            # The relaxation times.
            for id in cdp.spectrum_ids:
                # Non-matching data.
                if cdp.spectrometer_frq[id] != frq:
                    continue
                if cdp.exp_type[id] != exp_type:
                    continue
                if exp_type in EXP_TYPE_LIST_CPMG:
                    if id not in cdp.cpmg_frqs.keys() or cdp.cpmg_frqs[id] 
!=
point:
                        continue
                else:
                    if id not in cdp.spin_lock_nu1.keys() or
cdp.spin_lock_nu1[id] != point:
                        continue

                # Found.
                relax_time = cdp.relax_times[id]
                break

            # Check the value if already set.
            if relax_times[ei][mi] != None:
                if relax_times[ei][mi] != relax_time:
                    raise RelaxError("The relaxation times do not match for
all experiments.")
                continue

            # Store the time.
            relax_times[ei][mi] = relax_time

        # Increment the spin index.
        si += 1

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?22017>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
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 Thu May 15 15:00:16 2014