Author: bugman Date: Wed Oct 5 22:12:48 2011 New Revision: 14802 URL: http://svn.gna.org/viewcvs/relax?rev=14802&view=rev Log: Fix for bug #18790 - the negative relaxation data errors. The cause of this is unknown, as similar data is already checked in the test suite. Now the relaxation data is not looked at if it or its error is None. This type of data worked perfectly before! A very strange bug! Modified: 1.3/specific_fns/model_free/mf_minimise.py Modified: 1.3/specific_fns/model_free/mf_minimise.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/model_free/mf_minimise.py?rev=14802&r1=14801&r2=14802&view=diff ============================================================================== --- 1.3/specific_fns/model_free/mf_minimise.py (original) +++ 1.3/specific_fns/model_free/mf_minimise.py Wed Oct 5 22:12:48 2011 @@ -1059,13 +1059,16 @@ if not hasattr(spin, 'ri_data') or not hasattr(spin, 'ri_data_err'): continue - # The relaxation data. + # Make sure that the errors are strictly positive numbers. for ri_id in cdp.ri_ids: - # Make sure that the errors are strictly positive numbers. - if spin.ri_data_err[ri_id] == 0.0: - raise RelaxError("Zero error for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (data_store.spin_id, ri_id)) - elif spin.ri_data_err[ri_id] < 0.0: - raise RelaxError("Negative error of %s for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (spin.ri_data_err[ri_id], data_store.spin_id, ri_id)) + # Alias. + err = spin.ri_data_err[ri_id] + + # Checks. + if err != None and err == 0.0: + raise RelaxError("Zero error for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (errid)) + elif err != None and err < 0.0: + raise RelaxError("Negative error of %s for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (err, data_store.spin_id, ri_id)) # The relaxation data optimisation structures. data = self._relax_data_opt_structs(spin, sim_index=sim_index) @@ -1162,12 +1165,20 @@ for ri_id in cdp.ri_ids: # The Rx data. if sim_index == None: - ri_data.append(spin.ri_data[ri_id]) - else: - ri_data.append(spin.ri_data_sim[ri_id][sim_index]) + data = spin.ri_data[ri_id] + else: + data = spin.ri_data_sim[ri_id][sim_index] # The errors. - ri_data_err.append(spin.ri_data_err[ri_id]) + err = spin.ri_data_err[ri_id] + + # Missing data, so don't add it. + if data == None or err == None: + continue + + # Append the data and error. + ri_data.append(data) + ri_data_err.append(err) # The labels. ri_labels.append(cdp.ri_type[ri_id]) @@ -1183,7 +1194,7 @@ noe_r1_table.append(None) # The number of data sets. - num_ri = len(cdp.ri_ids) + num_ri = len(ri_data) # Fill the NOE to R1 mapping table. for i in range(num_ri): @@ -1250,7 +1261,7 @@ raise RelaxNoPdbError # Loop over the spins. - for spin in spin_loop(spin_id): + for spin, id in spin_loop(spin_id, return_id=True): # Skip deselected spins. if not spin.select: continue @@ -1290,10 +1301,14 @@ # Make sure that the errors are strictly positive numbers. for ri_id in cdp.ri_ids: - if spin.ri_data_err[ri_id] == 0.0: - raise RelaxError("Zero error for spin '" + repr(spin.num) + " " + spin.name + "', calculation not possible.") - elif spin.ri_data_err[ri_id] < 0.0: - raise RelaxError("Negative error for spin '" + repr(spin.num) + " " + spin.name + "', calculation not possible.") + # Alias. + err = spin.ri_data_err[ri_id] + + # Checks. + if err != None and err == 0.0: + raise RelaxError("Zero error for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (id, ri_id)) + elif err != None and err < 0.0: + raise RelaxError("Negative error of %s for spin '%s' for the relaxation data ID '%s', minimisation not possible." % (err, id, ri_id)) # Create the initial parameter vector. param_vector = self._assemble_param_vector(spin=spin, sim_index=sim_index)