Hi,
There may be a way of handing this dw and dwH aliasing in a numpy
array design, and that would probably make relax much faster than any
other dispersion software for the MMQ models. But I'm talking about
something different. The dw and dwH aliasing only affect the code up
to the r2eff_mmq_cr72() function call. All lines after this are not
affected. Simply remove 4 spaces from all lines after
r2eff_mmq_cr72() in the func_mmq_CR72() target function:
"""
===================================================================
--- target_functions/relax_disp.py (revision 24016)
+++ target_functions/relax_disp.py (working copy)
@@ -1309,22 +1309,19 @@
# Back calculate the R2eff values.
r2eff_mmq_cr72(r20=r20, pA=pA, pB=pB, dw=aliased_dw,
dwH=aliased_dwH, kex=kex, k_AB=k_AB, k_BA=k_BA,
cpmg_frqs=self.cpmg_frqs[ei], inv_tcpmg=self.inv_relax_times[ei],
tcp=self.tau_cpmg[ei], back_calc=self.back_calc[ei])
- # Clean the data for all values, which is left over at
the end of arrays.
- self.back_calc[ei] = self.back_calc[ei]*self.disp_struct[ei]
+ # Clean the data for all values, which is left over at the
end of arrays.
+ self.back_calc = self.back_calc*self.disp_struct
- # 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:
- # Replace with values.
- mask_replace_blank_ei = masked_equal(self.missing[ei], 1.0)
- self.back_calc[ei][mask_replace_blank_ei.mask] =
self.values[ei][mask_replace_blank_ei.mask]
+ # 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:
+ # Replace with values.
+ mask_replace_blank = masked_equal(self.missing, 1.0)
+ self.back_calc[mask_replace_blank.mask] =
self.values[mask_replace_blank.mask]
- # Calculate and return the chi-squared value.
- chi2_sum += chi2_rankN(self.values[ei],
self.back_calc[ei], self.errors[ei])
+ # Calculate and return the chi-squared value.
+ return chi2_rankN(self.values, self.back_calc, self.errors)
- # Return the total chi-squared value.
- return chi2_sum
"""
The only effect on the test suite is that this model is slightly
faster. The less operations inside Python loops, the better.
Regards,
Edward
On 17 June 2014 10:20, Troels Emtekær Linnet <[email protected]> wrote:
> Hi Ed.
>
> The problem with this, is the mixing of dw and dwH.
>
> I havent figured out how do this efficient.
> I wasted 6 hours for a first try to convert it, so this has to be step by
> step.
>
> You have still won the looping over spins and frequency.
> So it should be faster.
>
> Best
> Troels
>
>
> 2014-06-17 10:04 GMT+02:00 Edward d'Auvergne <[email protected]>:
>>
>> Hi Troels,
>>
>> For this change, you have introduced the chi2_rankN() function, but it
>> is still calculated per experiment. As this model is almost always
>> used with up to 6 different experiments, this will still be slower
>> than what is possible. You should change this to match the other
>> target functions - shift it out of the experiment loop. It can happen
>> at the very end, exactly as in the other target function func_*()
>> methods you have speed up. The cleaning up of the data structure
>> where there are no dispersion points and the missing data handling
>> should also be shifted outside of the experiment loop for speed. The
>> design of your new numpy array structures should handle this, as they
>> all have the experiment index.
>>
>> Regards,
>>
>> Edward
>>
>>
>>
>>
>> On 16 June 2014 19:58, <[email protected]> wrote:
>> > Author: tlinnet
>> > Date: Mon Jun 16 19:58:17 2014
>> > New Revision: 23996
>> >
>> > URL: http://svn.gna.org/viewcvs/relax?rev=23996&view=rev
>> > Log:
>> > Removed looping over spin and frequencies for model MMD CR72.
>> >
>> > 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
>> >
>> > [This mail would be too long, it was shortened to contain the URLs
>> > only.]
>> >
>> > 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=23996&r1=23995&r2=23996&view=diff
>> >
>> >
>> > _______________________________________________
>> > 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