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