This is a problem of not having a clean API interface. The different specific analysis optimisation modules are reading the back-calculated values for each analysis type differently. And they access the contents of the class instance object directly - this is simply a bad design. Maybe this should be cleaned up one day. A standardised function called get_back_calc() could be added to all target_function classes which then returns the back calculated data. This would be in the same format as the input data, as required by the various chi2_*() functions anyway. This is just an idea for the future, though I doubt it'll ever happen. Regards, Edward On 13 June 2014 18:45, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
Thanks for the help! I was getting crazy! :-) 2014-06-13 18:34 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:Once everything is converted, all the *_a structures could have the '_a' part removed and all of the other structures removed from self. This will clean up all of the old code. Regards, Edward On 13 June 2014 18:32, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:Ah ja ! I dont set the values back to the original back_calc! I just do the Chi2 values. 2014-06-13 18:25 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:You should run this side-by-side with trunk. In the trunk version of this system test you also have None here, so it can't be that. Regards, Edward On 13 June 2014 18:24, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:This looks weird The None for pA, dw, kex relax> relax_disp.select_model(model='NS CPMG 2-site expanded') The numerical solution for the 2-site Bloch-McConnell equations for SQ CPMG experiments, expanded using Maple by Nikolai Skrynnikov. ('NS CPMG 2-site expanded', 'Ala', ':1@N', 'r2', 'SQ CPMG - 599.89086170 MHz', 2.0) ('NS CPMG 2-site expanded', 'Ala', ':1@N', 'r2', 'SQ CPMG - 499.89086170 MHz', 2.0) ('NS CPMG 2-site expanded', 'Ala', ':1@N', 'pA', None) ('NS CPMG 2-site expanded', 'Ala', ':1@N', 'dw', None) ('NS CPMG 2-site expanded', 'Ala', ':1@N', 'kex', None) 2014-06-13 18:17 GMT+02:00 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:In trunk I see the same thing, but only for the first two relax_disp.r2eff_read_spin user function calls. The rest are different, see below. I'd have to look at what this system test is doing. I don't understand why R2eff values are being read from temporary files. Regards, Edward P. S. From trunk I see: relax> relax_disp.r2eff_read_spin(id='CPMG_599.9', spin_id=':1@N', file='CPMG_599.9_1_N.txt', dir='/tmp/tmpj9iIQb', disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None) Opening the file '/tmp/tmpj9iIQb/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 '/tmp/tmpj9iIQb/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='/tmp/tmpj9iIQb', disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None) Opening the file '/tmp/tmpj9iIQb/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:NS CPMG 2-site expanded, for spin id::1@N Opening the file '/tmp/tmpj9iIQb/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='/tmp/tmpj9iIQb', disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None) Opening the file '/tmp/tmpj9iIQb/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 5.306130403660052 0.100000000000000 sq_cpmg_599.89086170_0.000_66.667 66.666666666666671 4.988737831585730 0.100000000000000 sq_cpmg_599.89086170_0.000_133.333 133.333333333333343 4.317593608592393 0.100000000000000 sq_cpmg_599.89086170_0.000_166.667 166.666666666666686 3.967292595561497 0.100000000000000 sq_cpmg_599.89086170_0.000_333.333 333.333333333333371 2.838855441410711 0.100000000000000 sq_cpmg_599.89086170_0.000_500.000 500.000000000000000 2.425338323514461 0.100000000000000 sq_cpmg_599.89086170_0.000_666.667 666.666666666666742 2.251452541238648 0.100000000000000 sq_cpmg_599.89086170_0.000_1000.000 1000.000000000000000 2.115947787612741 0.100000000000000 Generating data with MODEL:NS CPMG 2-site expanded, for spin id::1@N Opening the file '/tmp/tmpj9iIQb/CPMG_499.9_1_N.txt' for writing. On 13 June 2014 18:14, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:They are "quite" up in the log. 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/tmpSJ5GVn', disp_point_col=1, offset_col=None, data_col=2, error_col=3, sep=None) Opening the file '/var/folders/ww/1jkhkh315x57jglgxnr9g24w0000gp/T/tmpSJ5GVn/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 relax> pipe.copy(pipe_from='base pipe', pipe_to='base pipe_CR72', bundle_to='relax_disp') debug> Lock 'pipe_lock': Acquisition by 'copy'. debug> Lock 'pipe_lock': Release by 'copy'. relax> pipe.switch(pipe_name='base pipe_CR72') debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. relax> value.copy(pipe_from='NS CPMG 2-site expanded_base pipe_R2eff', pipe_to='base pipe_CR72', param='r2eff') debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. debug> Lock 'pipe_lock': Acquisition by 'switch'. debug> Lock 'pipe_lock': Release by 'switch'. relax> relax_disp.select_model(model='CR72') 2014-06-13 18:13 GMT+02:00 Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx>: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 <edward@xxxxxxxxxxxxx>: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 <tlinnet@xxxxxxxxxxxxx> 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 <tlinnet@xxxxxxxxxxxxx>: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 <tlinnet@xxxxxxxxxxxxx>: 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 <tlinnet@xxxxxxxxxxxxx>: 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: <tlinnet@xxxxxxxxxxxxx> Date: 2014-06-13 17:31 GMT+02:00 Subject: r23942 - /branches/disp_spin_speed/target_functions/relax_disp.py To: relax-commits@xxxxxxx 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 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_______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list relax-devel@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-devel