Author: bugman Date: Tue Mar 5 14:02:02 2013 New Revision: 18636 URL: http://svn.gna.org/viewcvs/relax?rev=18636&view=rev Log: Removed the remaining residual, slow frame order multi-processor code from the target functions. Modified: branches/frame_order_testing/maths_fns/frame_order/__init__.py Modified: branches/frame_order_testing/maths_fns/frame_order/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/maths_fns/frame_order/__init__.py?rev=18636&r1=18635&r2=18636&view=diff ============================================================================== --- branches/frame_order_testing/maths_fns/frame_order/__init__.py (original) +++ branches/frame_order_testing/maths_fns/frame_order/__init__.py Tue Mar 5 14:02:02 2013 @@ -302,7 +302,7 @@ self.drdc_theta = zeros((self.total_num_params, self.num_align, self.num_interatom), float64) self.d2rdc_theta = zeros((self.total_num_params, self.total_num_params, self.num_align, self.num_interatom), float64) - # The quasi-random integration via the multi-processor. + # The quasi-random integration. if not quad_int and self.pcs_flag_sum and model not in ['rigid']: # The Sobol' sequence data and target function aliases (quasi-random integration). if model == 'pseudo-ellipse': @@ -1418,49 +1418,10 @@ # Calculate and sum the single alignment chi-squared value (for the RDC). chi2_sum = chi2_sum + chi2(self.rdc[align_index], self.rdc_theta[align_index], self.rdc_error[align_index]) - # PCS via Monte Carlo integration. + # PCS via numerical integration. if self.pcs_flag_sum: - # Clear the data structures. - for i in range(len(self.pcs_theta)): - for j in range(len(self.pcs_theta[i])): - self.pcs_theta[i, j] = 0.0 - self.pcs_theta_err[i, j] = 0.0 - - # Initialise the data object for the slave results to be stored in. - data = Data() - data.num_pts = 0 - data.pcs_theta = self.pcs_theta - - # Subdivide the points. - for i in range(self.processor.processor_size()): - # Initialise the slave command and memo. - self.slaves[i].load_data(theta_x=cone_theta_x, theta_y=cone_theta_x, sigma_max=pi, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, R_eigen=self.R_eigen, RT_eigen=RT_eigen) - - # Update certain data structures. - if self.pivot_opt: - self.slaves[i].r_ln_pivot = self.r_ln_pivot - - # Initialise the memo. - memo = Memo_pcs_pseudo_ellipse_qrint(data) - - # Queue the block. - self.processor.add_to_queue(self.slaves[i], memo) - - # Wait for completion. - self.processor.run_queue() - - # Calculate the PCS and error. - num = data.num_pts - for i in range(len(self.pcs_theta)): - for j in range(len(self.pcs_theta[i])): - # The average PCS. - self.pcs_theta[i, j] = self.pcs_const[i] * self.pcs_theta[i, j] / float(num) - - # The error. - error_flag = False - if error_flag: - self.pcs_theta_err[i, j] = abs(self.pcs_theta_err[i, j] / float(num) - self.pcs_theta[i, j]**2) / float(num) - self.pcs_theta_err[i, j] = c[i] * sqrt(self.pcs_theta_err[i, j]) + # Numerical integration of the PCSs. + pcs_numeric_int_pseudo_ellipse_qrint(points=self.sobol_angles, theta_x=cone_theta_x, theta_y=cone_theta_y, sigma_max=pi, c=self.pcs_const, full_in_ref_frame=self.full_in_ref_frame, r_pivot_atom=self.r_pivot_atom, r_pivot_atom_rev=self.r_pivot_atom_rev, r_ln_pivot=self.r_ln_pivot, A=self.A_3D, R_eigen=self.R_eigen, RT_eigen=RT_eigen, Ri_prime=self.Ri_prime, pcs_theta=self.pcs_theta, pcs_theta_err=self.pcs_theta_err, missing_pcs=self.missing_pcs, error_flag=False) # Calculate and sum the single alignment chi-squared value (for the PCS). for align_index in range(self.num_align): @@ -1998,34 +1959,3 @@ # Convert the tensor back to 5D, rank-1 form, as the back-calculated reduced tensor. to_5D(self.A_5D_bc[index1:index2], self.A_3D_bc[align_index]) - - - def subdivide(self, points, processors): - """Split the points up into a number of blocks based on the number of processors. - - @param points: The integration points to split up. - @type points: numpy rank-2, 3D array - @param processors: The number of slave processors. - @type processors: int - """ - - # Uni-processor mode, so no need to split. - if processors == 1: - yield points - - # Multi-processor mode. - else: - # The number of points. - N = len(points) - - # The number of points per block (rounding up when needed so that there are no accidentally left out points). - block_size = int(ceil(N / float(processors))) - - # Loop over the blocks. - for i in range(processors): - # The indices. - index1 = i*block_size - index2 = (i+1)*block_size - - # Yield the next block. - yield points[index1:index2]