mailRe: r23813 - /branches/disp_spin_speed/target_functions/relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on June 11, 2014 - 09:17:
Hi Troels,

If you construct the dw_mask structure here, you will need to include
the ei index, replacing:

                        self.dw_mask[si, :, si, mi] = self.frqs[ei][si][mi]

with:

                        self.dw_mask[si, ei, si, mi] = self.frqs[ei][si][mi]

It also seems strange to use a list for the numpy.zeros() function,
but it seems to work anyway.  For safety though, in case older or
future versions do not support a list argument, maybe you could use
the Python tuple() function to convert to the correct argument form.
One last suggestion, as I made in my second code example at
http://thread.gmane.org/gmane.science.nmr.relax.devel/6135/focus=6157,
is that self.dw_temp can be created instead as:

            self.dw_temp = zeros(self.numpy_array_shape, float64)

Then it doesn't use the [si] index in the target function.  This makes
this temporary storage smaller.

Cheers,

Edward



On 11 June 2014 08:28,  <tlinnet@xxxxxxxxxxxxx> wrote:
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.


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Wed Jun 11 09:40:12 2014