Author: bugman Date: Tue Apr 27 17:55:04 2010 New Revision: 11153 URL: http://svn.gna.org/viewcvs/relax?rev=11153&view=rev Log: Big bug fixes for the _minimise_setup_pcs() and _minimise_setup_rdcs() methods. This allows the missing data PCS and RDC optimisation system test to pass. Many problems were solved to allow all types of data with anything missing (one spin in one alignment, one spin in all RDC or all PCS lists, or entire RDC or PCS lists for one alignment). Modified: 1.3/specific_fns/n_state_model.py Modified: 1.3/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/1.3/specific_fns/n_state_model.py?rev=11153&r1=11152&r2=11153&view=diff ============================================================================== --- 1.3/specific_fns/n_state_model.py (original) +++ 1.3/specific_fns/n_state_model.py Tue Apr 27 17:55:04 2010 @@ -698,8 +698,8 @@ if not spin.select: continue - # Only use spins with PCS data. - if not hasattr(spin, 'pcs'): + # Only use spins with alignment data. + if not hasattr(spin, 'pcs') and not hasattr(spin, 'rdc'): continue # Add empty lists to the r and unit_vector lists. @@ -753,7 +753,8 @@ if hasattr(spin, 'rdc'): pcs[-1].append(None) pcs_err[-1].append(None) - pcs_const[-1].append(None) + pcs_const[-1].append([None]*cdp.N) + j = j + 1 # Jump to the next spin. continue @@ -903,7 +904,7 @@ if unit_vect[i] == None: unit_vect[i] = [[None, None, None]]*num - # The PCS data. + # The RDC data. for align_id in cdp.align_ids: # Append empty arrays to the RDC structures. rdc.append([]) @@ -925,8 +926,12 @@ # Jump to the next spin. continue + # Defaults of None. + value = None + error = None + # Pseudo-atom set up. - if hasattr(spin, 'members'): + if hasattr(spin, 'members') and align_id in spin.rdc.keys(): # Skip non-Me groups. if len(spin.members) != 3: continue @@ -934,24 +939,30 @@ # The RDC for the Me-pseudo spin where: # <D> = -1/3 Dpar. # See Verdier, et al., JMR, 2003, 163, 353-359. - rdc[-1].append(-3.0 * spin.rdc[align_id]) + value = -3.0 * spin.rdc[align_id] + + # The error. + if hasattr(spin, 'rdc_err') and align_id in spin.rdc_err.keys(): + error = -3.0 * spin.rdc_err[align_id] # Normal spin set up. - else: + elif align_id in spin.rdc.keys(): # The RDC. - rdc[-1].append(spin.rdc[align_id]) - - # Append the RDC errors (or a list of None). - if hasattr(spin, 'rdc_err'): - rdc_err[-1].append(spin.rdc_err[align_id]) - else: - rdc_err[-1].append(None) + value = spin.rdc[align_id] + + # The error. + if hasattr(spin, 'rdc_err') and align_id in spin.rdc_err.keys(): + error = spin.rdc_err[align_id] + + # Append the RDCs to the list. + rdc[-1].append(value) + + # Append the RDC errors. + rdc_err[-1].append(error) # Convert to numpy objects. rdc = array(rdc, float64) rdc_err = array(rdc_err, float64) - for i in range(len(unit_vect)): - print unit_vect[i] unit_vect = array(unit_vect, float64) rdc_const = array(rdc_const, float64)