Hi,
If I print out model.back_calc in the back_calc_r2eff() function, in
trunk I see:
[[[[array([ 5.306130403660052, 4.98873783158573 , 4.317593608592393,
3.967292595561497, 2.838855441410711, 2.425338323514461,
2.251452541238648, 2.115947787612741])], [array([
4.474196022619659, 4.141316918567187, 3.464661045189801,
3.174889684574223, 2.212683215201262, 2.15947806199451 ,
2.123752575431453, 2.080479963271101])]]]]
In the branch I see:
[[[[array([ 1., 1., 1., 1., 1., 1., 1., 1.])], [array([ 1.,
1., 1., 1., 1., 1., 1., 1.])]]]]
The back_calc structure is clearly not correct!
Regards,
Edward
On 13 June 2014 18:13, Troels Emtekær Linnet <[email protected]> wrote:
> If you do -d.
>
> It loops over files created and read.
>
> Those files are created with a call to:
> r2effs = optimisation.back_calc_r2eff(spin=cur_spin, spin_id=cur_spin_id)
>
> And somewhere, something weird is going on.
>
>
>
>
>
>
>
> 2014-06-13 18:11 GMT+02:00 Edward d'Auvergne <[email protected]>:
>
>> Hi,
>>
>> Are you always talking about the
>> Relax_disp.test_cpmg_synthetic_dx_map_points system test? How do I
>> see what you see with the values of 1.0?
>>
>> Regards,
>>
>> Edward
>>
>>
>>
>> On 13 June 2014 18:06, Troels Emtekær Linnet <[email protected]>
>> wrote:
>> > If I change model_create to 'NS CPMG 2-site 3D', I works.
>> >
>> > But it seems, that any converted model fails?
>> >
>> >
>> > 2014-06-13 18:03 GMT+02:00 Troels Emtekær Linnet
>> > <[email protected]>:
>> >
>> >> Looking at output, I get:
>> >>
>> >> This means that all calculated R2eff is 1.0 ???
>> >>
>> >> relax> relax_disp.r2eff_read_spin(id='CPMG_599.9', spin_id=':1@N',
>> >> file='CPMG_599.9_1_N.txt',
>> >> dir='/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1',
>> >> disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None)
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_599.9_1_N.txt'
>> >> for reading.
>> >> The following R2eff/R1rho data has been loaded into the relax data
>> >> store:
>> >>
>> >> # R2eff_key Disp_point
>> >> R2eff
>> >> R2eff_error
>> >> sq_cpmg_599.89086170_0.000_33.333 33.333333333333336
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_66.667 66.666666666666671
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_133.333 133.333333333333343
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_166.667 166.666666666666686
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_333.333 333.333333333333371
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_500.000 500.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_666.667 666.666666666666742
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_1000.000 1000.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_499.9_1_N.txt'
>> >> for writing.
>> >>
>> >> relax> relax_disp.r2eff_read_spin(id='CPMG_499.9', spin_id=':1@N',
>> >> file='CPMG_499.9_1_N.txt',
>> >> dir='/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1',
>> >> disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None)
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_499.9_1_N.txt'
>> >> for reading.
>> >> The following R2eff/R1rho data has been loaded into the relax data
>> >> store:
>> >>
>> >> # R2eff_key Disp_point
>> >> R2eff
>> >> R2eff_error
>> >> sq_cpmg_499.89086170_0.000_40.000 40.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_80.000 80.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_160.000 160.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_200.000 200.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_600.000 600.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_700.000 700.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_800.000 800.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_1000.000 1000.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> Generating data with MODEL:CR72, for spin id::1@N
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_599.9_1_N.txt'
>> >> for writing.
>> >>
>> >> relax> relax_disp.r2eff_read_spin(id='CPMG_599.9', spin_id=':1@N',
>> >> file='CPMG_599.9_1_N.txt',
>> >> dir='/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1',
>> >> disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None)
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_599.9_1_N.txt'
>> >> for reading.
>> >> The following R2eff/R1rho data has been loaded into the relax data
>> >> store:
>> >>
>> >> # R2eff_key Disp_point
>> >> R2eff
>> >> R2eff_error
>> >> sq_cpmg_599.89086170_0.000_33.333 33.333333333333336
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_66.667 66.666666666666671
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_133.333 133.333333333333343
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_166.667 166.666666666666686
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_333.333 333.333333333333371
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_500.000 500.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_666.667 666.666666666666742
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_599.89086170_0.000_1000.000 1000.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> Generating data with MODEL:CR72, for spin id::1@N
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_499.9_1_N.txt'
>> >> for writing.
>> >>
>> >> relax> relax_disp.r2eff_read_spin(id='CPMG_499.9', spin_id=':1@N',
>> >> file='CPMG_499.9_1_N.txt',
>> >> dir='/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1',
>> >> disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None)
>> >> Opening the file
>> >>
>> >> '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpVtMOA1/CPMG_499.9_1_N.txt'
>> >> for reading.
>> >> The following R2eff/R1rho data has been loaded into the relax data
>> >> store:
>> >>
>> >> # R2eff_key Disp_point
>> >> R2eff
>> >> R2eff_error
>> >> sq_cpmg_499.89086170_0.000_40.000 40.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_80.000 80.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_160.000 160.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_200.000 200.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_600.000 600.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_700.000 700.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >> sq_cpmg_499.89086170_0.000_800.000 800.000000000000000
>> >> 1.000000000000000 0.100000000000000
>> >>
>> >>
>> >>
>> >> 2014-06-13 17:54 GMT+02:00 Troels Emtekær Linnet
>> >> <[email protected]>:
>> >>
>> >> Or in:
>> >>> r2effs = optimisation.back_calc_r2eff(spin=cur_spin,
>> >>> spin_id=cur_spin_id)
>> >>>
>> >>>
>> >>> 2014-06-13 17:52 GMT+02:00 Troels Emtekær Linnet
>> >>> <[email protected]>:
>> >>>
>> >>> Hi Ed.
>> >>>>
>> >>>> I think I have broken something somewhere?
>> >>>>
>> >>>> It must be something with:
>> >>>> specific_analyses.relax_disp.data
>> >>>> loop_offset_point
>> >>>>
>> >>>> Best
>> >>>> Troels
>> >>>>
>> >>>>
>> >>>> ---------- Forwarded message ----------
>> >>>> From: <[email protected]>
>> >>>> Date: 2014-06-13 17:31 GMT+02:00
>> >>>> Subject: r23942 -
>> >>>> /branches/disp_spin_speed/target_functions/relax_disp.py
>> >>>> To: [email protected]
>> >>>>
>> >>>>
>> >>>> Author: tlinnet
>> >>>> Date: Fri Jun 13 17:31:40 2014
>> >>>> New Revision: 23942
>> >>>>
>> >>>> URL: http://svn.gna.org/viewcvs/relax?rev=23942&view=rev
>> >>>> Log:
>> >>>> Replaced target function for model ns_cpmg_2site_expanded, to use
>> >>>> higher
>> >>>> dimensional numpy array structures.
>> >>>>
>> >>>> That makes the model much faster.
>> >>>>
>> >>>> I cannot get system test:
>> >>>> Relax_disp.test_cpmg_synthetic_dx_map_points
>> >>>> to pass.
>> >>>>
>> >>>> -------
>> >>>> File
>> >>>>
>> >>>> "/Users/tlinnet/software/disp_spin_speed/test_suite/system_tests/relax_disp.py",
>> >>>> line 1671, in test_cpmg_synthetic_dx_map_points
>> >>>> self.assertEqual(res_file[i], lines[i])
>> >>>> AssertionError: '0.76981 3.9169 0.41353 1\n' !=
>> >>>> '0.0098838 1.4654 18.661 1\n'
>> >>>> -------
>> >>>>
>> >>>> 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=23942&r1=23941&r2=23942&view=diff
>> >>>>
>> >>>>
>> >>>> ==============================================================================
>> >>>> --- branches/disp_spin_speed/target_functions/relax_disp.py
>> >>>> (original)
>> >>>> +++ branches/disp_spin_speed/target_functions/relax_disp.py Fri
>> >>>> Jun
>> >>>> 13 17:31:40 2014
>> >>>> @@ -396,7 +396,7 @@
>> >>>>
>> >>>>
>> >>>> # Setup special numpy array structures, for higher
>> >>>> dimensional
>> >>>> computation.
>> >>>> - test_models = [MODEL_B14, MODEL_B14_FULL, MODEL_CR72,
>> >>>> MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LM63, MODEL_M61,
>> >>>> MODEL_M61B, MODEL_MP05, MODEL_TAP03, MODEL_TP02, MODEL_TSMFK01]
>> >>>> + test_models = [MODEL_B14, MODEL_B14_FULL, MODEL_CR72,
>> >>>> MODEL_CR72_FULL, MODEL_DPL94, MODEL_IT99, MODEL_LM63, MODEL_M61,
>> >>>> MODEL_M61B, MODEL_MP05, MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_TAP03,
>> >>>> MODEL_TP02, MODEL_TSMFK01]
>> >>>>
>> >>>> if model in test_models + [MODEL_NOREX]:
>> >>>> # Get the shape of back_calc structure.
>> >>>> @@ -457,10 +457,10 @@
>> >>>> self.phi_ex_struct = deepcopy(zeros_a)
>> >>>>
>> >>>> if model in [MODEL_B14, MODEL_B14_FULL, MODEL_MMQ_CR72,
>> >>>> MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL,
>> >>>> MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR,
>> >>>> MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE,
>> >>>> MODEL_NS_MMQ_3SITE,
>> >>>> MODEL_NS_MMQ_3SITE_LINEAR, MODEL_TSMFK01, MODEL_NS_R1RHO_2SITE,
>> >>>> MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR]:
>> >>>> - # Expand relax times.
>> >>>> - self.inv_relax_times_a = 1.0 / multiply.outer(
>> >>>> tile(self.relax_times[:,None],(1, 1, self.NS)).reshape(self.NE,
>> >>>> self.NS,
>> >>>> self.NM), self.no_nd_struct )
>> >>>> - self.power_a = ones(self.numpy_array_shape, int16)
>> >>>> + self.relax_times_a = deepcopy(zeros_a)
>> >>>> + self.inv_relax_times_a = deepcopy(zeros_a)
>> >>>> self.tau_cpmg_a = deepcopy(zeros_a)
>> >>>> + self.power_a = zeros(self.numpy_array_shape, int16)
>> >>>>
>> >>>> # For R1rho data.
>> >>>> if model in MODEL_LIST_R1RHO_FULL:
>> >>>> @@ -501,8 +501,13 @@
>> >>>> self.has_missing = True
>> >>>> missing_a[ei][si][mi][oi][di] =
>> >>>> 1.0
>> >>>> if model in [MODEL_B14,
>> >>>> MODEL_B14_FULL,
>> >>>> MODEL_MMQ_CR72, MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL,
>> >>>> MODEL_NS_CPMG_2SITE_EXPANDED, MODEL_NS_CPMG_2SITE_STAR,
>> >>>> MODEL_NS_CPMG_2SITE_STAR_FULL, MODEL_NS_MMQ_2SITE,
>> >>>> MODEL_NS_MMQ_3SITE,
>> >>>> MODEL_NS_MMQ_3SITE_LINEAR, MODEL_TSMFK01, MODEL_NS_R1RHO_2SITE,
>> >>>> MODEL_NS_R1RHO_3SITE, MODEL_NS_R1RHO_3SITE_LINEAR]:
>> >>>> - self.power_a[ei][si][mi][oi][di]
>> >>>> =
>> >>>> int(round(self.cpmg_frqs[ei][mi][0][di] * self.relax_times[ei][mi]))
>> >>>> -
>> >>>> self.tau_cpmg_a[ei][si][mi][oi][di]
>> >>>> = 0.25 / self.cpmg_frqs[ei][mi][0][di]
>> >>>> +
>> >>>> self.relax_times_a[ei][si][mi][oi][di] = self.relax_times[ei][mi]
>> >>>> +
>> >>>> self.tau_cpmg_a[ei][si][mi][oi][di]
>> >>>> = self.tau_cpmg[ei][mi][di]
>> >>>> + self.power_a[ei][si][mi][oi][di]
>> >>>> =
>> >>>> self.power[ei][mi][di]
>> >>>> +
>> >>>> + if model != MODEL_TSMFK01:
>> >>>> +
>> >>>> self.inv_relax_times_a[ei][si][mi][oi][di] =
>> >>>> self.inv_relax_times[ei][mi]
>> >>>> +
>> >>>> # For R1rho data.
>> >>>> if model in MODEL_LIST_R1RHO_FULL
>> >>>> and
>> >>>> model != MODEL_NOREX:
>> >>>>
>> >>>> self.disp_struct[ei][si][mi][oi][di] = 1.0
>> >>>> @@ -1500,37 +1505,25 @@
>> >>>> pA = params[self.end_index[1]]
>> >>>> kex = params[self.end_index[1]+1]
>> >>>>
>> >>>> - # Once off parameter conversions.
>> >>>> - pB = 1.0 - pA
>> >>>> - k_BA = pA * kex
>> >>>> - k_AB = pB * kex
>> >>>> -
>> >>>> - # Chi-squared initialisation.
>> >>>> - chi2_sum = 0.0
>> >>>> -
>> >>>> - # Loop over the spins.
>> >>>> - for si in range(self.num_spins):
>> >>>> - # Loop over the spectrometer frequencies.
>> >>>> - for mi in range(self.num_frq):
>> >>>> - # The R20 index.
>> >>>> - r20_index = mi + si*self.num_frq
>> >>>> -
>> >>>> - # Convert dw from ppm to rad/s.
>> >>>> - dw_frq = dw[si] * self.frqs[0][si][mi]
>> >>>> -
>> >>>> - # Back calculate the R2eff values.
>> >>>> - r2eff_ns_cpmg_2site_expanded(r20=R20[r20_index],
>> >>>> pA=pA,
>> >>>> dw=dw_frq, k_AB=k_AB, k_BA=k_BA, relax_time=self.relax_times[0][mi],
>> >>>> inv_relax_time=self.inv_relax_times[0][mi], tcp=self.tau_cpmg[0][mi],
>> >>>> back_calc=self.back_calc[0][si][mi][0],
>> >>>> num_points=self.num_disp_points[0][si][mi][0],
>> >>>> num_cpmg=self.power[0][mi])
>> >>>> -
>> >>>> - # 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.
>> >>>> - 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]
>> >>>> -
>> >>>> - # Calculate and return the chi-squared value.
>> >>>> - chi2_sum += chi2(self.values[0][si][mi][0],
>> >>>> self.back_calc[0][si][mi][0], self.errors[0][si][mi][0])
>> >>>> -
>> >>>> - # Return the total chi-squared value.
>> >>>> - return chi2_sum
>> >>>> + # Convert dw from ppm to rad/s. Use the out argument, to
>> >>>> pass
>> >>>> directly to structure.
>> >>>> + multiply( multiply.outer( dw.reshape(self.NE, self.NS),
>> >>>> self.nm_no_nd_struct ), self.frqs_a, out=self.dw_struct )
>> >>>> +
>> >>>> + # Reshape R20A and R20B to per experiment, spin and
>> >>>> frequency.
>> >>>> + self.r20_struct[:] = multiply.outer( R20.reshape(self.NE,
>> >>>> self.NS, self.NM), self.no_nd_struct )
>> >>>> +
>> >>>> + # Back calculate the R2eff values.
>> >>>> + r2eff_ns_cpmg_2site_expanded(r20=self.r20_struct, pA=pA,
>> >>>> dw=self.dw_struct, dw_orig=dw, kex=kex,
>> >>>> relax_time=self.relax_times_a,
>> >>>> inv_relax_time=self.inv_relax_times_a, tcp=self.tau_cpmg_a,
>> >>>> back_calc=self.back_calc_a, num_cpmg=self.power_a)
>> >>>> +
>> >>>> + # Clean the data for all values, which is left over at the
>> >>>> end
>> >>>> of arrays.
>> >>>> + self.back_calc_a = self.back_calc_a*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.
>> >>>> + self.back_calc_a[self.mask_replace_blank.mask] =
>> >>>> self.values_a[self.mask_replace_blank.mask]
>> >>>> +
>> >>>> + ## Calculate the chi-squared statistic.
>> >>>> + return chi2_rankN(self.values_a, self.back_calc_a,
>> >>>> self.errors_a)
>> >>>>
>> >>>>
>> >>>> def func_ns_cpmg_2site_star(self, params):
>> >>>>
>> >>>>
>> >>>> _______________________________________________
>> >>>> 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