Author: bugman Date: Thu Jan 24 11:05:38 2013 New Revision: 18292 URL: http://svn.gna.org/viewcvs/relax?rev=18292&view=rev Log: Fixes for the N-state model return_data() method. Modified: trunk/specific_fns/n_state_model.py Modified: trunk/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/trunk/specific_fns/n_state_model.py?rev=18292&r1=18291&r2=18292&view=diff ============================================================================== --- trunk/specific_fns/n_state_model.py (original) +++ trunk/specific_fns/n_state_model.py Thu Jan 24 11:05:38 2013 @@ -2353,7 +2353,7 @@ @keyword data_id: The list of spin ID, data type, and alignment ID, as yielded by the base_data_loop() generator method. @type data_id: list of str @return: The base data. - @rtype: float + @rtype: list of (float or None) """ # Alias the spin or interatomic data container, data type and alignment ID. @@ -2361,17 +2361,33 @@ data_type = data_id[1] align_id = data_id[2] + # The data structure to return. + data = [] + + # Skip deselected spins. + if data_id[1] == 'pcs' and not container.select: + return + # Return the RDC data. - if data_type == 'rdc' and hasattr(container, 'rdc') and align_id in container.rdc: - return container.rdc[align_id] + if data_type == 'rdc' and hasattr(container, 'rdc'): + if align_id not in container.rdc: + data.append(None) + else: + data.append(container.rdc[align_id]) # Return the NOESY data. - if data_type == 'noesy' and hasattr(container, 'noesy'): - return container.noesy + elif data_type == 'noesy' and hasattr(container, 'noesy'): + data.append(container.noesy) # Return the PCS data. - if data_id[1] == 'pcs' and hasattr(container, 'pcs') and align_id in container.pcs: - return container.pcs[align_id] + elif data_id[1] == 'pcs' and hasattr(container, 'pcs'): + if align_id not in container.pcs: + data.append(None) + else: + data.append(container.pcs[align_id]) + + # Return the data. + return data return_data_name_doc = Desc_container("N-state model data type string matching patterns")