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