Package maths_fns :: Module jw_mf_comps
[hide private]
[frames] | no frames]

Source Code for Module maths_fns.jw_mf_comps

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2003, 2004 Edward d'Auvergne                                  # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax is free software; you can redistribute it and/or modify               # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation; either version 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax is distributed in the hope that it will be useful,                    # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23   
 24  from Numeric import Float64, zeros 
 25   
 26   
 27   
 28  ############################ 
 29  # Spectral density values. # 
 30  ############################ 
 31   
 32   
 33  # Original {S2, te}. 
 34  #################### 
 35   
36 -def calc_S2_te_jw_comps(data, params):
37 """Spectral density component function. 38 39 Calculate the components of the spectral density value for the original model-free formula with 40 the parameters {S2, te}. 41 42 The model-free formula is: 43 44 _n_ 45 2 \ / S2 (1 - S2)(te + ti)te \ 46 J(w) = - > ci . ti | ------------ + ------------------------- | 47 5 /__ \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 48 i=m 49 50 Replicated calculations are: 51 52 w_ti_sqrd = (w.ti)^2 (pre-calculated during initialisation) 53 54 te_ti = te + ti 55 te_ti_te = (te + ti).te 56 57 58 Calculations which are replicated in the gradient equations are: 59 60 fact_ti = 1 / (1 + (w.ti)^2) (pre-calculated during initialisation) 61 62 one_s2 = 1 - S2 63 64 te_ti_sqrd = (te + ti)^2 65 w_te_ti_sqrd = (w.te.ti)^2 66 67 (te + ti)te 68 fact_te = ------------------------- 69 (te + ti)^2 + (w.te.ti)^2 70 71 """ 72 73 data.one_s2 = 1.0 - params[data.s2_index] 74 75 data.te_ti = params[data.te_index] + data.ti 76 data.te_ti_te = data.te_ti * params[data.te_index] 77 data.te_ti_sqrd = data.te_ti**2 78 data.w_te_ti_sqrd = data.w_ti_sqrd * params[data.te_index]**2 79 data.inv_te_denom = 1.0 / (data.te_ti_sqrd + data.w_te_ti_sqrd) 80 data.fact_te = data.te_ti_te * data.inv_te_denom
81 82 83 84 # Extended {S2f, S2, ts}. 85 ######################### 86
87 -def calc_S2f_S2_ts_jw_comps(data, params):
88 """Spectral density component function. 89 90 Calculate the components of the spectral density value for the extended model-free formula with 91 the parameters {S2f, S2, ts}. 92 93 The model-free formula is: 94 95 _n_ 96 2 \ / S2 (S2f - S2)(ts + ti)ts \ 97 J(w) = - > ci . ti | ------------ + ------------------------- | 98 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 99 i=m 100 101 Replicated calculations are: 102 103 w_ti_sqrd = (w.ti)^2 (pre-calculated during initialisation) 104 105 ts_ti = ts + ti 106 ts_ti_ts = (ts + ti).ts 107 108 109 Calculations which are replicated in the gradient equations are: 110 111 fact_ti = 1 / (1 + (w.ti)^2) (pre-calculated during initialisation) 112 113 s2f_s2 = S2f - S2 114 115 ts_ti_sqrd = (ts + ti)^2 116 w_ts_ti_sqrd = (w.ts.ti)^2 117 inv_ts_denom = 1 / ((ts + ti)^2 + (w.ts.ti)^2) 118 119 (ts + ti)ts 120 fact_ts = ------------------------- 121 (ts + ti)^2 + (w.ts.ti)^2 122 123 """ 124 125 data.s2f_s2 = params[data.s2f_index] - params[data.s2_index] 126 127 data.ts_ti = params[data.ts_index] + data.ti 128 data.ts_ti_ts = data.ts_ti * params[data.ts_index] 129 data.ts_ti_sqrd = data.ts_ti**2 130 data.w_ts_ti_sqrd = data.w_ti_sqrd * params[data.ts_index]**2 131 data.inv_ts_denom = 1.0 / (data.ts_ti_sqrd + data.w_ts_ti_sqrd) 132 data.fact_ts = data.ts_ti_ts * data.inv_ts_denom
133 134 135 136 # Extended 2 {S2f, S2s, ts}. 137 ############################ 138
139 -def calc_S2f_S2s_ts_jw_comps(data, params):
140 """Spectral density component function. 141 142 Calculate the components of the spectral density value for the extended model-free formula with 143 the parameters {S2f, S2s, ts}. 144 145 The model-free formula is: 146 147 _n_ 148 2 \ / S2s (1 - S2s)(ts + ti)ts \ 149 J(w) = - S2f > ci . ti | ------------ + ------------------------- | 150 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 151 i=m 152 153 Replicated calculations are: 154 155 w_ti_sqrd = (w.ti)^2 (pre-calculated during initialisation) 156 157 ts_ti = ts + ti 158 ts_ti_ts = (ts + ti).ts 159 160 161 Calculations which are replicated in the gradient equations are: 162 163 fact_ti = 1 / (1 + (w.ti)^2) (pre-calculated during initialisation) 164 165 one_s2s = 1 - S2s 166 167 ts_ti_sqrd = (ts + ti)^2 168 w_ts_ti_sqrd = (w.ts.ti)^2 169 inv_ts_denom = 1 / ((ts + ti)^2 + (w.ts.ti)^2) 170 171 (ts + ti)ts 172 fact_ts = ------------------------- 173 (ts + ti)^2 + (w.ts.ti)^2 174 175 """ 176 177 data.one_s2s = 1.0 - params[data.s2s_index] 178 179 data.ts_ti = params[data.ts_index] + data.ti 180 data.ts_ti_ts = data.ts_ti * params[data.ts_index] 181 data.ts_ti_sqrd = data.ts_ti**2 182 data.w_ts_ti_sqrd = data.w_ti_sqrd * params[data.ts_index]**2 183 data.inv_ts_denom = 1.0 / (data.ts_ti_sqrd + data.w_ts_ti_sqrd) 184 data.fact_ts = data.ts_ti_ts * data.inv_ts_denom
185 186 187 188 # Extended {S2f, tf, S2, ts}. 189 ############################# 190
191 -def calc_S2f_tf_S2_ts_jw_comps(data, params):
192 """Spectral density component function. 193 194 Calculate the components of the spectral density value for the extended model-free formula with 195 the parameters {S2f, tf, S2, ts}. 196 197 The model-free formula is: 198 199 _n_ 200 2 \ / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 201 J(w) = - > ci . ti | ------------ + ------------------------- + ------------------------- | 202 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 203 i=m 204 205 Replicated calculations are: 206 207 w_ti_sqrd = (w.ti)^2 (pre-calculated during initialisation) 208 209 tf_ti = tf + ti 210 ts_ti = ts + ti 211 tf_ti_tf = (tf + ti).tf 212 ts_ti_ts = (ts + ti).ts 213 214 215 Calculations which are replicated in the gradient equations are: 216 217 fact_ti = 1 / (1 + (w.ti)^2) (pre-calculated during initialisation) 218 219 one_s2f = 1 - S2f 220 s2f_s2 = S2f - S2 221 222 tf_ti_sqrd = (tf + ti)^2 223 ts_ti_sqrd = (ts + ti)^2 224 w_tf_ti_sqrd = (w.tf.ti)^2 225 w_ts_ti_sqrd = (w.ts.ti)^2 226 inv_tf_denom = 1 / ((tf + ti)^2 + (w.tf.ti)^2) 227 inv_ts_denom = 1 / ((ts + ti)^2 + (w.ts.ti)^2) 228 229 (tf + ti)tf 230 fact_tf = ------------------------- 231 (tf + ti)^2 + (w.tf.ti)^2 232 233 234 (ts + ti)ts 235 fact_ts = ------------------------- 236 (ts + ti)^2 + (w.ts.ti)^2 237 238 """ 239 240 data.one_s2f = 1.0 - params[data.s2f_index] 241 data.s2f_s2 = params[data.s2f_index] - params[data.s2_index] 242 243 data.tf_ti = params[data.tf_index] + data.ti 244 data.ts_ti = params[data.ts_index] + data.ti 245 data.tf_ti_tf = data.tf_ti * params[data.tf_index] 246 data.ts_ti_ts = data.ts_ti * params[data.ts_index] 247 data.tf_ti_sqrd = data.tf_ti**2 248 data.ts_ti_sqrd = data.ts_ti**2 249 data.w_tf_ti_sqrd = data.w_ti_sqrd * params[data.tf_index]**2 250 data.w_ts_ti_sqrd = data.w_ti_sqrd * params[data.ts_index]**2 251 data.inv_tf_denom = 1.0 / (data.tf_ti_sqrd + data.w_tf_ti_sqrd) 252 data.inv_ts_denom = 1.0 / (data.ts_ti_sqrd + data.w_ts_ti_sqrd) 253 data.fact_tf = data.tf_ti_tf * data.inv_tf_denom 254 data.fact_ts = data.ts_ti_ts * data.inv_ts_denom
255 256 257 258 # Extended 2 {S2f, tf, S2s, ts}. 259 ################################ 260
261 -def calc_S2f_tf_S2s_ts_jw_comps(data, params):
262 """Spectral density component function. 263 264 Calculate the components of the spectral density value for the extended model-free formula with 265 the parameters {S2f, tf, S2s, ts}. 266 267 The model-free formula is: 268 269 _n_ 270 2 \ / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 271 J(w) = - > ci . ti | ------------ + ------------------------- + ------------------------- | 272 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 273 i=m 274 275 Replicated calculations are: 276 277 w_ti_sqrd = (w.ti)^2 (pre-calculated during initialisation) 278 279 tf_ti = tf + ti 280 ts_ti = ts + ti 281 tf_ti_tf = (tf + ti).tf 282 ts_ti_ts = (ts + ti).ts 283 284 285 Calculations which are replicated in the gradient equations are: 286 287 fact_ti = 1 / (1 + (w.ti)^2) (pre-calculated during initialisation) 288 289 one_s2s = 1 - S2s 290 one_s2f = 1 - S2f 291 s2f_s2 = S2f(1 - S2s) = S2f - S2 292 293 tf_ti_sqrd = (tf + ti)^2 294 ts_ti_sqrd = (ts + ti)^2 295 w_tf_ti_sqrd = (w.tf.ti)^2 296 w_ts_ti_sqrd = (w.ts.ti)^2 297 inv_tf_denom = 1 / ((tf + ti)^2 + (w.tf.ti)^2) 298 inv_ts_denom = 1 / ((ts + ti)^2 + (w.ts.ti)^2) 299 300 (tf + ti)tf 301 fact_tf = ------------------------- 302 (tf + ti)^2 + (w.tf.ti)^2 303 304 305 (ts + ti)ts 306 fact_ts = ------------------------- 307 (ts + ti)^2 + (w.ts.ti)^2 308 309 """ 310 311 data.one_s2s = 1.0 - params[data.s2s_index] 312 data.one_s2f = 1.0 - params[data.s2f_index] 313 data.s2f_s2 = params[data.s2f_index] * data.one_s2s 314 315 data.tf_ti = params[data.tf_index] + data.ti 316 data.ts_ti = params[data.ts_index] + data.ti 317 data.tf_ti_tf = data.tf_ti * params[data.tf_index] 318 data.ts_ti_ts = data.ts_ti * params[data.ts_index] 319 data.tf_ti_sqrd = data.tf_ti**2 320 data.ts_ti_sqrd = data.ts_ti**2 321 data.w_tf_ti_sqrd = data.w_ti_sqrd * params[data.tf_index]**2 322 data.w_ts_ti_sqrd = data.w_ti_sqrd * params[data.ts_index]**2 323 data.inv_tf_denom = 1.0 / (data.tf_ti_sqrd + data.w_tf_ti_sqrd) 324 data.inv_ts_denom = 1.0 / (data.ts_ti_sqrd + data.w_ts_ti_sqrd) 325 data.fact_tf = data.tf_ti_tf * data.inv_tf_denom 326 data.fact_ts = data.ts_ti_ts * data.inv_ts_denom
327 328 329 330 331 ############################### 332 # Spectral density gradients. # 333 ############################### 334 335 336 # Original {} and {S2} with diffusion parameters. 337 ################################################# 338
339 -def calc_diff_djw_comps(data, params):
340 """Spectral density gradient component function. 341 342 Calculate the components of the spectral density gradient for the original model-free formula 343 with no parameters {} or the parameter {S2} together with diffusion tensor parameters. 344 345 Replicated calculations are: 346 347 1 - (w.ti)^2 348 fact_ti_djw_dti = ---------------- 349 (1 + (w.ti)^2)^2 350 """ 351 352 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2
353 354 355 356 # Original {S2, te}. 357 #################### 358
359 -def calc_S2_te_djw_comps(data, params):
360 """Spectral density gradient component function. 361 362 Calculate the components of the spectral density gradient for the original model-free formula 363 with the parameters {S2, te}. 364 365 Replicated calculations are: 366 367 (te + ti)^2 - (w.te.ti)^2 368 fact_djw_dte = ti^2 ----------------------------- 369 ((te + ti)^2 + (w.te.ti)^2)^2 370 """ 371 372 data.fact_djw_dte = data.ti**2 * (data.te_ti_sqrd - data.w_te_ti_sqrd) * data.inv_te_denom**2
373 374 375 376 # Original {S2, te} with diffusion parameters. 377 ############################################## 378
379 -def calc_diff_S2_te_djw_comps(data, params):
380 """Spectral density gradient component function. 381 382 Calculate the components of the spectral density gradient for the original model-free formula 383 with the parameters {S2, te} together with diffusion tensor parameters. 384 385 Replicated calculations are: 386 387 (te + ti)^2 - (w.te.ti)^2 388 fact_djw = ----------------------------- 389 ((te + ti)^2 + (w.te.ti)^2)^2 390 391 1 - (w.ti)^2 392 fact_ti_djw_dti = ---------------- 393 (1 + (w.ti)^2)^2 394 395 (te + ti)^2 - (w.te.ti)^2 396 fact_te_djw_dti = te^2 ----------------------------- 397 ((te + ti)^2 + (w.te.ti)^2)^2 398 399 (te + ti)^2 - (w.te.ti)^2 400 fact_djw_dte = ti^2 ----------------------------- 401 ((te + ti)^2 + (w.te.ti)^2)^2 402 """ 403 404 fact_djw = (data.te_ti_sqrd - data.w_te_ti_sqrd) * data.inv_te_denom**2 405 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2 406 data.fact_te_djw_dti = params[data.te_index]**2 * fact_djw 407 data.fact_djw_dte = data.ti**2 * fact_djw
408 409 410 411 # Extended {S2f, S2, ts}. 412 ######################### 413
414 -def calc_S2f_S2_ts_djw_comps(data, params):
415 """Spectral density gradient component function. 416 417 Calculate the components of the spectral density gradient for the extended model-free formula 418 with the parameters {S2f, S2, ts}. 419 420 Replicated calculations are: 421 422 423 (ts + ti)^2 - (w.ts.ti)^2 424 fact_djw_dts = ti^2 ----------------------------- 425 ((ts + ti)^2 + (w.ts.ti)^2)^2 426 """ 427 428 data.fact_djw_dts = data.ti**2 * (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2
429 430 431 432 # Extended {S2f, S2, ts} with diffusion parameters. 433 ################################################### 434
435 -def calc_diff_S2f_S2_ts_djw_comps(data, params):
436 """Spectral density gradient component function. 437 438 Calculate the components of the spectral density gradient for the extended model-free formula 439 with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 440 441 Replicated calculations are: 442 443 (ts + ti)^2 - (w.ts.ti)^2 444 fact_djw = ----------------------------- 445 ((ts + ti)^2 + (w.ts.ti)^2)^2 446 447 448 1 - (w.ti)^2 449 fact_ti_djw_dti = ---------------- 450 (1 + (w.ti)^2)^2 451 452 453 (ts + ti)^2 - (w.ts.ti)^2 454 fact_ts_djw_dti = ts^2 ----------------------------- 455 ((ts + ti)^2 + (w.ts.ti)^2)^2 456 457 458 (ts + ti)^2 - (w.ts.ti)^2 459 fact_djw_dts = ti^2 ----------------------------- 460 ((ts + ti)^2 + (w.ts.ti)^2)^2 461 """ 462 463 464 fact_djw = (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2 465 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2 466 data.fact_ts_djw_dti = params[data.ts_index]**2 * fact_djw 467 data.fact_djw_dts = data.ti**2 * fact_djw
468 469 470 471 # Extended {S2f, tf, S2, ts}. 472 ############################# 473
474 -def calc_S2f_tf_S2_ts_djw_comps(data, params):
475 """Spectral density gradient component function. 476 477 Calculate the components of the spectral density gradient for the extended model-free formula 478 with the parameters {S2f, tf, S2, ts}. 479 480 Replicated calculations are: 481 482 (tf + ti)^2 - (w.tf.ti)^2 483 fact_djw_dtf = ti^2 ----------------------------- 484 ((tf + ti)^2 + (w.tf.ti)^2)^2 485 486 487 (ts + ti)^2 - (w.ts.ti)^2 488 fact_djw_dts = ti^2 ----------------------------- 489 ((ts + ti)^2 + (w.ts.ti)^2)^2 490 """ 491 492 data.fact_djw_dtf = data.ti**2 * (data.tf_ti_sqrd - data.w_tf_ti_sqrd) * data.inv_tf_denom**2 493 data.fact_djw_dts = data.ti**2 * (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2
494 495 496 497 # Extended {S2f, tf, S2, ts} with diffusion parameters. 498 ####################################################### 499
500 -def calc_diff_S2f_tf_S2_ts_djw_comps(data, params):
501 """Spectral density gradient component function. 502 503 Calculate the components of the spectral density gradient for the extended model-free formula 504 with the parameters {S2f, tf, S2, ts} together with diffusion tensor parameters. 505 506 Replicated calculations are: 507 508 (tf + ti)^2 - (w.tf.ti)^2 509 fact_tf_djw = ----------------------------- 510 ((tf + ti)^2 + (w.tf.ti)^2)^2 511 512 513 (ts + ti)^2 - (w.ts.ti)^2 514 fact_ts_djw = ----------------------------- 515 ((ts + ti)^2 + (w.ts.ti)^2)^2 516 517 518 1 - (w.ti)^2 519 fact_ti_djw_dti = ---------------- 520 (1 + (w.ti)^2)^2 521 522 523 (tf + ti)^2 - (w.tf.ti)^2 524 fact_tf_djw_dti = tf^2 ----------------------------- 525 ((tf + ti)^2 + (w.tf.ti)^2)^2 526 527 528 (ts + ti)^2 - (w.ts.ti)^2 529 fact_ts_djw_dti = ts^2 ----------------------------- 530 ((ts + ti)^2 + (w.ts.ti)^2)^2 531 532 533 (tf + ti)^2 - (w.tf.ti)^2 534 fact_djw_dtf = ti^2 ----------------------------- 535 ((tf + ti)^2 + (w.tf.ti)^2)^2 536 537 538 (ts + ti)^2 - (w.ts.ti)^2 539 fact_djw_dts = ti^2 ----------------------------- 540 ((ts + ti)^2 + (w.ts.ti)^2)^2 541 """ 542 543 # ti. 544 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2 545 546 # tf. 547 fact_tf_djw = (data.tf_ti_sqrd - data.w_tf_ti_sqrd) * data.inv_tf_denom**2 548 data.fact_tf_djw_dti = params[data.tf_index]**2 * fact_tf_djw 549 data.fact_djw_dtf = data.ti**2 * fact_tf_djw 550 551 # ts. 552 fact_ts_djw = (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2 553 data.fact_ts_djw_dti = params[data.ts_index]**2 * fact_ts_djw 554 data.fact_djw_dts = data.ti**2 * fact_ts_djw
555 556 557 558 # Extended 2 {S2f, S2s, ts}. 559 ############################ 560
561 -def calc_S2f_S2s_ts_djw_comps(data, params):
562 """Spectral density gradient component function. 563 564 Calculate the components of the spectral density gradient for the extended model-free formula 565 with the parameters {S2f, S2s, ts}. 566 567 Replicated calculations are: 568 569 (ts + ti)^2 - (w.ts.ti)^2 570 fact_djw_dts = ti^2 ----------------------------- 571 ((ts + ti)^2 + (w.ts.ti)^2)^2 572 """ 573 574 data.fact_djw_dts = data.ti**2 * (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2
575 576 577 578 # Extended 2 {S2f, S2s, ts} with diffusion parameters. 579 ###################################################### 580
581 -def calc_diff_S2f_S2s_ts_djw_comps(data, params):
582 """Spectral density gradient component function. 583 584 Calculate the components of the spectral density gradient for the extended model-free formula 585 with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 586 587 Replicated calculations are: 588 589 (ts + ti)^2 - (w.ts.ti)^2 590 fact_djw = ----------------------------- 591 ((ts + ti)^2 + (w.ts.ti)^2)^2 592 593 594 1 - (w.ti)^2 595 fact_ti_djw_dti = ---------------- 596 (1 + (w.ti)^2)^2 597 598 599 (ts + ti)^2 - (w.ts.ti)^2 600 fact_te_djw_dti = ts^2 ----------------------------- 601 ((ts + ti)^2 + (w.ts.ti)^2)^2 602 603 604 (ts + ti)^2 - (w.ts.ti)^2 605 fact_djw_dts = ti^2 ----------------------------- 606 ((ts + ti)^2 + (w.ts.ti)^2)^2 607 """ 608 609 fact_djw = (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2 610 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2 611 data.fact_te_djw_dti = params[data.ts_index]**2 * fact_djw 612 data.fact_djw_dts = data.ti**2 * fact_djw
613 614 615 616 # Extended 2 {S2f, tf, S2s, ts}. 617 ################################ 618
619 -def calc_S2f_tf_S2s_ts_djw_comps(data, params):
620 """Spectral density gradient component function. 621 622 Calculate the components of the spectral density gradient for the extended model-free formula 623 with the parameters {S2f, tf, S2s, ts}. 624 625 Replicated calculations are: 626 627 (tf + ti)^2 - (w.tf.ti)^2 628 fact_djw_dtf = ti^2 ----------------------------- 629 ((tf + ti)^2 + (w.tf.ti)^2)^2 630 631 632 (ts + ti)^2 - (w.ts.ti)^2 633 fact_djw_dts = ti^2 ----------------------------- 634 ((ts + ti)^2 + (w.ts.ti)^2)^2 635 """ 636 637 data.fact_djw_dtf = data.ti**2 * (data.tf_ti_sqrd - data.w_tf_ti_sqrd) * data.inv_tf_denom**2 638 data.fact_djw_dts = data.ti**2 * (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2
639 640 641 642 # Extended 2 {S2f, tf, S2s, ts} with diffusion parameters. 643 ########################################################## 644
645 -def calc_diff_S2f_tf_S2s_ts_djw_comps(data, params):
646 """Spectral density gradient component function. 647 648 Calculate the components of the spectral density gradient for the extended model-free formula 649 with the parameters {S2f, tf, S2, ts} together with diffusion tensor parameters. 650 651 Replicated calculations are: 652 653 (tf + ti)^2 - (w.tf.ti)^2 654 fact_tf_djw = ----------------------------- 655 ((tf + ti)^2 + (w.tf.ti)^2)^2 656 657 658 (ts + ti)^2 - (w.ts.ti)^2 659 fact_ts_djw = ----------------------------- 660 ((ts + ti)^2 + (w.ts.ti)^2)^2 661 662 663 1 - (w.ti)^2 664 fact_ti_djw_dti = ---------------- 665 (1 + (w.ti)^2)^2 666 667 668 (tf + ti)^2 - (w.tf.ti)^2 669 fact_tf_djw_dti = tf^2 ----------------------------- 670 ((tf + ti)^2 + (w.tf.ti)^2)^2 671 672 673 (ts + ti)^2 - (w.ts.ti)^2 674 fact_ts_djw_dti = ts^2 ----------------------------- 675 ((ts + ti)^2 + (w.ts.ti)^2)^2 676 677 678 (tf + ti)^2 - (w.tf.ti)^2 679 fact_djw_dtf = ti^2 ----------------------------- 680 ((tf + ti)^2 + (w.tf.ti)^2)^2 681 682 683 (ts + ti)^2 - (w.ts.ti)^2 684 fact_djw_dts = ti^2 ----------------------------- 685 ((ts + ti)^2 + (w.ts.ti)^2)^2 686 """ 687 688 # ti. 689 data.fact_ti_djw_dti = (1.0 - data.w_ti_sqrd) * data.fact_ti**2 690 691 # tf. 692 fact_tf_djw = (data.tf_ti_sqrd - data.w_tf_ti_sqrd) * data.inv_tf_denom**2 693 data.fact_tf_djw_dti = params[data.tf_index]**2 * fact_tf_djw 694 data.fact_djw_dtf = data.ti**2 * fact_tf_djw 695 696 # ts. 697 fact_ts_djw = (data.ts_ti_sqrd - data.w_ts_ti_sqrd) * data.inv_ts_denom**2 698 data.fact_ts_djw_dti = params[data.ts_index]**2 * fact_ts_djw 699 data.fact_djw_dts = data.ti**2 * fact_ts_djw
700