Author: bugman Date: Wed Nov 20 20:05:52 2013 New Revision: 21562 URL: http://svn.gna.org/viewcvs/relax?rev=21562&view=rev Log: Bug fixes for the model_loop() method no longer skipping deselected spins. This is needed for model selection when the spins from all data pipes are deselected. Modified: branches/relax_disp/specific_analyses/relax_disp/api.py branches/relax_disp/specific_analyses/relax_disp/disp_data.py branches/relax_disp/specific_analyses/relax_disp/parameters.py Modified: branches/relax_disp/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/api.py?rev=21562&r1=21561&r2=21562&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/api.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/api.py Wed Nov 20 20:05:52 2013 @@ -1069,11 +1069,19 @@ # The number of points from all spins. n = 0 for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + n += len(spin.r2eff) # Take the chi-squared from the first spin of the cluster (which has a value). chi2 = None for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + if hasattr(spin, 'chi2'): chi2 = spin.chi2 break Modified: branches/relax_disp/specific_analyses/relax_disp/disp_data.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/disp_data.py?rev=21562&r1=21561&r2=21562&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/disp_data.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/disp_data.py Wed Nov 20 20:05:52 2013 @@ -609,7 +609,7 @@ if not hasattr(cdp, 'clustering'): for spin, spin_id in spin_loop(return_id=True, skip_desel=skip_desel): # Skip protons for MMQ data. - if spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': + if hasattr(spin, 'model') and spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': continue # Return the spin ID as a list. @@ -632,7 +632,7 @@ continue # Skip protons for MMQ data. - if spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': + if hasattr(spin, 'model') and spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': continue # Add the spin ID. @@ -649,7 +649,7 @@ continue # Skip protons for MMQ data. - if spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': + if hasattr(spin, 'model') and spin.model in MODEL_LIST_MMQ and spin.isotope == '1H': continue # Yield each spin individually. Modified: branches/relax_disp/specific_analyses/relax_disp/parameters.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/parameters.py?rev=21562&r1=21561&r2=21562&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Wed Nov 20 20:05:52 2013 @@ -778,12 +778,20 @@ # Check the spin cluster. for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + if len(spin.params) != len(spins[0].params): raise RelaxError("The number of parameters for each spin in the cluster are not the same.") # Count the number of R20 parameters. r20_params = ['r2', 'r2a', 'r2b'] for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + for i in range(len(spin.params)): if spin.params[i] in r20_params: for exp_type, frq in loop_exp_frq(): @@ -792,15 +800,25 @@ # Count the number of spin specific parameters for all spins. spin_params = ['phi_ex', 'phi_ex_B', 'phi_ex_C', 'padw2', 'dw', 'dwH'] for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + for i in range(len(spin.params)): if spin.params[i] in spin_params: num += 1 # Count all other parameters, but only for a single spin. all_params = r20_params + spin_params - for i in range(len(spins[0].params)): - if not spins[0].params[i] in all_params: - num += 1 + for spin in spins: + # Skip deselected spins. + if not spin.select: + continue + + for i in range(len(spin.params)): + if not spin.params[i] in all_params: + num += 1 + break # Return the number. return num