Hi,

I haven't seen HBO's "Silicon Valley" yet.  But you should soon reach
tip-to-tip efficiency with both relax and your Python programming
skills.  Anyway, I'm thinking that the numpy version minimal number
will need to be increased to 1.6.2.  This really depends on how much
users complain though.  Most stay reasonably up to date so that the
current 1.0.4 at http://www.nmr-relax.com/download.html is never
encountered anyway.  The test suite should pull out the relax users
with too old versions.  I am also using lib.compat for some of these
version issues, as there is always a less efficient way of performing
the operation using an older numpy version.  Do you have any opinions
for the minimum version number?  Which versions do you have installed
on your various systems?

Regards,

Edward



On 10 June 2014 17:40, Troels Emtekær Linnet <[email protected]> wrote:
> Hi Ed.
>
> I worry about, if I use some numpy things, which is of to high a version?
> What is the "relax" limit on this?
>
> Best
> Troels
>
>
> 2014-06-10 17:27 GMT+02:00 Troels Emtekær Linnet <[email protected]>:
>> I have learned SO much these days!!!
>>
>> Class programming.
>> How numpy arrays work together, and broadcasts.
>> How to profile and make efficiency.
>>
>> I feel like in HBO "Silicon Valley":
>> http://en.wikipedia.org/wiki/Silicon_Valley_%28TV_series%29
>>
>> Episode 8, "Optimal Tip-to-Tip Efficiency", is exactly what is
>> happening right now. :-)
>>
>> best
>> Troels
>>
>> 2014-06-10 17:04 GMT+02:00 Edward d'Auvergne <[email protected]>:
>>> Hi Troels,
>>>
>>> Is it possible to shift the mask_replace part into __init__()?  That
>>> might give more speed ups.  I'm not so familiar with numpy masks, so I
>>> couldn't have helped you with that.  Anyway, those 4 hours invested is
>>> guaranteed to save you much more than 4 hours when you use this later.
>>>
>>> Regards,
>>>
>>> Edward
>>>
>>>
>>>
>>> On 10 June 2014 16:51,  <[email protected]> wrote:
>>>> Author: tlinnet
>>>> Date: Tue Jun 10 16:51:33 2014
>>>> New Revision: 23788
>>>>
>>>> URL: http://svn.gna.org/viewcvs/relax?rev=23788&view=rev
>>>> Log:
>>>> Implemented a masked array search for where "missing" array is equal 1.
>>>>
>>>> This makes it possible to replace all values with this mask, from the 
>>>> value array.
>>>>
>>>> This eliminates the last loops over the missing values.
>>>>
>>>> It took over 4 hours to figure out, that the mask should be called with 
>>>> mask.mask,
>>>> to return the same fulls structure,
>>>>
>>>> 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=23788&r1=23787&r2=23788&view=diff
>>>> ==============================================================================
>>>> --- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
>>>> +++ branches/disp_spin_speed/target_functions/relax_disp.py     Tue Jun 10 
>>>> 16:51:33 2014
>>>> @@ -29,6 +29,7 @@
>>>>  from math import pi
>>>>  from numpy import array, asarray, complex64, dot, float64, int16, max, 
>>>> ones, sqrt, sum, zeros
>>>>  import numpy as np
>>>> +from numpy.ma import masked_equal
>>>>
>>>>  # relax module imports.
>>>>  from lib.dispersion.b14 import r2eff_B14
>>>> @@ -418,6 +419,7 @@
>>>>              # The number of disp point can change per spectrometer, so we 
>>>> make the maximum size.
>>>>              self.values_a = deepcopy(self.zeros_a)
>>>>              self.errors_a = deepcopy(self.ones_a)
>>>> +            self.missing_a = zeros(self.numpy_array_shape)
>>>>
>>>>              self.cpmg_frqs_a = deepcopy(self.ones_a)
>>>>              self.num_disp_points_a = deepcopy(self.zeros_a)
>>>> @@ -456,6 +458,7 @@
>>>>                              for di in 
>>>> range(self.num_disp_points[ei][si][mi][oi]):
>>>>                                  if self.missing[ei][si][mi][oi][di]:
>>>>                                      self.has_missing = True
>>>> +                                    self.missing_a[ei][si][mi][oi][di] = 
>>>> 1.0
>>>>
>>>>              # Make copy of values structure.
>>>>              self.back_calc_a = deepcopy(self.values_a)
>>>> @@ -574,15 +577,11 @@
>>>>
>>>>          ## For all missing data points, set the back-calculated value to 
>>>> the measured values so that it has no effect on the chi-squared value.
>>>>          if self.has_missing:
>>>> -            # Loop over the spins.
>>>> -            for si in range(self.num_spins):
>>>> -                # Loop over the spectrometer frequencies.
>>>> -                for mi in range(self.num_frq):
>>>> -                    # Loop over the dispersion points.
>>>> -                    for di in range(self.num_disp_points[0][si][mi][0]):
>>>> -                        if self.missing[0][si][mi][0][di]:
>>>> -                            #self.back_calc[0][si][mi][0][di] = 
>>>> self.values[0][si][mi][0][di]
>>>> -                            self.back_calc_a[0][si][mi][0][di] = 
>>>> self.values[0][si][mi][0][di]
>>>> +            # Find the numpy mask, which tells where values should be 
>>>> replaced.
>>>> +            mask_replace = masked_equal(self.missing_a, 1.0)
>>>> +
>>>> +            # Replace with values.
>>>> +            self.back_calc_a[mask_replace.mask] = 
>>>> self.values_a[mask_replace.mask]
>>>>
>>>>          ## Calculate the chi-squared statistic.
>>>>          return sum((1.0 / self.errors_a * (self.values_a - 
>>>> self.back_calc_a))**2)
>>>>
>>>>
>>>> _______________________________________________
>>>> relax (http://www.nmr-relax.com)
>>>>
>>>> This is the relax-commits mailing list
>>>> [email protected]
>>>>
>>>> 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
>>>
>>> _______________________________________________
>>> relax (http://www.nmr-relax.com)
>>>
>>> This is the relax-devel mailing list
>>> [email protected]
>>>
>>> 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-devel

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

This is the relax-devel mailing list
[email protected]

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-devel

Reply via email to