On Thu, Jan 22, 2009 at 2:34 PM, Pavel Kaderavek <kada@xxxxxxxxxxxxx> wrote:
If I understood, your note is also valid for weights_csa1 and weights_csa2 (weights_csaC.py is different because it is connected to the crosscorelation term and in the weights_dipY is necessary to add dimension for each variable to include the possibility to work with an arbitrary number of the interacting spins ... but I think it is the same issue as in dipY_jw_mf.py), isn't it?
Yes, I've had a look at that other code now and I think it applies to all. The difficulty is with the i index in data.ci_dipY[i]. An elegent solution will need to be found for this one, so that the code isn't duplicated. Maybe there could be one 'data' object per index here. I think this would be the simplest and fastest (number crunching wise) solution. Alternatively the index i could be optional - i.e. a keyword argument in the form of: def calc_dipY_S2_jw(data, params, i=None): and if 'i' is not None, then the index used, otherwise the normal code used. This, however, introduces an unnecessary if-statement at the lowest level of number crunching code which will cause a slowdown. Therefore I think we should avoid this. Do you think it would be feasible to create an array of these data objects, one for each neighbouring dipole, and then loop over them and operate one by one? This will allow all code in maths_fns/, except for 'mf.py' to remain unchanged (with the benefit of being easier, quicker, and more elegent to implement). Regards, Edward