Author: tlinnet Date: Wed Jun 11 08:28:25 2014 New Revision: 23813 URL: http://svn.gna.org/viewcvs/relax?rev=23813&view=rev Log: Made iinitialisation structures for dw. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/target_functions/relax_disp.py Modified: branches/disp_spin_speed/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=23813&r1=23812&r2=23813&view=diff ============================================================================== --- branches/disp_spin_speed/target_functions/relax_disp.py (original) +++ branches/disp_spin_speed/target_functions/relax_disp.py Wed Jun 11 08:28:25 2014 @@ -408,6 +408,13 @@ # Define the shape of all the numpy arrays. self.numpy_array_shape = back_calc_shape + [self.max_num_disp_points] + # Set the dimensions to paramater. + self.ei = self.numpy_array_shape[0] + self.si = self.numpy_array_shape[1] + self.mi = self.numpy_array_shape[2] + self.oi = self.numpy_array_shape[3] + self.di = self.numpy_array_shape[4] + # Create zero and one numpy structure. zeros_a = zeros(self.numpy_array_shape, float64) ones_a = ones(self.numpy_array_shape, float64) @@ -427,12 +434,25 @@ self.disp_struct = deepcopy(zeros_a) self.has_missing = False + # Create special numpy structures. + # Structure of dw. + self.dw_struct = deepcopy(zeros_a) + + # Temporary storage to avoid memory allocations and garbage collection. + self.dw_temp = zeros([self.si] + self.numpy_array_shape, float64) + + # The structure for multiplication with dw to piecewise build up the full dw structure. + self.dw_mask = deepcopy(self.dw_temp) + # Loop over the experiment types. for ei in range(self.num_exp): # Loop over the spins. for si in range(self.num_spins): # Loop over the spectrometer frequencies. for mi in range(self.num_frq): + # Fill dw_mask with frequencies. + self.dw_mask[si, :, si, mi] = self.frqs[ei][si][mi] + # Loop over the offsets. for oi in range(self.num_offsets[ei][si][mi]): # Extract number of dispersion points.