Package lib :: Package spectral_densities :: Module model_free
[hide private]
[frames] | no frames]

Source Code for Module lib.spectral_densities.model_free

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2002-2006,2008 Edward d'Auvergne                              # 
   4  #                                                                             # 
   5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
   6  #                                                                             # 
   7  # This program 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 3 of the License, or           # 
  10  # (at your option) any later version.                                         # 
  11  #                                                                             # 
  12  # This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.       # 
  19  #                                                                             # 
  20  ############################################################################### 
  21   
  22  # Python module imports. 
  23  from numpy import sum 
  24   
  25   
  26  ############################ 
  27  # Spectral density values. # 
  28  ############################ 
  29   
  30  """ 
  31      The spectral density equation 
  32      ============================= 
  33   
  34      Data structure:  data.jw 
  35      Dimension:  2D, (number of NMR frequencies, 5 spectral density frequencies) 
  36      Type:  numpy matrix, float64 
  37      Dependencies:  None 
  38      Required by:  data.ri, data.dri, data.d2ri 
  39   
  40   
  41      Formulae 
  42      ======== 
  43   
  44      Original:: 
  45   
  46                        _k_ 
  47                   2    \                1 
  48          J(w)  =  - S2  >  ci . ti ------------, 
  49                   5    /__         1 + (w.ti)^2 
  50                        i=-k 
  51   
  52   
  53                      _k_ 
  54                   2  \           /      S2             (1 - S2)(te + ti)te    \  
  55          J(w)  =  -   >  ci . ti | ------------  +  ------------------------- |, 
  56                   5  /__         \ 1 + (w.ti)^2     (te + ti)^2 + (w.te.ti)^2 / 
  57                      i=-k 
  58   
  59   
  60      Extended:: 
  61   
  62                      _k_ 
  63                   2  \           /      S2            (S2f - S2)(ts + ti)ts   \  
  64          J(w)  =  -   >  ci . ti | ------------  +  ------------------------- |, 
  65                   5  /__         \ 1 + (w.ti)^2     (ts + ti)^2 + (w.ts.ti)^2 / 
  66                      i=-k 
  67   
  68   
  69                      _k_ 
  70                   2  \           /      S2            (1 - S2f)(tf + ti)tf          (S2f - S2)(ts + ti)ts   \  
  71          J(w)  =  -   >  ci . ti | ------------  +  -------------------------  +  ------------------------- |, 
  72                   5  /__         \ 1 + (w.ti)^2     (tf + ti)^2 + (w.tf.ti)^2     (ts + ti)^2 + (w.ts.ti)^2 / 
  73                      i=-k 
  74   
  75   
  76      Extended 2:: 
  77   
  78                         _k_ 
  79                   2     \           /      S2s           (1 - S2s)(ts + ti)ts    \  
  80          J(w)  =  - S2f  >  ci . ti | ------------  +  ------------------------- |, 
  81                   5     /__         \ 1 + (w.ti)^2     (ts + ti)^2 + (w.ts.ti)^2 / 
  82                         i=-k 
  83   
  84   
  85                      _k_ 
  86                   2  \           /   S2f . S2s        (1 - S2f)(tf + ti)tf         S2f(1 - S2s)(ts + ti)ts  \  
  87          J(w)  =  -   >  ci . ti | ------------  +  -------------------------  +  ------------------------- |. 
  88                   5  /__         \ 1 + (w.ti)^2     (tf + ti)^2 + (w.tf.ti)^2     (ts + ti)^2 + (w.ts.ti)^2 / 
  89                      i=-k 
  90  """ 
  91   
  92   
  93   
  94  # Original no params with or without diffusion parameters. 
  95  ########################################################## 
  96   
97 -def calc_jw(data, params):
98 """Spectral density function. 99 100 Calculate the spectral density values for the original model-free formula with no parameters {} 101 with or without diffusion tensor parameters. 102 103 The formula is:: 104 105 _k_ 106 2 \ 1 107 J(w) = - > ci . ti ------------. 108 5 /__ 1 + (w.ti)^2 109 i=-k 110 """ 111 112 return 0.4 * sum(data.ci * data.ti * data.fact_ti, axis=2)
113 114 115 116 # Original {S2} with or without diffusion parameters. 117 ##################################################### 118
119 -def calc_S2_jw(data, params):
120 """Spectral density function. 121 122 Calculate the spectral density values for the original model-free formula with the single 123 parameter {S2} with or without diffusion tensor parameters. 124 125 The formula is:: 126 127 _k_ 128 2 \ 1 129 J(w) = - S2 > ci . ti ------------. 130 5 /__ 1 + (w.ti)^2 131 i=-k 132 """ 133 134 return 0.4 * params[data.s2_i] * sum(data.ci * data.ti * data.fact_ti, axis=2)
135 136 137 138 # Original {S2, te} with or without diffusion parameters. 139 ######################################################### 140
141 -def calc_S2_te_jw(data, params):
142 """Spectral density function. 143 144 Calculate the spectral density values for the original model-free formula with the parameters 145 {S2, te} with or without diffusion tensor parameters. 146 147 The model-free formula is:: 148 149 _k_ 150 2 \ / S2 (1 - S2)(te + ti)te \ 151 J(w) = - > ci . ti | ------------ + ------------------------- |. 152 5 /__ \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 153 i=-k 154 """ 155 156 return 0.4 * sum(data.ci * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te), axis=2)
157 158 159 160 # Extended {S2f, S2, ts} with or without diffusion parameters. 161 ############################################################## 162
163 -def calc_S2f_S2_ts_jw(data, params):
164 """Spectral density function. 165 166 Calculate the spectral density values for the extended model-free formula with the parameters 167 {S2f, S2, ts} with or without diffusion tensor parameters. 168 169 The model-free formula is:: 170 171 _k_ 172 2 \ / S2 (S2f - S2)(ts + ti)ts \ 173 J(w) = - > ci . ti | ------------ + ------------------------- |. 174 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 175 i=-k 176 """ 177 178 return 0.4 * sum(data.ci * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
179 180 181 182 # Extended {S2f, tf, S2, ts} with or without diffusion parameters. 183 ################################################################## 184
185 -def calc_S2f_tf_S2_ts_jw(data, params):
186 """Spectral density function. 187 188 Calculate the spectral density values for the extended model-free formula with the parameters 189 {S2f, tf, S2, ts} with or without diffusion tensor parameters. 190 191 The model-free formula is:: 192 193 _k_ 194 2 \ / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 195 J(w) = - > ci . ti | ------------ + ------------------------- + ------------------------- |. 196 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 197 i=-k 198 """ 199 200 return 0.4 * sum(data.ci * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
201 202 203 204 # Extended 2 {S2f, S2s, ts} with or without diffusion parameters. 205 ################################################################# 206
207 -def calc_S2f_S2s_ts_jw(data, params):
208 """Spectral density function. 209 210 Calculate the spectral density values for the extended model-free formula with the parameters 211 {S2f, S2s, ts} with or without diffusion tensor parameters. 212 213 The model-free formula is:: 214 215 _k_ 216 2 \ / S2s (1 - S2s)(ts + ti)ts \ 217 J(w) = - S2f > ci . ti | ------------ + ------------------------- |. 218 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 219 i=-k 220 """ 221 222 return 0.4 * params[data.s2f_i] * sum(data.ci * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
223 224 225 226 # Extended 2 {S2f, tf, S2s, ts} with or without diffusion parameters. 227 ##################################################################### 228
229 -def calc_S2f_tf_S2s_ts_jw(data, params):
230 """Spectral density function. 231 232 Calculate the spectral density values for the extended model-free formula with the parameters 233 {S2f, tf, S2s, ts} with or without diffusion tensor parameters. 234 235 The model-free formula is:: 236 237 _k_ 238 2 \ / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 239 J(w) = - > ci . ti | ------------ + ------------------------- + ------------------------- |. 240 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 241 i=-k 242 """ 243 244 return 0.4 * sum(data.ci * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
245 246 247 248 249 ############################### 250 # Spectral density gradients. # 251 ############################### 252 253 """ 254 The spectral density gradients 255 ============================== 256 257 Data structure: data.djw 258 Dimension: 3D, (number of NMR frequencies, 5 spectral density frequencies, 259 model-free parameters) 260 Type: numpy 3D matrix, float64 261 Dependencies: None 262 Required by: data.dri, data.d2ri 263 264 265 Formulae 266 ======== 267 268 Original:: 269 270 _k_ 271 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 272 ----- = - > | ci . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 273 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 274 i=-k 275 276 dci / S2 (1 - S2)(te + ti)te \ \ 277 + --- . ti | ------------ + ------------------------- | |, 278 dGj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 279 280 281 _k_ 282 dJ(w) 2 \ dci / S2 (1 - S2)(te + ti)te \ 283 ----- = - > --- . ti | ------------ + ------------------------- |, 284 dOj 5 /__ dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 285 i=-k 286 287 288 _k_ 289 dJ(w) 2 \ / 1 (te + ti)te \ 290 ----- = - > ci . ti | ------------ - ------------------------- |, 291 dS2 5 /__ \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 292 i=-k 293 294 295 _k_ 296 dJ(w) 2 \ (te + ti)^2 - (w.te.ti)^2 297 ----- = - (1 - S2) > ci . ti^2 -----------------------------, 298 dte 5 /__ ((te + ti)^2 + (w.te.ti)^2)^2 299 i=-k 300 301 302 dJ(w) 303 ----- = 0, 304 dRex 305 306 307 dJ(w) 308 ----- = 0, 309 dcsa 310 311 312 dJ(w) 313 ----- = 0. 314 dr 315 316 317 Extended:: 318 319 _k_ 320 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 321 ----- = - > | ci . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- | 322 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 323 i=-k 324 325 dci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 326 + --- . ti | ------------ + ------------------------- + ------------------------- | |, 327 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 328 329 330 _k_ 331 dJ(w) 2 \ dci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 332 ----- = - > --- . ti | ------------ + ------------------------- + ------------------------- |, 333 dOj 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 334 i=-k 335 336 337 _k_ 338 dJ(w) 2 \ / 1 (ts + ti).ts \ 339 ----- = - > ci . ti | ------------ - ------------------------- |, 340 dS2 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 341 i=-k 342 343 344 _k_ 345 dJ(w) 2 \ / (tf + ti).tf (ts + ti).ts \ 346 ----- = - - > ci . ti | ------------------------- - ------------------------- |, 347 dS2f 5 /__ \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 348 i=-k 349 350 351 _k_ 352 dJ(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 353 ----- = - (1 - S2f) > ci . ti^2 -----------------------------, 354 dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 355 i=-k 356 357 358 _k_ 359 dJ(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 360 ----- = - (S2f - S2) > ci . ti^2 -----------------------------, 361 dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 362 i=-k 363 364 365 dJ(w) 366 ----- = 0, 367 dRex 368 369 370 dJ(w) 371 ----- = 0, 372 dcsa 373 374 375 dJ(w) 376 ----- = 0. 377 dr 378 379 380 Extended 2:: 381 382 _k_ 383 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 384 ----- = - > | ci . --- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- | 385 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 386 i=-k 387 388 dci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 389 + --- . ti | ------------ + ------------------------- + ------------------------- | |, 390 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 391 392 393 _k_ 394 dJ(w) 2 \ dci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 395 ----- = - > --- . ti | ------------ + ------------------------- + ------------------------- |, 396 dOj 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 397 i=-k 398 399 400 _k_ 401 dJ(w) 2 \ / S2s (tf + ti).tf (1 - S2s)(ts + ti).ts \ 402 ----- = - > ci . ti | ------------ - ------------------------- + ------------------------- |, 403 dS2f 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 404 i=-k 405 406 407 _k_ 408 dJ(w) 2 \ / 1 (ts + ti).ts \ 409 ----- = - S2f > ci . ti | ------------ - ------------------------- |, 410 dS2s 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 411 i=-k 412 413 414 _k_ 415 dJ(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 416 ----- = - (1 - S2f) > ci . ti^2 -----------------------------, 417 dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 418 i=-k 419 420 421 _k_ 422 dJ(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 423 ----- = - S2f(1 - S2s) > ci . ti^2 -----------------------------, 424 dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 425 i=-k 426 427 428 dJ(w) 429 ----- = 0, 430 dRex 431 432 433 dJ(w) 434 ----- = 0, 435 dcsa 436 437 438 dJ(w) 439 ----- = 0. 440 dr 441 """ 442 443 444 445 # Original Gj partial derivative. 446 ################################# 447 448 # {} with diffusion parameters. 449
450 -def calc_diff_djw_dGj(data, params, j):
451 """Spectral density gradient. 452 453 Calculate the spectral desity values for the Gj partial derivative of the original model-free 454 formula with no parameters {} together with diffusion tensor parameters. 455 456 The model-free gradient is:: 457 458 _k_ 459 dJ(w) 2 \ dti 1 - (w.ti)^2 460 ----- = - > ci . --- ----------------. 461 dGj 5 /__ dGj (1 + (w.ti)^2)^2 462 i=-k 463 """ 464 465 return 0.4 * sum(data.ci * data.dti[j] * data.fact_ti_djw_dti, axis=2)
466 467
468 -def calc_ellipsoid_djw_dGj(data, params, j):
469 """Spectral density gradient. 470 471 Calculate the spectral desity values for the Gj partial derivative of the original model-free 472 formula with no parameters {} together with diffusion tensor parameters. 473 474 The model-free gradient is:: 475 476 _k_ 477 dJ(w) 2 \ / dti 1 - (w.ti)^2 dci 1 \ 478 ----- = - > | ci . --- ---------------- + --- . ti ------------ |. 479 dGj 5 /__ \ dGj (1 + (w.ti)^2)^2 dGj 1 + (w.ti)^2 / 480 i=-k 481 """ 482 483 return 0.4 * sum(data.ci * data.dti[j] * data.fact_ti_djw_dti + data.dci[j] * data.ti * data.fact_ti, axis=2)
484 485 486 # {S2} with diffusion parameters. 487
488 -def calc_diff_S2_djw_dGj(data, params, j):
489 """Spectral density gradient. 490 491 Calculate the spectral desity values for the Gj partial derivative of the original model-free 492 formula with the parameter {S2} together with diffusion tensor parameters. 493 494 The model-free gradient is:: 495 496 _k_ 497 dJ(w) 2 \ dti 1 - (w.ti)^2 498 ----- = - S2 > ci . --- ----------------. 499 dGj 5 /__ dGj (1 + (w.ti)^2)^2 500 i=-k 501 """ 502 503 return 0.4 * params[data.s2_i] * sum(data.ci * data.dti[j] * data.fact_ti_djw_dti, axis=2)
504 505
506 -def calc_ellipsoid_S2_djw_dGj(data, params, j):
507 """Spectral density gradient. 508 509 Calculate the spectral desity values for the Gj partial derivative of the original model-free 510 formula with the parameter {S2} together with diffusion tensor parameters. 511 512 The model-free gradient is:: 513 514 _k_ 515 dJ(w) 2 \ / dti 1 - (w.ti)^2 dci 1 \ 516 ----- = - S2 > | ci . --- ---------------- + --- . ti ------------ |. 517 dGj 5 /__ \ dGj (1 + (w.ti)^2)^2 dGj 1 + (w.ti)^2 / 518 i=-k 519 """ 520 521 return 0.4 * params[data.s2_i] * sum(data.ci * data.dti[j] * data.fact_ti_djw_dti + data.dci[j] * data.ti * data.fact_ti, axis=2)
522 523 524 # {S2, te} with diffusion parameters. 525
526 -def calc_diff_S2_te_djw_dGj(data, params, j):
527 """Spectral density gradient. 528 529 Calculate the spectral desity values for the Gj partial derivative of the original model-free 530 formula with the parameters {S2, te} together with diffusion tensor parameters. 531 532 The model-free gradient is:: 533 534 _k_ 535 dJ(w) 2 \ dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 536 ----- = - > ci . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- |. 537 dGj 5 /__ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 538 i=-k 539 """ 540 541 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti), axis=2)
542 543
544 -def calc_ellipsoid_S2_te_djw_dGj(data, params, j):
545 """Spectral density gradient. 546 547 Calculate the spectral desity values for the Gj partial derivative of the original model-free 548 formula with the parameters {S2, te} together with diffusion tensor parameters. 549 550 The model-free gradient is:: 551 552 _k_ 553 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 554 ----- = - > | ci . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 555 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 556 i=-k 557 558 dci / S2 (1 - S2)(te + ti)te \ \ 559 + --- . ti | ------------ + ------------------------- | |. 560 dGj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 561 """ 562 563 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti) + data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te), axis=2)
564 565 566 567 # Original Oj partial derivative. 568 ################################# 569 570 # {} with diffusion parameters. 571
572 -def calc_diff_djw_dOj(data, params, j):
573 """Spectral density gradient. 574 575 Calculate the spectral desity values for the O partial derivative of the original model-free 576 formula with no parameters {} together with diffusion tensor parameters. 577 578 The model-free gradient is:: 579 580 _k_ 581 dJ(w) 2 \ dci 1 582 ----- = - > --- . ti ------------. 583 dOj 5 /__ dOj 1 + (w.ti)^2 584 i=-k 585 """ 586 587 return 0.4 * sum(data.dci[j] * data.ti * data.fact_ti, axis=2)
588 589 590 # {S2} with diffusion parameters. 591
592 -def calc_diff_S2_djw_dOj(data, params, j):
593 """Spectral density gradient. 594 595 Calculate the spectral desity values for the O partial derivative of the original model-free 596 formula with the parameter {S2} together with diffusion tensor parameters. 597 598 The model-free gradient is:: 599 600 _k_ 601 dJ(w) 2 \ dci 1 602 ----- = - S2 > --- . ti ------------. 603 dOj 5 /__ dOj 1 + (w.ti)^2 604 i=-k 605 """ 606 607 return 0.4 * params[data.s2_i] * sum(data.dci[j] * data.ti * data.fact_ti, axis=2)
608 609 610 # {S2, te} with diffusion parameters. 611
612 -def calc_diff_S2_te_djw_dOj(data, params, j):
613 """Spectral density gradient. 614 615 Calculate the spectral desity values for the O partial derivative of the original model-free 616 formula with the parameters {S2, te} together with diffusion tensor parameters. 617 618 The model-free gradient is:: 619 620 _k_ 621 dJ(w) 2 \ dci / S2 (1 - S2)(te + ti)te \ 622 ----- = - > --- . ti | ------------ + ------------------------- |. 623 dOj 5 /__ dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 624 i=-k 625 """ 626 627 return 0.4 * sum(data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te), axis=2)
628 629 630 631 # Original S2 partial derivative. 632 ################################# 633 634 # {S2} with or without diffusion parameters. 635
636 -def calc_S2_djw_dS2(data, params, j):
637 """Spectral density gradient. 638 639 Calculate the spectral desity values for the S2 partial derivative of the original model-free 640 formula with the single parameter {S2} with or without diffusion tensor parameters. 641 642 The model-free gradient is:: 643 644 _k_ 645 dJ(w) 2 \ 1 646 ----- = - > ci . ti ------------. 647 dS2 5 /__ 1 + (w.ti)^2 648 i=-k 649 """ 650 651 return 0.4 * sum(data.ci * data.ti * data.fact_ti, axis=2)
652 653 654 # {S2, te} with or without diffusion parameters. 655
656 -def calc_S2_te_djw_dS2(data, params, j):
657 """Spectral density gradient. 658 659 Calculate the spectral desity values for the S2 partial derivative of the original model-free 660 formula with the parameters {S2, te} with or without diffusion tensor parameters. 661 662 The model-free gradient is:: 663 664 _k_ 665 dJ(w) 2 \ / 1 (te + ti)te \ 666 ----- = - > ci . ti | ------------ - ------------------------- |. 667 dS2 5 /__ \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 668 i=-k 669 """ 670 671 return 0.4 * sum(data.ci * data.ti * (data.fact_ti - data.fact_te), axis=2)
672 673 674 675 # Original te partial derivative. 676 ################################# 677 678 # {S2, te} with or without diffusion parameters. 679
680 -def calc_S2_te_djw_dte(data, params, j):
681 """Spectral density gradient. 682 683 Calculate the spectral desity values for the te partial derivative of the original model-free 684 formula with the parameters {S2, te} with or without diffusion tensor parameters. 685 686 The model-free gradient is:: 687 688 _k_ 689 dJ(w) 2 \ (te + ti)^2 - (w.te.ti)^2 690 ----- = - (1 - S2) > ci . ti^2 -----------------------------. 691 dte 5 /__ ((te + ti)^2 + (w.te.ti)^2)^2 692 i=-k 693 """ 694 695 return 0.4 * data.one_s2 * sum(data.ci * data.fact_djw_dte, axis=2)
696 697 698 699 # Extended Gj partial derivative. 700 ################################# 701 702 # {S2f, S2, ts} with diffusion parameters. 703
704 -def calc_diff_S2f_S2_ts_djw_dGj(data, params, j):
705 """Spectral density gradient. 706 707 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 708 formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 709 710 The formula is:: 711 712 _k_ 713 dJ(w) 2 \ dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 714 ----- = - > ci . --- | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- |. 715 dGj 5 /__ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 716 i=-k 717 """ 718 719 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
720 721
722 -def calc_ellipsoid_S2f_S2_ts_djw_dGj(data, params, j):
723 """Spectral density gradient. 724 725 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 726 formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 727 728 The formula is:: 729 730 _k_ 731 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 732 ----- = - > | ci . --- | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- | 733 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 734 i=-k 735 736 dci / S2 (S2f - S2)(ts + ti)ts \ \ 737 + --- . ti | ------------ + ------------------------- | |. 738 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 739 """ 740 741 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
742 743 744 # {S2f, tf, S2, ts} with diffusion parameters. 745
746 -def calc_diff_S2f_tf_S2_ts_djw_dGj(data, params, j):
747 """Spectral density gradient. 748 749 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 750 formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor parameters. 751 752 The formula is:: 753 754 _k_ 755 dJ(w) 2 \ dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 756 ----- = - > ci . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- |. 757 dGj 5 /__ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 758 i=-k 759 """ 760 761 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
762 763
764 -def calc_ellipsoid_S2f_tf_S2_ts_djw_dGj(data, params, j):
765 """Spectral density gradient. 766 767 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 768 formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor parameters. 769 770 The formula is:: 771 772 _k_ 773 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 774 ----- = - > | ci . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- | 775 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 776 i=-k 777 778 dci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 779 + --- . ti | ------------ + ------------------------- + ------------------------- | |. 780 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 781 """ 782 783 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
784 785 786 787 # Extended Oj partial derivative. 788 ################################# 789 790 # {S2f, S2, ts} with diffusion parameters. 791
792 -def calc_diff_S2f_S2_ts_djw_dOj(data, params, j):
793 """Spectral density gradient. 794 795 Calculate the spectral desity values for the O partial derivative of the extended model-free 796 formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 797 798 The formula is:: 799 800 _k_ 801 dJ(w) 2 \ dci / S2 (S2f - S2)(ts + ti)ts \ 802 ----- = - > --- . ti | ------------ + ------------------------- |. 803 dOj 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 804 i=-k 805 """ 806 807 return 0.4 * sum(data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
808 809 810 # {S2f, tf, S2, ts} with diffusion parameters. 811
812 -def calc_diff_S2f_tf_S2_ts_djw_dOj(data, params, j):
813 """Spectral density gradient. 814 815 Calculate the spectral desity values for the O partial derivative of the extended model-free 816 formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor parameters. 817 818 The formula is:: 819 820 _k_ 821 dJ(w) 2 \ dci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 822 ----- = - > --- . ti | ------------ + ------------------------- + ------------------------- |. 823 dOj 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 824 i=-k 825 """ 826 827 return 0.4 * sum(data.dci[j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
828 829 830 831 # Extended S2 partial derivative. 832 ################################# 833 834 # {S2f, S2, ts} and {S2f, tf, S2, ts} with or without diffusion parameters. 835
836 -def calc_S2f_S2_ts_djw_dS2(data, params, j):
837 """Spectral density gradient. 838 839 Calculate the spectral desity values for the S2 partial derivative of the extended model-free 840 formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} with or without diffusion tensor 841 parameters. 842 843 The formula is:: 844 845 _k_ 846 dJ(w) 2 \ / 1 (ts + ti).ts \ 847 ----- = - > ci . ti | ------------ - ------------------------- |. 848 dS2 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 849 i=-k 850 """ 851 852 return 0.4 * sum(data.ci * data.ti * (data.fact_ti - data.fact_ts), axis=2)
853 854 855 856 # Extended S2f partial derivative. 857 ################################## 858 859 # {S2f, S2, ts} with or without diffusion parameters. 860
861 -def calc_S2f_S2_ts_djw_dS2f(data, params, j):
862 """Spectral density gradient. 863 864 Calculate the spectral desity values for the S2f partial derivative of the extended model-free 865 formula with the parameters {S2f, S2, ts} with or without diffusion tensor parameters. 866 867 The formula is:: 868 869 _k_ 870 dJ(w) 2 \ (ts + ti).ts 871 ----- = - > ci . ti -------------------------. 872 dS2f 5 /__ (ts + ti)^2 + (w.ts.ti)^2 873 i=-k 874 """ 875 876 return 0.4 * sum(data.ci * data.ti * data.fact_ts, axis=2)
877 878 879 # {S2f, tf, S2, ts} with or without diffusion parameters. 880
881 -def calc_S2f_tf_S2_ts_djw_dS2f(data, params, j):
882 """Spectral density gradient. 883 884 Calculate the spectral desity values for the S2f partial derivative of the extended model-free 885 formula with the parameters {S2f, tf, S2, ts} with or without diffusion tensor parameters. 886 887 The formula is:: 888 889 _k_ 890 dJ(w) 2 \ / (tf + ti).tf (ts + ti).ts \ 891 ----- = - - > ci . ti | ------------------------- - ------------------------- |. 892 dS2f 5 /__ \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 893 i=-k 894 """ 895 896 return -0.4 * sum(data.ci * data.ti * (data.fact_tf - data.fact_ts), axis=2)
897 898 899 900 # Extended tf partial derivative. 901 ################################# 902 903 # {S2f, tf, S2, ts} with or without diffusion parameters. 904
905 -def calc_S2f_tf_S2_ts_djw_dtf(data, params, j):
906 """Spectral density gradient. 907 908 Calculate the spectral desity values for the tf partial derivative of the extended model-free 909 formula with the parameters {S2f, tf, S2, ts} with or without diffusion tensor parameters. 910 911 The formula is:: 912 913 _k_ 914 dJ(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 915 ----- = - (1 - S2f) > ci . ti^2 -----------------------------. 916 dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 917 i=-k 918 """ 919 920 return 0.4 * data.one_s2f * sum(data.ci * data.fact_djw_dtf, axis=2)
921 922 923 924 # Extended ts partial derivative. 925 ################################# 926 927 # {S2f, S2, ts} and {S2f, tf, S2, ts} with or without diffusion parameters. 928
929 -def calc_S2f_S2_ts_djw_dts(data, params, j):
930 """Spectral density gradient. 931 932 Calculate the spectral desity values for the ts partial derivative of the extended model-free 933 formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} with or without diffusion tensor 934 parameters. 935 936 The formula is:: 937 938 _k_ 939 dJ(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 940 ----- = - (S2f - S2) > ci . ti^2 -----------------------------. 941 dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 942 i=-k 943 """ 944 945 return 0.4 * data.s2f_s2 * sum(data.ci * data.fact_djw_dts, axis=2)
946 947 948 949 # Extended 2 Gj partial derivative. 950 ################################### 951 952 # {S2f, S2s, ts} with diffusion parameters. 953
954 -def calc_diff_S2f_S2s_ts_djw_dGj(data, params, j):
955 """Spectral density gradient. 956 957 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 958 formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 959 960 The formula is:: 961 962 _k_ 963 dJ(w) 2 \ dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 964 ----- = - S2f > ci . --- | S2s ---------------- + (1 - S2s)ts^2 ----------------------------- |. 965 dGj 5 /__ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 966 i=-k 967 """ 968 969 return 0.4 * params[data.s2f_i] * sum(data.ci * data.dti[j] * (params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2s * data.fact_ts_djw_dti), axis=2)
970 971
972 -def calc_ellipsoid_S2f_S2s_ts_djw_dGj(data, params, j):
973 """Spectral density gradient. 974 975 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 976 formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 977 978 The formula is:: 979 980 _k_ 981 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 982 ----- = - S2f > | ci . --- | S2s ---------------- + (1 - S2s)ts^2 ----------------------------- | 983 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 984 i=-k 985 986 dci / S2s (1 - S2s)(ts + ti)ts \ \ 987 + --- . ti | ------------ + ------------------------- | |. 988 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 989 """ 990 991 return 0.4 * params[data.s2f_i] * sum(data.ci * data.dti[j] * (params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2s * data.fact_ts_djw_dti) + data.dci[j] * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
992 993 994 # {S2f, tf, S2s, ts} with diffusion parameters. 995
996 -def calc_diff_S2f_tf_S2s_ts_djw_dGj(data, params, j):
997 """Spectral density gradient. 998 999 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 1000 formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor parameters. 1001 1002 The formula is:: 1003 1004 _k_ 1005 dJ(w) 2 \ dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1006 ----- = - > ci . --- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- | 1007 dGj 5 /__ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1008 i=-k 1009 """ 1010 1011 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
1012 1013
1014 -def calc_ellipsoid_S2f_tf_S2s_ts_djw_dGj(data, params, j):
1015 """Spectral density gradient. 1016 1017 Calculate the spectral desity values for the Gj partial derivative of the extended model-free 1018 formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor parameters. 1019 1020 The formula is:: 1021 1022 _k_ 1023 dJ(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1024 ----- = - > | ci . --- | S2f.S2s ---------------- + (1 - S2f).tf^2 ----------------------------- + S2f(1 - S2s).ts^2 ----------------------------- | 1025 dGj 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1026 i=-k 1027 1028 dci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 1029 + --- . ti | ------------ + ------------------------- + ------------------------- | |. 1030 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1031 """ 1032 1033 return 0.4 * sum(data.ci * data.dti[j] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.dci[j] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
1034 1035 1036 1037 # Extended 2 Oj partial derivative. 1038 ################################### 1039 1040 # {S2f, S2s, ts} with diffusion parameters. 1041
1042 -def calc_diff_S2f_S2s_ts_djw_dOj(data, params, j):
1043 """Spectral density gradient. 1044 1045 Calculate the spectral desity values for the O partial derivative of the extended model-free 1046 formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 1047 1048 The formula is:: 1049 1050 _k_ 1051 dJ(w) 2 \ dci / S2s (1 - S2s)(ts + ti)ts \ 1052 ----- = - S2f > --- . ti | ------------ + ------------------------- |. 1053 dOj 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1054 i=-k 1055 """ 1056 1057 return 0.4 * params[data.s2f_i] * sum(data.dci[j] * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
1058 1059 1060 # {S2f, tf, S2s, ts} with diffusion parameters. 1061
1062 -def calc_diff_S2f_tf_S2s_ts_djw_dOj(data, params, j):
1063 """Spectral density gradient. 1064 1065 Calculate the spectral desity values for the O partial derivative of the extended model-free 1066 formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor parameters. 1067 1068 The formula is:: 1069 1070 _k_ 1071 dJ(w) 2 \ dci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 1072 ----- = - > --- . ti | ------------ + ------------------------- + ------------------------- |. 1073 dOj 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1074 i=-k 1075 """ 1076 1077 return 0.4 * sum(data.dci[j] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
1078 1079 1080 1081 # Extended 2 S2f partial derivative. 1082 ################################### 1083 1084 # {S2f, S2s, ts} with or without diffusion parameters.. 1085
1086 -def calc_S2f_S2s_ts_djw_dS2f(data, params, j):
1087 """Spectral density gradient. 1088 1089 Calculate the spectral desity values for the S2f partial derivative of the extended model-free 1090 formula with the parameters {S2f, S2s, ts} with or without diffusion tensor parameters. 1091 1092 The formula is:: 1093 1094 _k_ 1095 dJ(w) 2 \ / S2s (1 - S2s)(ts + ti).ts \ 1096 ----- = - > ci . ti | ------------ + ------------------------- |. 1097 dS2f 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1098 i=-k 1099 """ 1100 1101 return 0.4 * sum(data.ci * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
1102 1103 1104 # {S2f, tf, S2s, ts} with or without diffusion parameters.. 1105
1106 -def calc_S2f_tf_S2s_ts_djw_dS2f(data, params, j):
1107 """Spectral density gradient. 1108 1109 Calculate the spectral desity values for the S2f partial derivative of the extended model-free 1110 formula with the parameters {S2f, tf, S2s, ts} with or without diffusion tensor parameters. 1111 1112 The formula is:: 1113 1114 _k_ 1115 dJ(w) 2 \ / S2s (tf + ti).tf (1 - S2s)(ts + ti).ts \ 1116 ----- = - > ci . ti | ------------ - ------------------------- + ------------------------- |. 1117 dS2f 5 /__ \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1118 i=-k 1119 """ 1120 1121 return 0.4 * sum(data.ci * data.ti * (params[data.s2s_i] * data.fact_ti - data.fact_tf + data.one_s2s * data.fact_ts), axis=2)
1122 1123 1124 1125 # Extended 2 S2s partial derivative. 1126 #################################### 1127 1128 # {S2f, S2s, ts} and {S2f, tf, S2s, ts} with or without diffusion parameters. 1129
1130 -def calc_S2f_tf_S2s_ts_djw_dS2s(data, params, j):
1131 """Spectral density gradient. 1132 1133 Calculate the spectral desity values for the S2s partial derivative of the extended model-free 1134 formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion 1135 tensor parameters. 1136 1137 The formula is:: 1138 1139 _k_ 1140 dJ(w) 2 \ / 1 (ts + ti).ts \ 1141 ----- = - S2f > ci . ti | ------------ - ------------------------- |. 1142 dS2s 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1143 i=-k 1144 """ 1145 1146 return 0.4 * params[data.s2f_i] * sum(data.ci * data.ti * (data.fact_ti - data.fact_ts), axis=2)
1147 1148 1149 1150 # Extended 2 tf partial derivative. 1151 ################################### 1152 1153 # {S2f, tf, S2s, ts} with or without diffusion parameters. 1154
1155 -def calc_S2f_tf_S2s_ts_djw_dtf(data, params, j):
1156 """Spectral density gradient. 1157 1158 Calculate the spectral desity values for the tf partial derivative of the extended model-free 1159 formula with the parameters {S2f, tf, S2s, ts} with or without diffusion tensor parameters. 1160 1161 The formula is:: 1162 1163 _k_ 1164 dJ(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 1165 ----- = - (1 - S2f) > ci . ti^2 -----------------------------. 1166 dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 1167 i=-k 1168 """ 1169 1170 return 0.4 * data.one_s2f * sum(data.ci * data.fact_djw_dtf, axis=2)
1171 1172 1173 1174 # Extended 2 ts partial derivative. 1175 ################################### 1176 1177 # {S2f, S2s, ts} and {S2f, tf, S2s, ts} with or without diffusion parameters. 1178
1179 -def calc_S2f_S2s_ts_djw_dts(data, params, j):
1180 """Spectral density gradient. 1181 1182 Calculate the spectral desity values for the ts partial derivative of the extended model-free 1183 formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion 1184 tensor parameters. 1185 1186 The formula is:: 1187 1188 _k_ 1189 dJ(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 1190 ----- = - S2f(1 - S2s) > ci . ti^2 -----------------------------. 1191 dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 1192 i=-k 1193 """ 1194 1195 return 0.4 * data.s2f_s2 * sum(data.ci * data.fact_djw_dts, axis=2)
1196 1197 1198 1199 1200 ############################## 1201 # Spectral density Hessians. # 1202 ############################## 1203 1204 """ 1205 The spectral density Hessians 1206 ============================= 1207 1208 Data structure: data.d2jw 1209 Dimension: 4D, (number of NMR frequencies, 5 spectral density frequencies, model-free 1210 parameters, model-free parameters) 1211 Type: numpy 4D matrix, float64 1212 Dependencies: None 1213 Required by: data.d2ri 1214 1215 1216 Formulae 1217 ======== 1218 1219 Original: Model-free parameter - Model-free parameter:: 1220 1221 _k_ 1222 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (te + ti)^3 + 3.w^2.te^3.ti(te + ti) - (w.te)^4.ti^3 \ 1223 ------- = - > | -2ci --- . --- | S2.w^2.ti ---------------- + (1 - S2)te^2 ---------------------------------------------------- | 1224 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((te + ti)^2 + (w.te.ti)^2)^3 / 1225 i=-k 1226 1227 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1228 + | --- . --- + --- . --- + ci ------- | | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 1229 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1230 1231 1232 d2ci / S2 (1 - S2)(te + ti)te \ \ 1233 + ------- ti | ------------ + ------------------------- | |, 1234 dGj.dGk \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 1235 1236 1237 _k_ 1238 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1239 ------- = - > | --- . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 1240 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1241 i=-k 1242 1243 d2ci / S2 (1 - S2)(te + ti)te \ \ 1244 + ------- ti | ------------ + ------------------------- | |, 1245 dGj.dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 1246 1247 1248 _k_ 1249 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1250 ------- = - > | ci . --- | ---------------- - te^2 ----------------------------- | 1251 dGj.dS2 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1252 i=-k 1253 1254 dci / 1 (te + ti)te \ \ 1255 + --- . ti | ------------ - ------------------------- | |, 1256 dGj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 1257 1258 1259 _k_ 1260 d2J(w) 2 \ / dti (te + ti)^2 - 3(w.te.ti)^2 dci (te + ti)^2 - (w.te.ti)^2 \ 1261 ------- = - (1 - S2) > | 2ci . --- . te . ti . (te + ti) ----------------------------- + --- . ti^2 ----------------------------- |, 1262 dGj.dte 5 /__ \ dGj ((te + ti)^2 + (w.te.ti)^2)^3 dGj ((te + ti)^2 + (w.te.ti)^2)^2 / 1263 i=-k 1264 1265 1266 _k_ 1267 d2J(w) 2 \ d2ci / S2 (1 - S2)(te + ti)te \ 1268 ------- = - > ------- . ti | ------------ + ------------------------- |, 1269 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 1270 i=-k 1271 1272 1273 _k_ 1274 d2J(w) 2 \ dci / 1 (te + ti)te \ 1275 ------- = - > --- . ti | ------------ - ------------------------- |, 1276 dOj.dS2 5 /__ dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 1277 i=-k 1278 1279 1280 _k_ 1281 d2J(w) 2 \ dci (te + ti)^2 - (w.te.ti)^2 1282 ------- = - (1 - S2) > --- . ti^2 -----------------------------, 1283 dOj.dte 5 /__ dOj ((te + ti)^2 + (w.te.ti)^2)^2 1284 i=-k 1285 1286 1287 d2J(w) 1288 ------ = 0, 1289 dS2**2 1290 1291 1292 _k_ 1293 d2J(w) 2 \ (te + ti)^2 - (w.te.ti)^2 1294 ------- = - - > ci . ti^2 -----------------------------, 1295 dS2.dte 5 /__ ((te + ti)^2 + (w.te.ti)^2)^2 1296 i=-k 1297 1298 1299 _k_ 1300 d2J(w) 4 \ (te + ti)^3 + 3.w^2.ti^3.te.(te + ti) - (w.ti)^4.te^3 1301 ------ = - - (1 - S2) > ci . ti^2 -----------------------------------------------------. 1302 dte**2 5 /__ ((te + ti)^2 + (w.te.ti)^2)^3 1303 i=-k 1304 1305 1306 Original: Other parameters:: 1307 1308 d2J(w) d2J(w) d2J(w) 1309 -------- = 0, -------- = 0, ------ = 0, 1310 dS2.dRex dS2.dcsa dS2.dr 1311 1312 1313 d2J(w) d2J(w) d2J(w) 1314 -------- = 0, -------- = 0, ------ = 0, 1315 dte.dRex dte.dcsa dte.dr 1316 1317 1318 d2J(w) d2J(w) d2J(w) 1319 ------- = 0, --------- = 0, ------- = 0, 1320 dRex**2 dRex.dcsa dRex.dr 1321 1322 1323 d2J(w) d2J(w) 1324 ------- = 0, ------- = 0, 1325 dcsa**2 dcsa.dr 1326 1327 1328 d2J(w) 1329 ------ = 0. 1330 dr**2 1331 1332 1333 Extended: Model-free parameter - Model-free parameter:: 1334 1335 _k_ 1336 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 1337 ------- = - > | -2ci --- . --- | S2.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 1338 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 1339 i=-k 1340 1341 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 1342 + (S2f - S2)ts^2 ---------------------------------------------------- | 1343 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 1344 1345 1346 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 1347 + | --- . --- + --- . --- + ci ------- | | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- 1348 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 1349 1350 1351 (ts + ti)^2 - (w.ts.ti)^2 \ 1352 + (S2f - S2)ts^2 ----------------------------- | 1353 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1354 1355 1356 d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 1357 + ------- . ti | ------------ + ------------------------- + ------------------------- | |, 1358 dGj.dGk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1359 1360 1361 _k_ 1362 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1363 ------- = - > | --- . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- | 1364 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1365 i=-k 1366 1367 d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 1368 + ------- . ti | ------------ + ------------------------- + ------------------------- | |, 1369 dGj.dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1370 1371 1372 _k_ 1373 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1374 ------- = - > | ci . --- | ---------------- - ts^2 ----------------------------- | 1375 dGj.dS2 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1376 i=-k 1377 1378 dci / 1 (ts + ti)ts \ \ 1379 + --- . ti | ------------ - ------------------------- | |, 1380 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1381 1382 1383 _k_ 1384 d2J(w) 2 \ / dti / (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1385 -------- = - - > | ci . --- | tf^2 ----------------------------- - ts^2 ----------------------------- | 1386 dGj.dS2f 5 /__ \ dGj \ ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1387 i=-k 1388 1389 dci / (tf + ti)tf (ts + ti)ts \ \ 1390 + --- . ti | ------------------------- - ------------------------- | |, 1391 dGj \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1392 1393 1394 _k_ 1395 d2J(w) 2 \ / dti (tf + ti)^2 - 3(w.tf.ti)^2 dci (tf + ti)^2 - (w.tf.ti)^2 \ 1396 ------- = - (1 - S2f) > | 2ci . --- . tf . ti . (tf + ti) ----------------------------- + --- . ti^2 ----------------------------- |, 1397 dGj.dtf 5 /__ \ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 dGj ((tf + ti)^2 + (w.tf.ti)^2)^2 / 1398 i=-k 1399 1400 1401 _k_ 1402 d2J(w) 2 \ / dti (ts + ti)^2 - 3(w.ts.ti)^2 dci (ts + ti)^2 - (w.ts.ti)^2 \ 1403 ------- = - (S2f - S2) > | 2ci . --- . ts . ti . (ts + ti) ----------------------------- + --- . ti^2 ----------------------------- |, 1404 dGj.dts 5 /__ \ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1405 i=-k 1406 1407 1408 _k_ 1409 d2J(w) 2 \ d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 1410 ------- = - > ------- . ti | ------------ + ------------------------- + ------------------------- |, 1411 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1412 i=-k 1413 1414 1415 _k_ 1416 d2J(w) 2 \ dci / 1 (ts + ti)ts \ 1417 ------- = - > --- . ti | ------------ - ------------------------- |, 1418 dOj.dS2 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1419 i=-k 1420 1421 1422 _k_ 1423 d2J(w) 2 \ dci / (tf + ti)tf (ts + ti)ts \ 1424 -------- = - - > --- . ti | ------------------------- - ------------------------- |, 1425 dOj.dS2f 5 /__ dOj \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1426 i=-k 1427 1428 1429 _k_ 1430 d2J(w) 2 \ dci (tf + ti)^2 - (w.tf.ti)^2 1431 ------- = - (1 - S2f) > --- . ti^2 -----------------------------, 1432 dOj.dtf 5 /__ dOj ((tf + ti)^2 + (w.tf.ti)^2)^2 1433 i=-k 1434 1435 1436 _k_ 1437 d2J(w) 2 \ dci (ts + ti)^2 - (w.ts.ti)^2 1438 ------- = - (S2f - S2) > --- . ti^2 -----------------------------, 1439 dOj.dts 5 /__ dOj ((ts + ti)^2 + (w.ts.ti)^2)^2 1440 i=-k 1441 1442 1443 d2J(w) d2J(w) d2J(w) 1444 ------ = 0, -------- = 0, ------- = 0, 1445 dS2**2 dS2.dS2f dS2.dtf 1446 1447 1448 _k_ 1449 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 1450 ------- = - - > ci . ti^2 -----------------------------, 1451 dS2.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 1452 i=-k 1453 1454 1455 d2J(w) 1456 ------- = 0, 1457 dS2f**2 1458 1459 1460 _k_ 1461 d2J(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 1462 -------- = - - > ci . ti^2 -----------------------------, 1463 dS2f.dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 1464 i=-k 1465 1466 1467 _k_ 1468 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 1469 -------- = - > ci . ti^2 -----------------------------, 1470 dS2f.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 1471 i=-k 1472 1473 1474 _k_ 1475 d2J(w) 4 \ (tf + ti)^3 + 3.w^2.ti^3.tf.(tf + ti) - (w.ti)^4.tf^3 1476 ------ = - - (1 - S2f) > ci . ti^2 -----------------------------------------------------, 1477 dtf**2 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^3 1478 i=-k 1479 1480 1481 d2J(w) 1482 ------- = 0, 1483 dtf.dts 1484 1485 1486 _k_ 1487 d2J(w) 4 \ (ts + ti)^3 + 3.w^2.ti^3.ts.(ts + ti) - (w.ti)^4.ts^3 1488 ------ = - - (S2f - S2) > ci . ti^2 -----------------------------------------------------, 1489 dts**2 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^3 1490 i=-k 1491 1492 1493 Extended: Other parameters:: 1494 1495 d2J(w) d2J(w) d2J(w) 1496 --------- = 0, --------- = 0, ------- = 0, 1497 dS2f.dRex dS2f.dcsa dS2f.dr 1498 1499 1500 d2J(w) d2J(w) d2J(w) 1501 -------- = 0, -------- = 0, ------ = 0, 1502 dS2.dRex dS2.dcsa dS2.dr 1503 1504 1505 d2J(w) d2J(w) d2J(w) 1506 -------- = 0, -------- = 0, ------ = 0, 1507 dtf.dRex dtf.dcsa dtf.dr 1508 1509 1510 d2J(w) d2J(w) d2J(w) 1511 -------- = 0, -------- = 0, ------ = 0, 1512 dts.dRex dts.dcsa dts.dr 1513 1514 1515 d2J(w) d2J(w) d2J(w) 1516 ------- = 0, --------- = 0, ------- = 0, 1517 dRex**2 dRex.dcsa dRex.dr 1518 1519 1520 d2J(w) d2J(w) 1521 ------- = 0, ------- = 0, 1522 dcsa**2 dcsa.dr 1523 1524 1525 d2J(w) 1526 ------ = 0. 1527 dr**2 1528 1529 1530 Extended 2: Model-free parameter - Model-free parameter:: 1531 1532 _k_ 1533 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 1534 ------- = - > | -2ci --- . --- | S2f.S2s.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 1535 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 1536 i=-k 1537 1538 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 1539 + S2f(1 - S2s)ts^2 ---------------------------------------------------- | 1540 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 1541 1542 1543 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 1544 + | --- . --- + --- . --- + ci ------- | | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- 1545 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 1546 1547 1548 (ts + ti)^2 - (w.ts.ti)^2 \ 1549 + S2f(1 - S2s)ts^2 ----------------------------- | 1550 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1551 1552 1553 d2ci / S2f.S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 1554 + ------- . ti | ------------ + ------------------------- + ------------------------- | |, 1555 dGj.dGk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1556 1557 1558 _k_ 1559 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1560 ------- = - > | --- . --- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- | 1561 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1562 i=-k 1563 1564 d2ci / S2f.S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 1565 + ------- . ti | ------------ + ------------------------- + ------------------------- | |, 1566 dGj.dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1567 1568 1569 _k_ 1570 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1571 -------- = - > | ci . --- | S2s ---------------- - tf^2 ----------------------------- + (1 - S2s)ts^2 ----------------------------- | 1572 dGj.dS2f 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1573 i=-k 1574 1575 dci / S2s (tf + ti)tf (1 - S2s)(ts + ti)ts \ \ 1576 + --- . ti | ------------ - ------------------------- + ------------------------- | |, 1577 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1578 1579 1580 _k_ 1581 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 1582 -------- = - S2f > | ci . --- | ---------------- - ts^2 ----------------------------- | 1583 dGj.dS2s 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1584 i=-k 1585 1586 dci / 1 (ts + ti)ts \ \ 1587 + --- . ti | ------------ - ------------------------- | |, 1588 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 1589 1590 1591 _k_ 1592 d2J(w) 2 \ / dti (tf + ti)^2 - 3(w.tf.ti)^2 dci (tf + ti)^2 - (w.tf.ti)^2 \ 1593 ------- = - (1 - S2f) > | 2ci . --- . tf . ti . (tf + ti) ----------------------------- + --- . ti^2 ----------------------------- |, 1594 dGj.dtf 5 /__ \ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 dGj ((tf + ti)^2 + (w.tf.ti)^2)^2 / 1595 i=-k 1596 1597 1598 _k_ 1599 d2J(w) 2 \ / dti (ts + ti)^2 - 3(w.ts.ti)^2 dci (ts + ti)^2 - (w.ts.ti)^2 \ 1600 ------- = - S2f(1 - S2s) > | 2ci . --- . ts . ti . (ts + ti) ----------------------------- + --- . ti^2 ----------------------------- |, 1601 dGj.dts 5 /__ \ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 / 1602 i=-k 1603 1604 1605 _k_ 1606 d2J(w) 2 \ d2ci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 1607 ------- = - > ------- . ti | ------------ + ------------------------- + ------------------------- |, 1608 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1609 i=-k 1610 1611 1612 _k_ 1613 d2J(w) 2 \ dci / S2s (tf + ti)tf (1 - S2s)(ts + ti)ts \ 1614 -------- = - > --- . ti | ------------ - ------------------------- + ------------------------- |, 1615 dOj.dS2f 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1616 i=-k 1617 1618 1619 _k_ 1620 d2J(w) 2 \ dci / 1 (ts + ti)ts \ 1621 -------- = - S2f > --- . ti | ------------ - ------------------------- |, 1622 dOj.dS2s 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1623 i=-k 1624 1625 1626 _k_ 1627 d2J(w) 2 \ dci (tf + ti)^2 - (w.tf.ti)^2 1628 ------- = - (1 - S2f) > --- . ti^2 -----------------------------, 1629 dOj.dtf 5 /__ dOj ((tf + ti)^2 + (w.tf.ti)^2)^2 1630 i=-k 1631 1632 1633 _k_ 1634 d2J(w) 2 \ dci (ts + ti)^2 - (w.ts.ti)^2 1635 ------- = - S2f(1 - S2s) > --- . ti^2 -----------------------------, 1636 dOj.dts 5 /__ dOj ((ts + ti)^2 + (w.ts.ti)^2)^2 1637 i=-k 1638 1639 1640 d2J(w) 1641 ------- = 0, 1642 dS2f**2 1643 1644 1645 _k_ 1646 d2J(w) 2 \ / 1 (ts + ti).ts \ 1647 --------- = - > ci . ti | ------------ - ------------------------- |, 1648 dS2f.dS2s 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 1649 i=-k 1650 1651 1652 _k_ 1653 d2J(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 1654 -------- = - - > ci . ti^2 -----------------------------, 1655 dS2f.dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 1656 i=-k 1657 1658 1659 _k_ 1660 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 1661 -------- = - (1 - S2s) > ci . ti^2 -----------------------------, 1662 dS2f.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 1663 i=-k 1664 1665 1666 d2J(w) d2J(w) 1667 ------- = 0, -------- = 0, 1668 dS2s**2 dS2s.dtf 1669 1670 1671 _k_ 1672 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 1673 -------- = - - S2f > ci . ti^2 -----------------------------, 1674 dS2s.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 1675 i=-k 1676 1677 1678 _k_ 1679 d2J(w) 4 \ (tf + ti)^3 + 3.w^2.ti^3.tf.(tf + ti) - (w.ti)^4.tf^3 1680 ------ = - - (1 - S2f) > ci . ti^2 -----------------------------------------------------, 1681 dtf**2 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^3 1682 i=-k 1683 1684 1685 d2J(w) 1686 ------- = 0, 1687 dtf.dts 1688 1689 1690 _k_ 1691 d2J(w) 4 \ (ts + ti)^3 + 3.w^2.ti^3.ts.(ts + ti) - (w.ti)^4.ts^3 1692 ------ = - - S2f(1 - S2s) > ci . ti^2 -----------------------------------------------------. 1693 dts**2 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^3 1694 i=-k 1695 1696 1697 1698 Extended 2: Other parameters:: 1699 1700 d2J(w) d2J(w) d2J(w) 1701 --------- = 0, --------- = 0, ------- = 0, 1702 dS2f.dRex dS2f.dcsa dS2f.dr 1703 1704 1705 d2J(w) d2J(w) d2J(w) 1706 --------- = 0, --------- = 0, ------- = 0, 1707 dS2s.dRex dS2s.dcsa dS2s.dr 1708 1709 1710 d2J(w) d2J(w) d2J(w) 1711 -------- = 0, -------- = 0, ------ = 0, 1712 dtf.dRex dtf.dcsa dtf.dr 1713 1714 1715 d2J(w) d2J(w) d2J(w) 1716 -------- = 0, -------- = 0, ------ = 0, 1717 dts.dRex dts.dcsa dts.dr 1718 1719 1720 d2J(w) d2J(w) d2J(w) 1721 ------- = 0, --------- = 0, ------- = 0, 1722 dRex**2 dRex.dcsa dRex.dr 1723 1724 1725 d2J(w) d2J(w) 1726 ------- = 0, ------- = 0, 1727 dcsa**2 dcsa.dr 1728 1729 1730 d2J(w) 1731 ------ = 0. 1732 dr**2 1733 """ 1734 1735 1736 # Original Gj - Gk partial derivative. 1737 ###################################### 1738 1739 # {} with diffusion parameters. 1740
1741 -def calc_diff_d2jw_dGjdGk(data, params, j, k):
1742 """Spectral density Hessian. 1743 1744 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1745 model-free formula with no parameters {} together with diffusion tensor parameters. 1746 1747 The model-free Hessian is:: 1748 1749 _k_ 1750 d2J(w) 2 \ / dti dti 3 - (w.ti)^2 d2ti 1 - (w.ti)^2 \ 1751 ------- = - > ci | -2 --- . --- w^2.ti ---------------- + ------- ---------------- |. 1752 dGj.dGk 5 /__ \ dGj dGk (1 + (w.ti)^2)^3 dGj.dGk (1 + (w.ti)^2)^2 / 1753 i=-k 1754 """ 1755 1756 return 0.4 * sum(data.ci * (-2.0 * data.dti[j] * data.dti[k] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.d2ti[j, k] * data.fact_ti_djw_dti), axis=2)
1757 1758
1759 -def calc_ellipsoid_d2jw_dGjdGk(data, params, j, k):
1760 """Spectral density Hessian. 1761 1762 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1763 model-free formula with no parameters {} together with diffusion tensor parameters. 1764 1765 The model-free Hessian is:: 1766 1767 _k_ 1768 d2J(w) 2 \ / dti dti 3 - (w.ti)^2 / dti dci dti dci d2ti \ 1 - (w.ti)^2 d2ci 1 \ 1769 ------- = - > | -2ci --- . --- w^2.ti ---------------- + | --- . --- + --- . --- + ci ------- | ---------------- + ------- ti ------------ |. 1770 dGj.dGk 5 /__ \ dGj dGk (1 + (w.ti)^2)^3 \ dGj dGk dGk dGj dGj.dGk / (1 + (w.ti)^2)^2 dGj.dGk 1 + (w.ti)^2 / 1771 i=-k 1772 """ 1773 1774 return 0.4 * sum(-2.0 * data.ci * data.dti[j] * data.dti[k] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * data.fact_ti_djw_dti + data.d2ci[j, k] * data.ti * data.fact_ti, axis=2)
1775 1776 1777 # {S2} with diffusion parameters. 1778
1779 -def calc_diff_S2_d2jw_dGjdGk(data, params, j, k):
1780 """Spectral density Hessian. 1781 1782 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1783 model-free formula with the parameter {S2} together with diffusion tensor parameters. 1784 1785 The model-free Hessian is:: 1786 1787 _k_ 1788 d2J(w) 2 \ / dti dti 3 - (w.ti)^2 d2ti 1 - (w.ti)^2 \ 1789 ------- = - S2 > ci | -2 --- . --- w^2.ti ---------------- + ------- ---------------- |. 1790 dGj.dGk 5 /__ \ dGj dGk (1 + (w.ti)^2)^3 dGj.dGk (1 + (w.ti)^2)^2 / 1791 i=-k 1792 """ 1793 1794 return 0.4 * params[data.s2_i] * sum(data.ci * (-2.0 * data.dti[j] * data.dti[k] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.d2ti[j, k] * data.fact_ti_djw_dti), axis=2)
1795 1796
1797 -def calc_ellipsoid_S2_d2jw_dGjdGk(data, params, j, k):
1798 """Spectral density Hessian. 1799 1800 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1801 model-free formula with the parameter {S2} together with diffusion tensor parameters. 1802 1803 The model-free Hessian is:: 1804 1805 _k_ 1806 d2J(w) 2 \ / dti dti 3 - (w.ti)^2 / dti dci dti dci d2ti \ 1 - (w.ti)^2 d2ci 1 \ 1807 ------- = - S2 > | -2ci --- . --- w^2.ti ---------------- + | --- . --- + --- . --- + ci ------- | ---------------- + ------- ti ------------ |. 1808 dGj.dGk 5 /__ \ dGj dGk (1 + (w.ti)^2)^3 \ dGj dGk dGk dGj dGj.dGk / (1 + (w.ti)^2)^2 dGj.dGk 1 + (w.ti)^2 / 1809 i=-k 1810 """ 1811 1812 return 0.4 * params[data.s2_i] * sum(-2.0 * data.ci * data.dti[j] * data.dti[k] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * data.fact_ti_djw_dti + data.d2ci[j, k] * data.ti * data.fact_ti, axis=2)
1813 1814 1815 # {S2, te} with diffusion parameters. 1816
1817 -def calc_diff_S2_te_d2jw_dGjdGk(data, params, j, k):
1818 """Spectral density Hessian. 1819 1820 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1821 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 1822 1823 The model-free Hessian is:: 1824 1825 _k_ 1826 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (te + ti)^3 + 3.w^2.te^3.ti(te + ti) - (w.te)^4.ti^3 \ 1827 ------- = - > ci | -2 --- . --- | S2.w^2.ti ---------------- + (1 - S2)te^2 ---------------------------------------------------- | 1828 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((te + ti)^2 + (w.te.ti)^2)^3 / 1829 i=-k 1830 1831 d2ti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ \ 1832 + ------- | S2 ---------------- + (1 - S2)te^2 ----------------------------- | |. 1833 dGj.dGk \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / / 1834 """ 1835 1836 # First component. 1837 a = -2.0 * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2 * params[data.te_i]**2 * (data.te_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.te_i]**3 * data.ti * data.te_ti - (data.frq_list_ext * params[data.te_i])**4 * data.ti**3) * data.inv_te_denom**3) 1838 1839 # Second component. 1840 b = data.d2ti[j, k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti) 1841 1842 return 0.4 * sum(data.ci * (a + b), axis=2)
1843 1844
1845 -def calc_ellipsoid_S2_te_d2jw_dGjdGk(data, params, j, k):
1846 """Spectral density Hessian. 1847 1848 Calculate the spectral desity values for the Gj - Gk double partial derivative of the original 1849 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 1850 1851 The model-free Hessian is:: 1852 1853 _k_ 1854 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (te + ti)^3 + 3.w^2.te^3.ti(te + ti) - (w.te)^4.ti^3 \ 1855 ------- = - > | -2ci --- . --- | S2.w^2.ti ---------------- + (1 - S2)te^2 ---------------------------------------------------- | 1856 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((te + ti)^2 + (w.te.ti)^2)^3 / 1857 i=-k 1858 1859 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1860 + | --- . --- + --- . --- + ci ------- | | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 1861 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1862 1863 1864 d2ci / S2 (1 - S2)(te + ti)te \ \ 1865 + ------- ti | ------------ + ------------------------- | |. 1866 dGj.dGk \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 1867 """ 1868 1869 # First component. 1870 a = -2.0 * data.ci * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2 * params[data.te_i]**2 * (data.te_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.te_i]**3 * data.ti * data.te_ti - (data.frq_list_ext * params[data.te_i])**4 * data.ti**3) * data.inv_te_denom**3) 1871 1872 # Second component. 1873 b = (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti) 1874 1875 # Third component. 1876 c = data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te) 1877 1878 return 0.4 * sum(a + b + c, axis=2)
1879 1880 1881 1882 # Original Gj - Oj partial derivative. 1883 ###################################### 1884 1885 1886 # {} with diffusion parameters. 1887
1888 -def calc_diff_d2jw_dGjdOj(data, params, j, k):
1889 """Spectral density Hessian. 1890 1891 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1892 model-free formula with no parameters {} together with diffusion tensor parameters. 1893 1894 The model-free Hessian is:: 1895 1896 _k_ 1897 d2J(w) 2 \ dci dti 1 - (w.ti)^2 1898 ------- = - > --- . --- . ----------------. 1899 dGj.dOj 5 /__ dOj dGj (1 + (w.ti)^2)^2 1900 i=-k 1901 """ 1902 1903 return 0.4 * sum(data.dci[j] * data.dti[k] * data.fact_ti_djw_dti, axis=2)
1904 1905
1906 -def calc_ellipsoid_d2jw_dGjdOj(data, params, j, k):
1907 """Spectral density Hessian. 1908 1909 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1910 model-free formula with no parameters {} together with diffusion tensor parameters. 1911 1912 The model-free Hessian is:: 1913 1914 _k_ 1915 d2J(w) 2 \ / dci dti 1 - (w.ti)^2 d2ci 1 \ 1916 ------- = - > | --- . --- . ---------------- + ------- ti ------------ |. 1917 dGj.dOj 5 /__ \ dOj dGj (1 + (w.ti)^2)^2 dGj.dOj 1 + (w.ti)^2 / 1918 i=-k 1919 """ 1920 1921 return 0.4 * sum(data.dci[j] * data.dti[k] * data.fact_ti_djw_dti + data.d2ci[k, j] * data.ti * data.fact_ti, axis=2)
1922 1923 1924 # {S2} with diffusion parameters. 1925
1926 -def calc_diff_S2_d2jw_dGjdOj(data, params, j, k):
1927 """Spectral density Hessian. 1928 1929 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1930 model-free formula with the parameter {S2} together with diffusion tensor parameters. 1931 1932 The model-free Hessian is:: 1933 1934 _k_ 1935 d2J(w) 2 \ dci dti 1 - (w.ti)^2 1936 ------- = - S2 > --- . --- . ----------------. 1937 dGj.dOj 5 /__ dOj dGj (1 + (w.ti)^2)^2 1938 i=-k 1939 """ 1940 1941 return 0.4 * params[data.s2_i] * sum(data.dci[j] * data.dti[k] * data.fact_ti_djw_dti, axis=2)
1942 1943
1944 -def calc_ellipsoid_S2_d2jw_dGjdOj(data, params, j, k):
1945 """Spectral density Hessian. 1946 1947 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1948 model-free formula with the parameter {S2} together with diffusion tensor parameters. 1949 1950 The model-free Hessian is:: 1951 1952 _k_ 1953 d2J(w) 2 \ / dci dti 1 - (w.ti)^2 d2ci 1 \ 1954 ------- = - S2 > | --- . --- . ---------------- + ------- ti ------------ |. 1955 dGj.dOj 5 /__ \ dOj dGj (1 + (w.ti)^2)^2 dGj.dOj 1 + (w.ti)^2 / 1956 i=-k 1957 """ 1958 1959 return 0.4 * params[data.s2_i] * sum(data.dci[j] * data.dti[k] * data.fact_ti_djw_dti + data.d2ci[k, j] * data.ti * data.fact_ti, axis=2)
1960 1961 1962 # {S2, te} with diffusion parameters. 1963
1964 -def calc_diff_S2_te_d2jw_dGjdOj(data, params, j, k):
1965 """Spectral density Hessian. 1966 1967 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1968 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 1969 1970 The model-free Hessian is:: 1971 1972 _k_ 1973 d2J(w) 2 \ dci dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1974 ------- = - > --- . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- |. 1975 dGj.dOj 5 /__ dOj dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1976 i=-k 1977 """ 1978 1979 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti), axis=2)
1980 1981
1982 -def calc_ellipsoid_S2_te_d2jw_dGjdOj(data, params, j, k):
1983 """Spectral density Hessian. 1984 1985 Calculate the spectral desity values for the Gj - Oj double partial derivative of the original 1986 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 1987 1988 The model-free Hessian is:: 1989 1990 _k_ 1991 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 1992 ------- = - > | --- . --- | S2 ---------------- + (1 - S2)te^2 ----------------------------- | 1993 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 1994 i=-k 1995 1996 d2ci / S2 (1 - S2)(te + ti)te \ \ 1997 + ------- ti | ------------ + ------------------------- | |. 1998 dGj.dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 1999 """ 2000 2001 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2 * data.fact_te_djw_dti) + data.d2ci[k, j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te), axis=2)
2002 2003 2004 2005 # Original Gj - S2 partial derivative. 2006 ###################################### 2007 2008 # {S2} with diffusion parameters. 2009
2010 -def calc_diff_S2_d2jw_dGjdS2(data, params, j, k):
2011 """Spectral density Hessian. 2012 2013 Calculate the spectral desity values for the Gj - S2 double partial derivative of the original 2014 model-free formula with the parameter {S2} together with diffusion tensor parameters. 2015 2016 The model-free Hessian is:: 2017 2018 _k_ 2019 d2J(w) 2 \ dti 1 - (w.ti)^2 2020 ------- = - > ci . --- ----------------. 2021 dGj.dS2 5 /__ dGj (1 + (w.ti)^2)^2 2022 i=-k 2023 """ 2024 2025 return 0.4 * sum(data.ci * data.dti[k] * data.fact_ti_djw_dti, axis=2)
2026 2027
2028 -def calc_ellipsoid_S2_d2jw_dGjdS2(data, params, j, k):
2029 """Spectral density Hessian. 2030 2031 Calculate the spectral desity values for the Gj - S2 double partial derivative of the original 2032 model-free formula with the parameter {S2} together with diffusion tensor parameters. 2033 2034 The model-free Hessian is:: 2035 2036 _k_ 2037 d2J(w) 2 \ / dti 1 - (w.ti)^2 dci 1 \ 2038 ------- = - > | ci . --- ---------------- + --- . ti ------------ |. 2039 dGj.dS2 5 /__ \ dGj (1 + (w.ti)^2)^2 dGj 1 + (w.ti)^2 / 2040 i=-k 2041 """ 2042 2043 return 0.4 * sum(data.ci * data.dti[k] * data.fact_ti_djw_dti + data.dci[k] * data.ti * data.fact_ti, axis=2)
2044 2045 2046 # {S2, te} with diffusion parameters. 2047
2048 -def calc_diff_S2_te_d2jw_dGjdS2(data, params, j, k):
2049 """Spectral density Hessian. 2050 2051 Calculate the spectral desity values for the Gj - S2 double partial derivative of the original 2052 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2053 2054 The model-free Hessian is:: 2055 2056 _k_ 2057 d2J(w) 2 \ dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 2058 ------- = - > ci . --- | ---------------- - te^2 ----------------------------- |. 2059 dGj.dS2 5 /__ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 2060 i=-k 2061 """ 2062 2063 return 0.4 * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_te_djw_dti), axis=2)
2064 2065
2066 -def calc_ellipsoid_S2_te_d2jw_dGjdS2(data, params, j, k):
2067 """Spectral density Hessian. 2068 2069 Calculate the spectral desity values for the Gj - S2 double partial derivative of the original 2070 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2071 2072 The model-free Hessian is:: 2073 2074 _k_ 2075 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (te + ti)^2 - (w.te.ti)^2 \ 2076 ------- = - > | ci . --- | ---------------- - te^2 ----------------------------- | 2077 dGj.dS2 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((te + ti)^2 + (w.te.ti)^2)^2 / 2078 i=-k 2079 2080 dci / 1 (te + ti)te \ \ 2081 + --- . ti | ------------ - ------------------------- | |. 2082 dGj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / / 2083 """ 2084 2085 return 0.4 * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_te_djw_dti) + data.dci[k] * data.ti * (data.fact_ti - data.fact_te), axis=2)
2086 2087 2088 2089 # Original Gj - te partial derivative. 2090 ####################################### 2091 2092 # {S2, te} with diffusion parameters. 2093
2094 -def calc_diff_S2_te_d2jw_dGjdte(data, params, j, k):
2095 """Spectral density Hessian. 2096 2097 Calculate the spectral desity values for the Gj - te double partial derivative of the original 2098 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2099 2100 The model-free Hessian is:: 2101 2102 _k_ 2103 d2J(w) 4 \ dti (te + ti)^2 - 3(w.te.ti)^2 2104 ------- = - (1 - S2) . te > ci . --- . ti . (te + ti) -----------------------------. 2105 dGj.dte 5 /__ dGj ((te + ti)^2 + (w.te.ti)^2)^3 2106 i=-k 2107 """ 2108 2109 return 0.8 * data.one_s2 * params[data.te_i] * sum(data.ci * data.dti[k] * data.ti * data.te_ti * (data.te_ti_sqrd - 3.0 * data.w_te_ti_sqrd) * data.inv_te_denom**3, axis=2)
2110 2111
2112 -def calc_ellipsoid_S2_te_d2jw_dGjdte(data, params, j, k):
2113 """Spectral density Hessian. 2114 2115 Calculate the spectral desity values for the Gj - te double partial derivative of the original 2116 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2117 2118 The model-free Hessian is:: 2119 2120 _k_ 2121 d2J(w) 2 \ / dti (te + ti)^2 - 3(w.te.ti)^2 dci (te + ti)^2 - (w.te.ti)^2 \ 2122 ------- = - (1 - S2) > | 2ci . --- . te . ti . (te + ti) ----------------------------- + --- . ti^2 ----------------------------- |. 2123 dGj.dte 5 /__ \ dGj ((te + ti)^2 + (w.te.ti)^2)^3 dGj ((te + ti)^2 + (w.te.ti)^2)^2 / 2124 i=-k 2125 """ 2126 2127 return 0.4 * data.one_s2 * sum(2.0 * data.ci * data.dti[k] * params[data.te_i] * data.ti * data.te_ti * (data.te_ti_sqrd - 3.0 * data.w_te_ti_sqrd) * data.inv_te_denom**3 + data.dci[k] * data.fact_djw_dte, axis=2)
2128 2129 2130 2131 # Original Oj - Ok partial derivative. 2132 ###################################### 2133 2134 # {} with diffusion parameters. 2135
2136 -def calc_diff_d2jw_dOjdOk(data, params, j, k):
2137 """Spectral density Hessian. 2138 2139 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 2140 original model-free formula with no parameters {} together with diffusion tensor parameters. 2141 2142 The model-free Hessian is:: 2143 2144 _k_ 2145 d2J(w) 2 \ d2ci ti 2146 ------- = - > ------- . ------------. 2147 dOj.dOk 5 /__ dOj.dOk 1 + (w.ti)^2 2148 i=-k 2149 """ 2150 2151 return 0.4 * sum(data.d2ci[j, k] * data.ti * data.fact_ti, axis=2)
2152 2153 2154 # {S2} with diffusion parameters. 2155
2156 -def calc_diff_S2_d2jw_dOjdOk(data, params, j, k):
2157 """Spectral density Hessian. 2158 2159 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 2160 original model-free formula with the parameter {S2} together with diffusion tensor parameters. 2161 2162 The model-free Hessian is:: 2163 2164 _k_ 2165 d2J(w) 2 \ d2ci ti 2166 ------- = - S2 > ------- . ------------. 2167 dOj.dOk 5 /__ dOj.dOk 1 + (w.ti)^2 2168 i=-k 2169 """ 2170 2171 return 0.4 * params[data.s2_i] * sum(data.d2ci[j, k] * data.ti * data.fact_ti, axis=2)
2172 2173 2174 # {S2, te} with diffusion parameters. 2175
2176 -def calc_diff_S2_te_d2jw_dOjdOk(data, params, j, k):
2177 """Spectral density Hessian. 2178 2179 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 2180 original model-free formula with the parameters {S2, te} together with diffusion tensor 2181 parameters. 2182 2183 The model-free Hessian is:: 2184 2185 _k_ 2186 d2J(w) 2 \ d2ci / S2 (1 - S2)(te + ti)te \ 2187 ------- = - > ------- . ti | ------------ + ------------------------- |. 2188 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 2189 i=-k 2190 """ 2191 2192 return 0.4 * sum(data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2 * data.fact_te), axis=2)
2193 2194 2195 2196 # Original Oj - S2 partial derivative. 2197 ###################################### 2198 2199 # {S2} with diffusion parameters. 2200
2201 -def calc_diff_S2_d2jw_dOjdS2(data, params, j, k):
2202 """Spectral density Hessian. 2203 2204 Calculate the spectral desity values for the Oj - S2 double partial derivative of the original 2205 model-free formula with the parameter {S2} together with diffusion tensor parameters. 2206 2207 The model-free Hessian is:: 2208 2209 _k_ 2210 d2J(w) 2 \ dci 1 2211 ------- = - > --- . ti ------------. 2212 dOj.dS2 5 /__ dOj 1 + (w.ti)^2 2213 i=-k 2214 """ 2215 2216 return 0.4 * sum(data.dci[k] * data.ti * data.fact_ti, axis=2)
2217 2218 2219 # {S2, te} with diffusion parameters. 2220
2221 -def calc_diff_S2_te_d2jw_dOjdS2(data, params, j, k):
2222 """Spectral density Hessian. 2223 2224 Calculate the spectral desity values for the Oj - S2 double partial derivative of the original 2225 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2226 2227 The model-free Hessian is:: 2228 2229 _k_ 2230 d2J(w) 2 \ dci / 1 (te + ti)te \ 2231 ------- = - > --- . ti | ------------ - ------------------------- |. 2232 dOj.dS2 5 /__ dOj \ 1 + (w.ti)^2 (te + ti)^2 + (w.te.ti)^2 / 2233 i=-k 2234 """ 2235 2236 return 0.4 * sum(data.dci[k] * data.ti * (data.fact_ti - data.fact_te), axis=2)
2237 2238 2239 2240 # Original Oj - te partial derivative. 2241 ###################################### 2242 2243 # {S2, te} with diffusion parameters. 2244
2245 -def calc_diff_S2_te_d2jw_dOjdte(data, params, j, k):
2246 """Spectral density Hessian. 2247 2248 Calculate the spectral desity values for the Oj - te double partial derivative of the original 2249 model-free formula with the parameters {S2, te} together with diffusion tensor parameters. 2250 2251 The model-free Hessian is:: 2252 2253 _k_ 2254 d2J(w) 2 \ dci (te + ti)^2 - (w.te.ti)^2 2255 ------- = - (1 - S2) > --- . ti^2 -----------------------------. 2256 dOj.dte 5 /__ dOj ((te + ti)^2 + (w.te.ti)^2)^2 2257 i=-k 2258 """ 2259 2260 return 0.4 * data.one_s2 * sum(data.dci[k] * data.fact_djw_dte, axis=2)
2261 2262 2263 2264 # Original S2 - te partial derivative. 2265 ###################################### 2266 2267 # {S2, te} with or without diffusion parameters. 2268
2269 -def calc_S2_te_d2jw_dS2dte(data, params, j, k):
2270 """Spectral density Hessian. 2271 2272 Calculate the spectral desity values for the S2 - te double partial derivative of the original 2273 model-free formula with the parameters {S2, te} with or without diffusion tensor parameters. 2274 2275 The model-free Hessian is:: 2276 2277 _k_ 2278 d2J(w) 2 \ (te + ti)^2 - (w.te.ti)^2 2279 ------- = - - > ci . ti^2 -----------------------------. 2280 dS2.dte 5 /__ ((te + ti)^2 + (w.te.ti)^2)^2 2281 i=-k 2282 """ 2283 2284 return -0.4 * sum(data.ci * data.fact_djw_dte, axis=2)
2285 2286 2287 2288 # Original te - te partial derivative. 2289 ###################################### 2290 2291 # {S2, te} with or without diffusion parameters. 2292
2293 -def calc_S2_te_d2jw_dte2(data, params, j, k):
2294 """Spectral density Hessian. 2295 2296 Calculate the spectral desity values for the te - te double partial derivative of the original 2297 model-free formula with the parameters {S2, te} with or without diffusion tensor parameters. 2298 2299 The model-free Hessian is:: 2300 2301 _k_ 2302 d2J(w) 4 \ (te + ti)^3 + 3.w^2.ti^3.te.(te + ti) - (w.ti)^4.te^3 2303 ------ = - - (1 - S2) > ci . ti^2 -----------------------------------------------------. 2304 dte**2 5 /__ ((te + ti)^2 + (w.te.ti)^2)^3 2305 i=-k 2306 """ 2307 2308 return -0.8 * data.one_s2 * sum(data.ci * data.ti**2 * (data.te_ti**3 + 3.0 * data.frq_sqrd_list_ext * data.ti**3 * params[data.te_i] * data.te_ti - data.w_ti_sqrd**2 * params[data.te_i]**3) * data.inv_te_denom**3, axis=2)
2309 2310 2311 2312 # Extended Gj - Gk partial derivative. 2313 ###################################### 2314 2315 # {S2f, S2, ts} with diffusion parameters. 2316
2317 -def calc_diff_S2f_S2_ts_d2jw_dGjdGk(data, params, j, k):
2318 """Spectral density Hessian. 2319 2320 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 2321 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2322 2323 The model-free Hessian is:: 2324 2325 _k_ 2326 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 2327 ------- = - > ci | -2 --- . --- | S2.w^2.ti ---------------- + (S2f - S2)ts^2 ---------------------------------------------------- | 2328 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 2329 i=-k 2330 2331 d2ti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ \ 2332 + ------- | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- | |. 2333 dGj.dGk \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / / 2334 """ 2335 2336 # First component. 2337 a = -2.0 * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 2338 2339 # Second component. 2340 b = data.d2ti[j, k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 2341 2342 return 0.4 * sum(data.ci * (a + b), axis=2)
2343 2344
2345 -def calc_ellipsoid_S2f_S2_ts_d2jw_dGjdGk(data, params, j, k):
2346 """Spectral density Hessian. 2347 2348 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 2349 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2350 2351 The model-free Hessian is:: 2352 2353 _k_ 2354 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 2355 ------- = - > | -2ci --- . --- | S2.w^2.ti ---------------- + (S2f - S2)ts^2 ---------------------------------------------------- | 2356 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 2357 i=-k 2358 2359 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2360 + | --- . --- + --- . --- + ci ------- | | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- | 2361 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2362 2363 2364 d2ci / S2 (S2f - S2)(ts + ti)ts \ \ 2365 + ------- . ti | ------------ + ------------------------- | |. 2366 dGj.dGk \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2367 """ 2368 2369 # First component. 2370 a = -2.0 * data.ci * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 2371 2372 # Second component. 2373 b = (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 2374 2375 # Third component. 2376 c = data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts) 2377 2378 return 0.4 * sum(a + b + c, axis=2)
2379 2380 2381 2382 # {S2f, tf, S2, ts} with diffusion parameters. 2383
2384 -def calc_diff_S2f_tf_S2_ts_d2jw_dGjdGk(data, params, j, k):
2385 """Spectral density Hessian. 2386 2387 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 2388 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2389 parameters. 2390 2391 The model-free Hessian is:: 2392 2393 _k_ 2394 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 2395 ------- = - > ci | -2 --- . --- | S2.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 2396 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 2397 i=-k 2398 2399 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 2400 + (S2f - S2)ts^2 ---------------------------------------------------- | 2401 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 2402 2403 2404 d2ti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ \ 2405 + ------- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- | |. 2406 dGj.dGk \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / / 2407 """ 2408 2409 # First component. 2410 a = -2.0 * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2f * params[data.tf_i]**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.tf_i]**3 * data.ti * data.tf_ti - (data.frq_list_ext * params[data.tf_i])**4 * data.ti**3) * data.inv_tf_denom**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 2411 2412 # Second component. 2413 b = data.d2ti[j, k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 2414 2415 return 0.4 * sum(data.ci * (a + b), axis=2)
2416 2417
2418 -def calc_ellipsoid_S2f_tf_S2_ts_d2jw_dGjdGk(data, params, j, k):
2419 """Spectral density Hessian. 2420 2421 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 2422 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2423 parameters. 2424 2425 The model-free Hessian is:: 2426 2427 _k_ 2428 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 2429 ------- = - > | -2ci --- . --- | S2.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 2430 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 2431 i=-k 2432 2433 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 2434 + (S2f - S2)ts^2 ---------------------------------------------------- | 2435 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 2436 2437 2438 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 2439 + | --- . --- + --- . --- + ci ------- | | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- 2440 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 2441 2442 2443 (ts + ti)^2 - (w.ts.ti)^2 \ 2444 + (S2f - S2)ts^2 ----------------------------- | 2445 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2446 2447 2448 d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 2449 + ------- . ti | ------------ + ------------------------- + ------------------------- | |. 2450 dGj.dGk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2451 """ 2452 2453 # First component. 2454 a = -2.0 * data.ci * data.dti[j] * data.dti[k] * (params[data.s2_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2f * params[data.tf_i]**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.tf_i]**3 * data.ti * data.tf_ti - (data.frq_list_ext * params[data.tf_i])**4 * data.ti**3) * data.inv_tf_denom**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 2455 2456 # Second component. 2457 b = (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 2458 2459 # Third component. 2460 c = data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts) 2461 2462 return 0.4 * sum(a + b + c, axis=2)
2463 2464 2465 2466 # Extended Gj - Oj partial derivative. 2467 ###################################### 2468 2469 # {S2f, S2, ts} with diffusion parameters. 2470
2471 -def calc_diff_S2f_S2_ts_d2jw_dGjdOj(data, params, j, k):
2472 """Spectral density Hessian. 2473 2474 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 2475 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2476 2477 The model-free Hessian is:: 2478 2479 _k_ 2480 d2J(w) 2 \ dci dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2481 ------- = - > --- . --- | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- |. 2482 dGj.dOj 5 /__ dOj dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2483 i=-k 2484 """ 2485 2486 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
2487 2488
2489 -def calc_ellipsoid_S2f_S2_ts_d2jw_dGjdOj(data, params, j, k):
2490 """Spectral density Hessian. 2491 2492 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 2493 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2494 2495 The model-free Hessian is:: 2496 2497 _k_ 2498 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2499 ------- = - > | --- . --- | S2 ---------------- + (S2f - S2)ts^2 ----------------------------- | 2500 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2501 i=-k 2502 2503 d2ci / S2 (S2f - S2)(ts + ti)ts \ \ 2504 + ------- . ti | ------------ + ------------------------- | |. 2505 dGj.dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2506 """ 2507 2508 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.d2ci[k, j] * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
2509 2510 2511 # {S2f, tf, S2, ts} with diffusion parameters. 2512
2513 -def calc_diff_S2f_tf_S2_ts_d2jw_dGjdOj(data, params, j, k):
2514 """Spectral density Hessian. 2515 2516 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 2517 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2518 parameters. 2519 2520 The model-free Hessian is:: 2521 2522 _k_ 2523 d2J(w) 2 \ dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2524 ------- = - > --- . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- |. 2525 dGj.dOj 5 /__ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2526 i=-k 2527 """ 2528 2529 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
2530 2531
2532 -def calc_ellipsoid_S2f_tf_S2_ts_d2jw_dGjdOj(data, params, j, k):
2533 """Spectral density Hessian. 2534 2535 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 2536 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2537 parameters. 2538 2539 The model-free Hessian is:: 2540 2541 _k_ 2542 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2543 ------- = - > | --- . --- | S2 ---------------- + (1 - S2f)tf^2 ----------------------------- + (S2f - S2)ts^2 ----------------------------- | 2544 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2545 i=-k 2546 2547 d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ \ 2548 + ------- . ti | ------------ + ------------------------- + ------------------------- | |. 2549 dGj.dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2550 """ 2551 2552 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.d2ci[k, j] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
2553 2554 2555 2556 # Extended Gj - S2 partial derivative. 2557 ###################################### 2558 2559 # {S2f, S2, ts} or {S2f, tf, S2, ts} with diffusion parameters. 2560
2561 -def calc_diff_S2f_S2_ts_d2jw_dGjdS2(data, params, j, k):
2562 """Spectral density Hessian. 2563 2564 Calculate the spectral desity values for the Gj - S2 double partial derivative of the extended 2565 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} together with 2566 diffusion tensor parameters. 2567 2568 The model-free Hessian is:: 2569 2570 _k_ 2571 d2J(w) 2 \ dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2572 ------- = - > ci . --- | ---------------- - ts^2 ----------------------------- |. 2573 dGj.dS2 5 /__ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2574 i=-k 2575 """ 2576 2577 return 0.4 * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_ts_djw_dti), axis=2)
2578 2579
2580 -def calc_ellipsoid_S2f_S2_ts_d2jw_dGjdS2(data, params, j, k):
2581 """Spectral density Hessian. 2582 2583 Calculate the spectral desity values for the Gj - S2 double partial derivative of the extended 2584 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} together with 2585 diffusion tensor parameters. 2586 2587 The model-free Hessian is:: 2588 2589 _k_ 2590 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2591 ------- = - > | ci . --- | ---------------- - ts^2 ----------------------------- | 2592 dGj.dS2 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2593 i=-k 2594 2595 dci / 1 (ts + ti)ts \ \ 2596 + --- . ti | ------------ - ------------------------- | |. 2597 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2598 """ 2599 2600 return 0.4 * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_ts_djw_dti) + data.dci[k] * data.ti * (data.fact_ti - data.fact_ts), axis=2)
2601 2602 2603 2604 # Extended Gj - S2f partial derivative. 2605 ####################################### 2606 2607 # {S2f, S2, ts} with diffusion parameters. 2608
2609 -def calc_diff_S2f_S2_ts_d2jw_dGjdS2f(data, params, j, k):
2610 """Spectral density Hessian. 2611 2612 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 2613 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2614 2615 The model-free Hessian is:: 2616 2617 _k_ 2618 d2J(w) 2 \ dti (ts + ti)^2 - (w.ts.ti)^2 2619 -------- = - > ci . --- ts^2 -----------------------------. 2620 dGj.dS2f 5 /__ dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 2621 i=-k 2622 """ 2623 2624 return 0.4 * sum(data.ci * data.dti[k] * data.fact_ts_djw_dti, axis=2)
2625 2626
2627 -def calc_ellipsoid_S2f_S2_ts_d2jw_dGjdS2f(data, params, j, k):
2628 """Spectral density Hessian. 2629 2630 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 2631 model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor parameters. 2632 2633 The model-free Hessian is:: 2634 2635 _k_ 2636 d2J(w) 2 \ / dti (ts + ti)^2 - (w.ts.ti)^2 dci (ts + ti)ts \ 2637 -------- = - > | ci . --- ts^2 ----------------------------- + --- . ti ------------------------- |. 2638 dGj.dS2f 5 /__ \ dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 dGj (ts + ti)^2 + (w.ts.ti)^2 / 2639 i=-k 2640 """ 2641 2642 return 0.4 * sum(data.ci * data.dti[k] * data.fact_ts_djw_dti + data.dci[k] * data.ti * data.fact_ts, axis=2)
2643 2644 2645 # {S2f, tf, S2, ts} with diffusion parameters. 2646
2647 -def calc_diff_S2f_tf_S2_ts_d2jw_dGjdS2f(data, params, j, k):
2648 """Spectral density Hessian. 2649 2650 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 2651 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2652 parameters. 2653 2654 The model-free Hessian is:: 2655 2656 _k_ 2657 d2J(w) 2 \ dti / (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2658 -------- = - - > ci . --- | tf^2 ----------------------------- - ts^2 ----------------------------- |. 2659 dGj.dS2f 5 /__ dGj \ ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2660 i=-k 2661 """ 2662 2663 return -0.4 * sum(data.ci * data.dti[k] * (data.fact_tf_djw_dti - data.fact_ts_djw_dti), axis=2)
2664 2665
2666 -def calc_ellipsoid_S2f_tf_S2_ts_d2jw_dGjdS2f(data, params, j, k):
2667 """Spectral density Hessian. 2668 2669 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 2670 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2671 parameters. 2672 2673 The model-free Hessian is:: 2674 2675 _k_ 2676 d2J(w) 2 \ / dti / (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 2677 -------- = - - > | ci . --- | tf^2 ----------------------------- - ts^2 ----------------------------- | 2678 dGj.dS2f 5 /__ \ dGj \ ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2679 i=-k 2680 2681 dci / (tf + ti)tf (ts + ti)ts \ \ 2682 + --- . ti | ------------------------- - ------------------------- | |. 2683 dGj \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 2684 """ 2685 2686 return -0.4 * sum(data.ci * data.dti[k] * (data.fact_tf_djw_dti - data.fact_ts_djw_dti) + data.dci[k] * data.ti * (data.fact_tf - data.fact_ts), axis=2)
2687 2688 2689 2690 # Extended Gj - tf partial derivative. 2691 ###################################### 2692 2693 # {S2f, tf, S2, ts} with diffusion parameters. 2694
2695 -def calc_diff_S2f_tf_S2_ts_d2jw_dGjdtf(data, params, j, k):
2696 """Spectral density Hessian. 2697 2698 Calculate the spectral desity values for the Gj - tf double partial derivative of the extended 2699 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2700 parameters. 2701 2702 The model-free Hessian is:: 2703 2704 _k_ 2705 d2J(w) 4 \ dti (tf + ti)^2 - 3(w.tf.ti)^2 2706 ------- = - (1 - S2f) . tf > ci . --- . ti . (tf + ti) -----------------------------. 2707 dGj.dtf 5 /__ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 2708 i=-k 2709 """ 2710 2711 return 0.8 * data.one_s2f * params[data.tf_i] * sum(data.ci * data.dti[k] * data.ti * data.tf_ti * (data.tf_ti_sqrd - 3.0 * data.w_tf_ti_sqrd) * data.inv_tf_denom**3, axis=2)
2712 2713
2714 -def calc_ellipsoid_S2f_tf_S2_ts_d2jw_dGjdtf(data, params, j, k):
2715 """Spectral density Hessian. 2716 2717 Calculate the spectral desity values for the Gj - tf double partial derivative of the extended 2718 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2719 parameters. 2720 2721 The model-free Hessian is:: 2722 2723 _k_ 2724 d2J(w) 2 \ / dti (tf + ti)^2 - 3(w.tf.ti)^2 dci (tf + ti)^2 - (w.tf.ti)^2 \ 2725 ------- = - (1 - S2f) > | 2ci . --- . tf . ti . (tf + ti) ----------------------------- + --- . ti^2 ----------------------------- |. 2726 dGj.dtf 5 /__ \ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 dGj ((tf + ti)^2 + (w.tf.ti)^2)^2 / 2727 i=-k 2728 """ 2729 2730 return 0.4 * data.one_s2f * sum(2.0 * data.ci * data.dti[k] * params[data.tf_i] * data.ti * data.tf_ti * (data.tf_ti_sqrd - 3.0 * data.w_tf_ti_sqrd) * data.inv_tf_denom**3 + data.dci[k] * data.fact_djw_dtf, axis=2)
2731 2732 2733 2734 # Extended Gj - ts partial derivative. 2735 ###################################### 2736 2737 # {S2f, S2, ts} or {S2f, tf, S2, ts} with diffusion parameters. 2738
2739 -def calc_diff_S2f_S2_ts_d2jw_dGjdts(data, params, j, k):
2740 """Spectral density Hessian. 2741 2742 Calculate the spectral desity values for the Gj - ts double partial derivative of the extended 2743 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} together with 2744 diffusion tensor parameters. 2745 2746 The model-free Hessian is:: 2747 2748 _k_ 2749 d2J(w) 4 \ dti (ts + ti)^2 - 3(w.ts.ti)^2 2750 ------- = - (S2f - S2) . ts > ci . --- . ti . (ts + ti) -----------------------------. 2751 dGj.dts 5 /__ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 2752 i=-k 2753 """ 2754 2755 return 0.8 * data.s2f_s2 * params[data.ts_i] * sum(data.ci * data.dti[k] * data.ti * data.ts_ti * (data.ts_ti_sqrd - 3.0 * data.w_ts_ti_sqrd) * data.inv_ts_denom**3, axis=2)
2756 2757
2758 -def calc_ellipsoid_S2f_S2_ts_d2jw_dGjdts(data, params, j, k):
2759 """Spectral density Hessian. 2760 2761 Calculate the spectral desity values for the Gj - ts double partial derivative of the extended 2762 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} together with 2763 diffusion tensor parameters. 2764 2765 The model-free Hessian is:: 2766 2767 _k_ 2768 d2J(w) 2 \ / dti (ts + ti)^2 - 3(w.ts.ti)^2 dci (ts + ti)^2 - (w.ts.ti)^2 \ 2769 ------- = - (S2f - S2) > | 2ci . --- . ts . ti . (ts + ti) ----------------------------- + --- . ti^2 ----------------------------- |. 2770 dGj.dts 5 /__ \ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 / 2771 i=-k 2772 """ 2773 2774 return 0.4 * data.s2f_s2 * sum(2.0 * data.ci * data.dti[k] * params[data.ts_i] * data.ti * data.ts_ti * (data.ts_ti_sqrd - 3.0 * data.w_ts_ti_sqrd) * data.inv_ts_denom**3 + data.dci[k] * data.fact_djw_dts, axis=2)
2775 2776 2777 2778 # Extended Oj - Ok partial derivative. 2779 ###################################### 2780 2781 # {S2f, S2, ts} with diffusion parameters. 2782
2783 -def calc_diff_S2f_S2_ts_d2jw_dOjdOk(data, params, j, k):
2784 """Spectral density Hessian. 2785 2786 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 2787 extended model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor 2788 parameters. 2789 2790 The model-free Hessian is:: 2791 2792 _k_ 2793 d2J(w) 2 \ d2ci / S2 (S2f - S2)(ts + ti)ts \ 2794 ------- = - > ------- . ti | ------------ + ------------------------- |. 2795 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 2796 i=-k 2797 """ 2798 2799 return 0.4 * sum(data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
2800 2801 2802 # {S2f, tf, S2, ts} with diffusion parameters. 2803
2804 -def calc_diff_S2f_tf_S2_ts_d2jw_dOjdOk(data, params, j, k):
2805 """Spectral density Hessian. 2806 2807 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 2808 extended model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2809 parameters. 2810 2811 The model-free Hessian is:: 2812 2813 _k_ 2814 d2J(w) 2 \ d2ci / S2 (1 - S2f)(tf + ti)tf (S2f - S2)(ts + ti)ts \ 2815 ------- = - > ------- . ti | ------------ + ------------------------- + ------------------------- |. 2816 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 2817 i=-k 2818 """ 2819 2820 return 0.4 * sum(data.d2ci[j, k] * data.ti * (params[data.s2_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
2821 2822 2823 2824 # Extended Oj - S2 partial derivative. 2825 ###################################### 2826 2827 # {S2f, S2, ts} and {S2f, tf, S2, ts} with diffusion parameters. 2828
2829 -def calc_diff_S2f_S2_ts_d2jw_dOjdS2(data, params, j, k):
2830 """Spectral density Hessian. 2831 2832 Calculate the spectral desity values for the Oj - S2 double partial derivative of the extended 2833 model-free formula with the parameters {S2f, S2, ts} and {S2f, tf, S2, ts} together with 2834 diffusion tensor parameters. 2835 2836 The model-free Hessian is:: 2837 2838 _k_ 2839 d2J(w) 2 \ dci / 1 (ts + ti)ts \ 2840 ------- = - > --- . ti | ------------ - ------------------------- |. 2841 dOj.dS2 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 2842 i=-k 2843 """ 2844 2845 return 0.4 * sum(data.dci[k] * data.ti * (data.fact_ti - data.fact_ts), axis=2)
2846 2847 2848 2849 # Extended Oj - S2f partial derivative. 2850 ####################################### 2851 2852 # {S2f, S2, ts} with diffusion parameters. 2853
2854 -def calc_diff_S2f_S2_ts_d2jw_dOjdS2f(data, params, j, k):
2855 """Spectral density Hessian. 2856 2857 Calculate the spectral desity values for the Oj - S2f double partial derivative of the 2858 extended model-free formula with the parameters {S2f, S2, ts} together with diffusion tensor 2859 parameters. 2860 2861 The model-free Hessian is:: 2862 2863 _k_ 2864 d2J(w) 2 \ dci (ts + ti)ts 2865 -------- = - > --- . ti -------------------------. 2866 dOj.dS2f 5 /__ dOj (ts + ti)^2 + (w.ts.ti)^2 2867 i=-k 2868 """ 2869 2870 return 0.4 * sum(data.dci[k] * data.ti * data.fact_ts, axis=2)
2871 2872 2873 # {S2f, tf, S2, ts} with diffusion parameters. 2874
2875 -def calc_diff_S2f_tf_S2_ts_d2jw_dOjdS2f(data, params, j, k):
2876 """Spectral density Hessian. 2877 2878 Calculate the spectral desity values for the Oj - S2f double partial derivative of the 2879 extended model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2880 parameters. 2881 2882 The model-free Hessian is:: 2883 2884 _k_ 2885 d2J(w) 2 \ dci / (tf + ti)tf (ts + ti)ts \ 2886 -------- = - - > --- . ti | ------------------------- - ------------------------- |. 2887 dOj.dS2f 5 /__ dOj \ (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 2888 i=-k 2889 """ 2890 2891 return -0.4 * sum(data.dci[k] * data.ti * (data.fact_tf - data.fact_ts), axis=2)
2892 2893 2894 2895 # Extended Oj - tf partial derivative. 2896 ###################################### 2897 2898 # {S2f, tf, S2, ts} with diffusion parameters. 2899
2900 -def calc_diff_S2f_tf_S2_ts_d2jw_dOjdtf(data, params, j, k):
2901 """Spectral density Hessian. 2902 2903 Calculate the spectral desity values for the Oj - tf double partial derivative of the extended 2904 model-free formula with the parameters {S2f, tf, S2, ts} together with diffusion tensor 2905 parameters. 2906 2907 The model-free Hessian is:: 2908 2909 _k_ 2910 d2J(w) 2 \ dci (tf + ti)^2 - (w.tf.ti)^2 2911 ------- = - (1 - S2f) > --- . ti^2 -----------------------------. 2912 dOj.dtf 5 /__ dOj ((tf + ti)^2 + (w.tf.ti)^2)^2 2913 i=-k 2914 """ 2915 2916 return 0.4 * data.one_s2f * sum(data.dci[k] * data.fact_djw_dtf, axis=2)
2917 2918 2919 2920 # Extended Oj - ts partial derivative. 2921 ###################################### 2922 2923 # {S2f, S2, ts} and {S2f, tf, S2, ts} with diffusion parameters. 2924
2925 -def calc_diff_S2f_S2_ts_d2jw_dOjdts(data, params, j, k):
2926 """Spectral density Hessian. 2927 2928 Calculate the spectral desity values for the Oj - ts double partial derivative of the extended 2929 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} together with 2930 diffusion tensor parameters. 2931 2932 The model-free Hessian is:: 2933 2934 _k_ 2935 d2J(w) 2 \ dci (ts + ti)^2 - (w.ts.ti)^2 2936 ------- = - (S2f - S2) > --- . ti^2 -----------------------------. 2937 dOj.dts 5 /__ dOj ((ts + ti)^2 + (w.ts.ti)^2)^2 2938 i=-k 2939 """ 2940 2941 return 0.4 * data.s2f_s2 * sum(data.dci[k] * data.fact_djw_dts, axis=2)
2942 2943 2944 2945 # Extended S2 - ts partial derivative. 2946 ###################################### 2947 2948 # {S2f, S2, ts} or {S2f, tf, S2, ts} with or without diffusion parameters. 2949
2950 -def calc_S2f_S2_ts_d2jw_dS2dts(data, params, j, k):
2951 """Spectral density Hessian. 2952 2953 Calculate the spectral desity values for the S2 - ts double partial derivative of the extended 2954 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} with or without 2955 diffusion tensor parameters. 2956 2957 The model-free Hessian is:: 2958 2959 _k_ 2960 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 2961 ------- = - - > ci . ti^2 -----------------------------. 2962 dS2.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 2963 i=-k 2964 """ 2965 2966 return -0.4 * sum(data.ci * data.fact_djw_dts, axis=2)
2967 2968 2969 2970 # Extended S2f - tf partial derivative. 2971 ####################################### 2972 2973 # {S2f, tf, S2, ts} with or without diffusion parameters. 2974
2975 -def calc_S2f_tf_S2_ts_d2jw_dS2fdtf(data, params, j, k):
2976 """Spectral density Hessian. 2977 2978 Calculate the spectral desity values for the S2f - tf double partial derivative of the extended 2979 model-free formula with the parameters {S2f, tf, S2, ts} with or without diffusion tensor 2980 parameters. 2981 2982 The model-free Hessian is:: 2983 2984 _k_ 2985 d2J(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 2986 -------- = - - > ci . ti^2 -----------------------------. 2987 dS2f.dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 2988 i=-k 2989 """ 2990 2991 return -0.4 * sum(data.ci * data.fact_djw_dtf, axis=2)
2992 2993 2994 2995 # Extended S2f - ts partial derivative. 2996 ####################################### 2997 2998 # {S2f, S2, ts} or {S2f, tf, S2, ts} with or without diffusion parameters. 2999
3000 -def calc_S2f_S2_ts_d2jw_dS2fdts(data, params, j, k):
3001 """Spectral density Hessian. 3002 3003 Calculate the spectral desity values for the S2f - ts double partial derivative of the extended 3004 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} with or without 3005 diffusion tensor parameters. 3006 3007 The model-free Hessian is:: 3008 3009 _k_ 3010 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 3011 -------- = - > ci . ti^2 -----------------------------. 3012 dS2f.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 3013 i=-k 3014 """ 3015 3016 return 0.4 * sum(data.ci * data.fact_djw_dts, axis=2)
3017 3018 3019 3020 # Extended tf - tf partial derivative. 3021 ###################################### 3022 3023 # {S2f, tf, S2, ts} with or without diffusion parameters. 3024
3025 -def calc_S2f_tf_S2_ts_d2jw_dtf2(data, params, j, k):
3026 """Spectral density Hessian. 3027 3028 Calculate the spectral desity values for the tf - tf double partial derivative of the extended 3029 model-free formula with the parameters {S2f, tf, S2, ts} with or without diffusion tensor 3030 parameters. 3031 3032 The model-free Hessian is:: 3033 3034 _k_ 3035 d2J(w) 4 \ (tf + ti)^3 + 3.w^2.ti^3.tf.(tf + ti) - (w.ti)^4.tf^3 3036 ------ = - - (1 - S2f) > ci . ti^2 -----------------------------------------------------. 3037 dtf**2 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^3 3038 i=-k 3039 """ 3040 3041 return -0.8 * data.one_s2f * sum(data.ci * data.ti**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * data.ti**3 * params[data.tf_i] * data.tf_ti - data.w_ti_sqrd**2 * params[data.tf_i]**3) * data.inv_tf_denom**3, axis=2)
3042 3043 3044 3045 # Extended ts - ts partial derivative. 3046 ###################################### 3047 3048 # {S2f, S2, ts} or {S2f, tf, S2, ts} with or without diffusion parameters. 3049
3050 -def calc_S2f_S2_ts_d2jw_dts2(data, params, j, k):
3051 """Spectral density Hessian. 3052 3053 Calculate the spectral desity values for the ts - ts double partial derivative of the extended 3054 model-free formula with the parameters {S2f, S2, ts} or {S2f, tf, S2, ts} with or without 3055 diffusion tensor parameters. 3056 3057 The model-free Hessian is:: 3058 3059 _k_ 3060 d2J(w) 4 \ (ts + ti)^3 + 3.w^2.ti^3.ts.(ts + ti) - (w.ti)^4.ts^3 3061 ------ = - - (S2f - S2) > ci . ti^2 -----------------------------------------------------. 3062 dts**2 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^3 3063 i=-k 3064 """ 3065 3066 return -0.8 * data.s2f_s2 * sum(data.ci * data.ti**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * data.ti**3 * params[data.ts_i] * data.ts_ti - data.w_ti_sqrd**2 * params[data.ts_i]**3) * data.inv_ts_denom**3, axis=2)
3067 3068 3069 3070 # Extended 2 Gj - Gk partial derivative. 3071 ######################################## 3072 3073 # {S2f, S2s, ts} with diffusion parameters. 3074
3075 -def calc_diff_S2f_S2s_ts_d2jw_dGjdGk(data, params, j, k):
3076 """Spectral density Hessian. 3077 3078 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 3079 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3080 3081 The model-free Hessian is:: 3082 3083 _k_ 3084 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 3085 ------- = - > ci | -2 --- . --- | S2f.S2s.w^2.ti ---------------- + S2f(1 - S2s)ts^2 ---------------------------------------------------- | 3086 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 3087 i=-k 3088 3089 d2ti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ \ 3090 + ------- | S2f.S2s ---------------- + S2f(1 - S2s)ts^2 ----------------------------- | |. 3091 dGj.dGk \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / / 3092 """ 3093 3094 # First component. 3095 a = -2.0 * data.dti[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 3096 3097 # Second component. 3098 b = data.d2ti[j, k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 3099 3100 return 0.4 * sum(data.ci * (a + b), axis=2)
3101 3102
3103 -def calc_ellipsoid_S2f_S2s_ts_d2jw_dGjdGk(data, params, j, k):
3104 """Spectral density Hessian. 3105 3106 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 3107 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3108 3109 The model-free Hessian is:: 3110 3111 _k_ 3112 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 3113 ------- = - > | -2ci --- . --- | S2f.S2s.w^2.ti ---------------- + S2f(1 - S2s)ts^2 ---------------------------------------------------- | 3114 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 3115 i=-k 3116 3117 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3118 + | --- . --- + --- . --- + ci ------- | | S2f.S2s ---------------- + S2f(1 - S2s)ts^2 ----------------------------- | 3119 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3120 3121 3122 d2ci / S2f.S2s S2f(1 - S2s)(ts + ti)ts \ \ 3123 + ------- . ti | ------------ + ------------------------- | |. 3124 dGj.dGk \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3125 """ 3126 3127 # First component. 3128 a = -2.0 * data.ci * data.dti[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 3129 3130 # Second component. 3131 b = (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 3132 3133 # Third component. 3134 c = data.d2ci[j, k] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.s2f_s2 * data.fact_ts) 3135 3136 return 0.4 * sum(a + b + c, axis=2)
3137 3138 3139 # {S2f, tf, S2s, ts} with diffusion parameters. 3140
3141 -def calc_diff_S2f_tf_S2s_ts_d2jw_dGjdGk(data, params, j, k):
3142 """Spectral density Hessian. 3143 3144 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 3145 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3146 parameters. 3147 3148 The model-free Hessian is:: 3149 3150 _k_ 3151 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 3152 ------- = - > ci | -2 --- . --- | S2f.S2s.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 3153 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 3154 i=-k 3155 3156 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 3157 + S2f(1 - S2s)ts^2 ---------------------------------------------------- | 3158 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 3159 3160 3161 d2ti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3162 + ------- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- |. 3163 dGj.dGk \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3164 """ 3165 3166 # First component. 3167 a = -2.0 * data.dti[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2f * params[data.tf_i]**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.tf_i]**3 * data.ti * data.tf_ti - (data.frq_list_ext * params[data.tf_i])**4 * data.ti**3) * data.inv_tf_denom**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 3168 3169 # Second component. 3170 b = data.d2ti[j, k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 3171 3172 return 0.4 * sum(data.ci * (a + b), axis=2)
3173 3174
3175 -def calc_ellipsoid_S2f_tf_S2s_ts_d2jw_dGjdGk(data, params, j, k):
3176 """Spectral density Hessian. 3177 3178 Calculate the spectral desity values for the Gj - Gk double partial derivative of the extended 3179 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3180 parameters. 3181 3182 The model-free Hessian is:: 3183 3184 _k_ 3185 d2J(w) 2 \ / dti dti / 3 - (w.ti)^2 (tf + ti)^3 + 3.w^2.tf^3.ti(tf + ti) - (w.tf)^4.ti^3 3186 ------- = - > | -2ci --- . --- | S2f.S2s.w^2.ti ---------------- + (1 - S2f)tf^2 ---------------------------------------------------- 3187 dGj.dGk 5 /__ \ dGj dGk \ (1 + (w.ti)^2)^3 ((tf + ti)^2 + (w.tf.ti)^2)^3 3188 i=-k 3189 3190 (ts + ti)^3 + 3.w^2.ts^3.ti(ts + ti) - (w.ts)^4.ti^3 \ 3191 + S2f(1 - S2s)ts^2 ---------------------------------------------------- | 3192 ((ts + ti)^2 + (w.ts.ti)^2)^3 / 3193 3194 3195 / dti dci dti dci d2ti \ / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 3196 + | --- . --- + --- . --- + ci ------- | | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- 3197 \ dGj dGk dGk dGj dGj.dGk / \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 3198 3199 3200 (ts + ti)^2 - (w.ts.ti)^2 \ 3201 + S2f(1 - S2s)ts^2 ----------------------------- | 3202 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3203 3204 3205 d2ci / S2f.S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 3206 + ------- . ti | ------------ + ------------------------- + ------------------------- | |. 3207 dGj.dGk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3208 """ 3209 3210 # First component. 3211 a = -2.0 * data.ci * data.dti[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.frq_sqrd_list_ext * data.ti * (3.0 - data.w_ti_sqrd) * data.fact_ti**3 + data.one_s2f * params[data.tf_i]**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.tf_i]**3 * data.ti * data.tf_ti - (data.frq_list_ext * params[data.tf_i])**4 * data.ti**3) * data.inv_tf_denom**3 + data.s2f_s2 * params[data.ts_i]**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * params[data.ts_i]**3 * data.ti * data.ts_ti - (data.frq_list_ext * params[data.ts_i])**4 * data.ti**3) * data.inv_ts_denom**3) 3212 3213 # Second component. 3214 b = (data.dti[j] * data.dci[k] + data.dti[k] * data.dci[j] + data.ci * data.d2ti[j, k]) * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) 3215 3216 # Third component. 3217 c = data.d2ci[j, k] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts) 3218 3219 return 0.4 * sum(a + b + c, axis=2)
3220 3221 3222 3223 # Extended 2 Gj - Oj partial derivative. 3224 ######################################## 3225 3226 # {S2f, S2s, ts} with diffusion parameters. 3227
3228 -def calc_diff_S2f_S2s_ts_d2jw_dGjdOj(data, params, j, k):
3229 """Spectral density Hessian. 3230 3231 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 3232 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3233 3234 The model-free Hessian is:: 3235 3236 _k_ 3237 d2J(w) 2 \ dci dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3238 ------- = - > --- . --- | S2f.S2s ---------------- + S2f(1 - S2s)ts^2 ----------------------------- |. 3239 dGj.dOj 5 /__ dOj dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3240 i=-k 3241 """ 3242 3243 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
3244 3245
3246 -def calc_ellipsoid_S2f_S2s_ts_d2jw_dGjdOj(data, params, j, k):
3247 """Spectral density Hessian. 3248 3249 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 3250 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3251 3252 The model-free Hessian is:: 3253 3254 _k_ 3255 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3256 ------- = - > | --- . --- | S2f.S2s ---------------- + S2f(1 - S2s)ts^2 ----------------------------- | 3257 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3258 i=-k 3259 3260 d2ci / S2f.S2s S2f(1 - S2s)(ts + ti)ts \ \ 3261 + ------- . ti | ------------ + ------------------------- | |. 3262 dGj.dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3263 """ 3264 3265 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.d2ci[k, j] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
3266 3267 3268 # {S2f, tf, S2s, ts} with diffusion parameters. 3269
3270 -def calc_diff_S2f_tf_S2s_ts_d2jw_dGjdOj(data, params, j, k):
3271 """Spectral density Hessian. 3272 3273 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 3274 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3275 parameters. 3276 3277 The model-free Hessian is:: 3278 3279 _k_ 3280 d2J(w) 2 \ dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3281 ------- = - > --- . --- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- |. 3282 dGj.dOj 5 /__ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3283 i=-k 3284 """ 3285 3286 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti), axis=2)
3287 3288
3289 -def calc_ellipsoid_S2f_tf_S2s_ts_d2jw_dGjdOj(data, params, j, k):
3290 """Spectral density Hessian. 3291 3292 Calculate the spectral desity values for the Gj - Oj double partial derivative of the extended 3293 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3294 parameters. 3295 3296 The model-free Hessian is:: 3297 3298 _k_ 3299 d2J(w) 2 \ / dci dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3300 ------- = - > | --- . --- | S2f.S2s ---------------- + (1 - S2f)tf^2 ----------------------------- + S2f(1 - S2s)ts^2 ----------------------------- | 3301 dGj.dOj 5 /__ \ dOj dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3302 i=-k 3303 3304 d2ci / S2f.S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ \ 3305 + ------- . ti | ------------ + ------------------------- + ------------------------- | |. 3306 dGj.dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3307 """ 3308 3309 return 0.4 * sum(data.dci[j] * data.dti[k] * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2f * data.fact_tf_djw_dti + data.s2f_s2 * data.fact_ts_djw_dti) + data.d2ci[k, j] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
3310 3311 3312 3313 # Extended 2 Gj - S2f partial derivative. 3314 ######################################### 3315 3316 # {S2f, S2s, ts} with diffusion parameters. 3317
3318 -def calc_diff_S2f_S2s_ts_d2jw_dGjdS2f(data, params, j, k):
3319 """Spectral density Hessian. 3320 3321 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 3322 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3323 3324 The model-free Hessian is:: 3325 3326 _k_ 3327 d2J(w) 2 \ dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3328 -------- = - > ci . --- | S2s ---------------- + (1 - S2s)ts^2 ----------------------------- |. 3329 dGj.dS2f 5 /__ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3330 i=-k 3331 """ 3332 3333 return 0.4 * sum(data.ci * data.dti[k] * (params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2s * data.fact_ts_djw_dti), axis=2)
3334 3335
3336 -def calc_ellipsoid_S2f_S2s_ts_d2jw_dGjdS2f(data, params, j, k):
3337 """Spectral density Hessian. 3338 3339 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 3340 model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor parameters. 3341 3342 The model-free Hessian is:: 3343 3344 _k_ 3345 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3346 -------- = - > | ci . --- | S2s ---------------- + (1 - S2s)ts^2 ----------------------------- | 3347 dGj.dS2f 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3348 i=-k 3349 3350 dci / S2s (1 - S2s)(ts + ti)ts \ \ 3351 + --- . ti | ------------ + ------------------------- | |. 3352 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3353 """ 3354 3355 return 0.4 * sum(data.ci * data.dti[k] * (params[data.s2s_i] * data.fact_ti_djw_dti + data.one_s2s * data.fact_ts_djw_dti) + data.dci[k] * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
3356 3357 3358 # {S2f, tf, S2s, ts} with diffusion parameters. 3359
3360 -def calc_diff_S2f_tf_S2s_ts_d2jw_dGjdS2f(data, params, j, k):
3361 """Spectral density Hessian. 3362 3363 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 3364 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3365 parameters. 3366 3367 The model-free Hessian is:: 3368 3369 _k_ 3370 d2J(w) 2 \ dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3371 -------- = - > ci . --- | S2s ---------------- - tf^2 ----------------------------- + (1 - S2s)ts^2 ----------------------------- |. 3372 dGj.dS2f 5 /__ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3373 i=-k 3374 """ 3375 3376 return 0.4 * sum(data.ci * data.dti[k] * (params[data.s2s_i] * data.fact_ti_djw_dti - data.fact_tf_djw_dti + data.one_s2s * data.fact_ts_djw_dti), axis=2)
3377 3378
3379 -def calc_ellipsoid_S2f_tf_S2s_ts_d2jw_dGjdS2f(data, params, j, k):
3380 """Spectral density Hessian. 3381 3382 Calculate the spectral desity values for the Gj - S2f double partial derivative of the extended 3383 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3384 parameters. 3385 3386 The model-free Hessian is:: 3387 3388 _k_ 3389 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (tf + ti)^2 - (w.tf.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3390 -------- = - > | ci . --- | S2s ---------------- - tf^2 ----------------------------- + (1 - S2s)ts^2 ----------------------------- | 3391 dGj.dS2f 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((tf + ti)^2 + (w.tf.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3392 i=-k 3393 3394 dci / S2s (tf + ti)tf (1 - S2s)(ts + ti)ts \ \ 3395 + --- . ti | ------------ - ------------------------- + ------------------------- | |. 3396 dGj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3397 """ 3398 3399 return 0.4 * sum(data.ci * data.dti[k] * (params[data.s2s_i] * data.fact_ti_djw_dti - data.fact_tf_djw_dti + data.one_s2s * data.fact_ts_djw_dti) + data.dci[k] * data.ti * (params[data.s2s_i] * data.fact_ti - data.tf_ti_tf * data.inv_ts_denom + data.one_s2s * data.fact_ts), axis=2)
3400 3401 3402 3403 # Extended 2 Gj - S2s partial derivative. 3404 ######################################### 3405 3406 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with diffusion parameters. 3407
3408 -def calc_diff_S2f_S2s_ts_d2jw_dGjdS2s(data, params, j, k):
3409 """Spectral density Hessian. 3410 3411 Calculate the spectral desity values for the Gj - S2s double partial derivative of the extended 3412 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} together with 3413 diffusion tensor parameters. 3414 3415 The model-free Hessian is:: 3416 3417 _k_ 3418 d2J(w) 2 \ dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3419 -------- = - S2f > ci . --- | ---------------- - ts^2 ----------------------------- |. 3420 dGj.dS2s 5 /__ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3421 i=-k 3422 """ 3423 3424 return 0.4 * params[data.s2f_i] * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_ts_djw_dti), axis=2)
3425 3426
3427 -def calc_ellipsoid_S2f_S2s_ts_d2jw_dGjdS2s(data, params, j, k):
3428 """Spectral density Hessian. 3429 3430 Calculate the spectral desity values for the Gj - S2s double partial derivative of the extended 3431 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} together with 3432 diffusion tensor parameters. 3433 3434 The model-free Hessian is:: 3435 3436 _k_ 3437 d2J(w) 2 \ / dti / 1 - (w.ti)^2 (ts + ti)^2 - (w.ts.ti)^2 \ 3438 -------- = - S2f > | ci . --- | ---------------- - ts^2 ----------------------------- | 3439 dGj.dS2s 5 /__ \ dGj \ (1 + (w.ti)^2)^2 ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3440 i=-k 3441 3442 dci / 1 (ts + ti)ts \ \ 3443 + --- . ti | ------------ - ------------------------- | |. 3444 dGj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / / 3445 """ 3446 3447 return 0.4 * params[data.s2f_i] * sum(data.ci * data.dti[k] * (data.fact_ti_djw_dti - data.fact_ts_djw_dti) + data.dci[k] * data.ti * (data.fact_ti - data.fact_ts), axis=2)
3448 3449 3450 3451 # Extended 2 Gj - tf partial derivative. 3452 ######################################## 3453 3454 # {S2f, tf, S2s, ts} with diffusion parameters. 3455
3456 -def calc_diff_S2f_tf_S2s_ts_d2jw_dGjdtf(data, params, j, k):
3457 """Spectral density Hessian. 3458 3459 Calculate the spectral desity values for the Gj - tf double partial derivative of the extended 3460 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3461 parameters. 3462 3463 The model-free Hessian is:: 3464 3465 _k_ 3466 d2J(w) 4 \ dti (tf + ti)^2 - 3(w.tf.ti)^2 3467 ------- = - (1 - S2f) . tf > ci . --- . ti . (tf + ti) -----------------------------. 3468 dGj.dtf 5 /__ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 3469 i=-k 3470 """ 3471 3472 return 0.8 * data.one_s2f * params[data.tf_i] * sum(data.ci * data.dti[k] * data.ti * data.tf_ti * (data.tf_ti_sqrd - 3.0 * data.w_tf_ti_sqrd) * data.inv_tf_denom**3, axis=2)
3473 3474
3475 -def calc_ellipsoid_S2f_tf_S2s_ts_d2jw_dGjdtf(data, params, j, k):
3476 """Spectral density Hessian. 3477 3478 Calculate the spectral desity values for the Gj - tf double partial derivative of the extended 3479 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3480 parameters. 3481 3482 The model-free Hessian is:: 3483 3484 _k_ 3485 d2J(w) 2 \ / dti (tf + ti)^2 - 3(w.tf.ti)^2 dci (tf + ti)^2 - (w.tf.ti)^2 \ 3486 ------- = - (1 - S2f) > | 2ci . --- . tf . ti . (tf + ti) ----------------------------- + --- . ti^2 ----------------------------- |. 3487 dGj.dtf 5 /__ \ dGj ((tf + ti)^2 + (w.tf.ti)^2)^3 dGj ((tf + ti)^2 + (w.tf.ti)^2)^2 / 3488 i=-k 3489 """ 3490 3491 return 0.4 * data.one_s2f * sum(2.0 * data.ci * data.dti[k] * params[data.tf_i] * data.ti * data.tf_ti * (data.tf_ti_sqrd - 3.0 * data.w_tf_ti_sqrd) * data.inv_tf_denom**3 + data.dci[k] * data.fact_djw_dtf, axis=2)
3492 3493 3494 3495 # Extended 2 Gj - ts partial derivative. 3496 ######################################## 3497 3498 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with diffusion parameters. 3499
3500 -def calc_diff_S2f_S2s_ts_d2jw_dGjdts(data, params, j, k):
3501 """Spectral density Hessian. 3502 3503 Calculate the spectral desity values for the Gj - ts double partial derivative of the extended 3504 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} together with 3505 diffusion tensor parameters. 3506 3507 The model-free Hessian is:: 3508 3509 _k_ 3510 d2J(w) 4 \ dti (ts + ti)^2 - 3(w.ts.ti)^2 3511 ------- = - S2f(1 - S2s) . ts > ci . --- . ti . (ts + ti) -----------------------------. 3512 dGj.dts 5 /__ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 3513 i=-k 3514 """ 3515 3516 return 0.8 * data.s2f_s2 * params[data.ts_i] * sum(data.ci * data.dti[k] * data.ti * data.ts_ti * (data.ts_ti_sqrd - 3.0 * data.w_ts_ti_sqrd) * data.inv_ts_denom**3, axis=2)
3517 3518
3519 -def calc_ellipsoid_S2f_S2s_ts_d2jw_dGjdts(data, params, j, k):
3520 """Spectral density Hessian. 3521 3522 Calculate the spectral desity values for the Gj - ts double partial derivative of the extended 3523 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} together with 3524 diffusion tensor parameters. 3525 3526 The model-free Hessian is:: 3527 3528 _k_ 3529 d2J(w) 2 \ / dti (ts + ti)^2 - 3(w.ts.ti)^2 dci (ts + ti)^2 - (w.ts.ti)^2 \ 3530 ------- = - S2f(1 - S2s) > | 2ci . --- . ts . ti . (ts + ti) ----------------------------- + --- . ti^2 ----------------------------- |. 3531 dGj.dts 5 /__ \ dGj ((ts + ti)^2 + (w.ts.ti)^2)^3 dGj ((ts + ti)^2 + (w.ts.ti)^2)^2 / 3532 i=-k 3533 """ 3534 3535 return 0.4 * data.s2f_s2 * sum(2.0 * data.ci * data.dti[k] * params[data.ts_i] * data.ti * data.ts_ti * (data.ts_ti_sqrd - 3.0 * data.w_ts_ti_sqrd) * data.inv_ts_denom**3 + data.dci[k] * data.fact_djw_dts, axis=2)
3536 3537 3538 3539 # Extended 2 Oj - Ok partial derivative. 3540 ######################################## 3541 3542 # {S2f, S2s, ts} with diffusion parameters. 3543
3544 -def calc_diff_S2f_S2s_ts_d2jw_dOjdOk(data, params, j, k):
3545 """Spectral density Hessian. 3546 3547 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 3548 extended model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor 3549 parameters. 3550 3551 The model-free Hessian is:: 3552 3553 _k_ 3554 d2J(w) 2 \ d2ci / S2f . S2s S2f(1 - S2s)(ts + ti)ts \ 3555 ------- = - > ------- . ti | ------------ + ------------------------- |. 3556 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3557 i=-k 3558 """ 3559 3560 return 0.4 * sum(data.d2ci[j, k] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.s2f_s2 * data.fact_ts), axis=2)
3561 3562 3563 # {S2f, tf, S2s, ts} with diffusion parameters. 3564
3565 -def calc_diff_S2f_tf_S2s_ts_d2jw_dOjdOk(data, params, j, k):
3566 """Spectral density Hessian. 3567 3568 Calculate the spectral desity values for the Oj - Ok double partial derivative of the 3569 extended model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3570 parameters. 3571 3572 The model-free Hessian is:: 3573 3574 _k_ 3575 d2J(w) 2 \ d2ci / S2f . S2s (1 - S2f)(tf + ti)tf S2f(1 - S2s)(ts + ti)ts \ 3576 ------- = - > ------- . ti | ------------ + ------------------------- + ------------------------- |. 3577 dOj.dOk 5 /__ dOj.dOk \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3578 i=-k 3579 """ 3580 3581 return 0.4 * sum(data.d2ci[j, k] * data.ti * (params[data.s2f_i] * params[data.s2s_i] * data.fact_ti + data.one_s2f * data.fact_tf + data.s2f_s2 * data.fact_ts), axis=2)
3582 3583 3584 3585 # Extended 2 Oj - S2f partial derivative. 3586 ######################################### 3587 3588 # {S2f, S2s, ts} with diffusion parameters. 3589
3590 -def calc_diff_S2f_S2s_ts_d2jw_dOjdS2f(data, params, j, k):
3591 """Spectral density Hessian. 3592 3593 Calculate the spectral desity values for the Oj - S2f double partial derivative of the 3594 extended model-free formula with the parameters {S2f, S2s, ts} together with diffusion tensor 3595 parameters. 3596 3597 The model-free Hessian is:: 3598 3599 _k_ 3600 d2J(w) 2 \ dci / S2s (1 - S2s)(ts + ti)ts \ 3601 -------- = - > --- . ti | ------------ + ------------------------- |. 3602 dOj.dS2f 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3603 i=-k 3604 """ 3605 3606 return 0.4 * sum(data.dci[k] * data.ti * (params[data.s2s_i] * data.fact_ti + data.one_s2s * data.fact_ts), axis=2)
3607 3608 3609 # {S2f, tf, S2s, ts} with diffusion parameters. 3610
3611 -def calc_diff_S2f_tf_S2s_ts_d2jw_dOjdS2f(data, params, j, k):
3612 """Spectral density Hessian. 3613 3614 Calculate the spectral desity values for the Oj - S2f double partial derivative of the 3615 extended model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3616 parameters. 3617 3618 The model-free Hessian is:: 3619 3620 _k_ 3621 d2J(w) 2 \ dci / S2s (tf + ti)tf (1 - S2s)(ts + ti)ts \ 3622 -------- = - > --- . ti | ------------ - ------------------------- + ------------------------- |. 3623 dOj.dS2f 5 /__ dOj \ 1 + (w.ti)^2 (tf + ti)^2 + (w.tf.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3624 i=-k 3625 """ 3626 3627 return 0.4 * sum(data.dci[k] * data.ti * (params[data.s2s_i] * data.fact_ti - data.fact_tf + data.one_s2s * data.fact_ts), axis=2)
3628 3629 3630 3631 # Extended 2 Oj - S2s partial derivative. 3632 ######################################### 3633 3634 # {S2f, S2s, ts} and {S2f, tf, S2s, ts} with diffusion parameters. 3635
3636 -def calc_diff_S2f_tf_S2s_ts_d2jw_dOjdS2s(data, params, j, k):
3637 """Spectral density Hessian. 3638 3639 Calculate the spectral desity values for the Oj - S2 double partial derivative of the extended 3640 model-free formula with the parameters {S2f, S2s, ts} and {S2f, tf, S2s, ts} together with 3641 diffusion tensor parameters. 3642 3643 The model-free Hessian is:: 3644 3645 _k_ 3646 d2J(w) 2 \ dci / 1 (ts + ti)ts \ 3647 -------- = - S2f > --- . ti | ------------ - ------------------------- |. 3648 dOj.dS2s 5 /__ dOj \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3649 i=-k 3650 """ 3651 3652 return 0.4 * params[data.s2f_i] * sum(data.dci[k] * data.ti * (data.fact_ti - data.fact_ts), axis=2)
3653 3654 3655 3656 # Extended 2 Oj - tf partial derivative. 3657 ######################################## 3658 3659 # {S2f, tf, S2s, ts} with diffusion parameters. 3660
3661 -def calc_diff_S2f_tf_S2s_ts_d2jw_dOjdtf(data, params, j, k):
3662 """Spectral density Hessian. 3663 3664 Calculate the spectral desity values for the Oj - tf double partial derivative of the extended 3665 model-free formula with the parameters {S2f, tf, S2s, ts} together with diffusion tensor 3666 parameters. 3667 3668 The model-free Hessian is:: 3669 3670 _k_ 3671 d2J(w) 2 \ dci (tf + ti)^2 - (w.tf.ti)^2 3672 ------- = - (1 - S2f) > --- . ti^2 -----------------------------. 3673 dOj.dtf 5 /__ dOj ((tf + ti)^2 + (w.tf.ti)^2)^2 3674 i=-k 3675 """ 3676 3677 return 0.4 * data.one_s2f * sum(data.dci[k] * data.fact_djw_dtf, axis=2)
3678 3679 3680 3681 # Extended 2 Oj - ts partial derivative. 3682 ######################################## 3683 3684 # {S2f, S2s, ts} and {S2f, tf, S2s, ts} with diffusion parameters. 3685
3686 -def calc_diff_S2f_S2s_ts_d2jw_dOjdts(data, params, j, k):
3687 """Spectral density Hessian. 3688 3689 Calculate the spectral desity values for the Oj - ts double partial derivative of the extended 3690 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} together with 3691 diffusion tensor parameters. 3692 3693 The model-free Hessian is:: 3694 3695 _k_ 3696 d2J(w) 2 \ dci (ts + ti)^2 - (w.ts.ti)^2 3697 ------- = - S2f(1 - S2s) > --- . ti^2 -----------------------------. 3698 dOj.dts 5 /__ dOj ((ts + ti)^2 + (w.ts.ti)^2)^2 3699 i=-k 3700 """ 3701 3702 return 0.4 * data.s2f_s2 * sum(data.dci[k] * data.fact_djw_dts, axis=2)
3703 3704 3705 3706 # Extended 2 S2f - S2s partial derivative. 3707 ########################################## 3708 3709 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion parameters. 3710
3711 -def calc_S2f_S2s_ts_d2jw_dS2fdS2s(data, params, j, k):
3712 """Spectral density Hessian. 3713 3714 Calculate the spectral desity values for the S2f - S2s double partial derivative of the extended 3715 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without 3716 diffusion tensor parameters. 3717 3718 The model-free Hessian is:: 3719 3720 _k_ 3721 d2J(w) 2 \ / 1 (ts + ti).ts \ 3722 --------- = - > ci . ti | ------------ - ------------------------- |. 3723 dS2f.dS2s 5 /__ \ 1 + (w.ti)^2 (ts + ti)^2 + (w.ts.ti)^2 / 3724 i=-k 3725 """ 3726 3727 return 0.4 * sum(data.ci * data.ti * (data.fact_ti - data.fact_ts), axis=2)
3728 3729 3730 3731 # Extended 2 S2f - tf partial derivative. 3732 ######################################### 3733 3734 # {S2f, tf, S2s, ts} with or without diffusion parameters. 3735
3736 -def calc_S2f_tf_S2s_ts_d2jw_dS2fdtf(data, params, j, k):
3737 """Spectral density Hessian. 3738 3739 Calculate the spectral desity values for the S2f - tf double partial derivative of the extended 3740 model-free formula with the parameters {S2f, tf, S2s, ts} with or without diffusion tensor 3741 parameters. 3742 3743 The model-free Hessian is:: 3744 3745 _k_ 3746 d2J(w) 2 \ (tf + ti)^2 - (w.tf.ti)^2 3747 -------- = - - > ci . ti^2 -----------------------------. 3748 dS2f.dtf 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^2 3749 i=-k 3750 """ 3751 3752 return -0.4 * sum(data.ci * data.fact_djw_dtf, axis=2)
3753 3754 3755 3756 # Extended 2 S2f - ts partial derivative. 3757 ######################################### 3758 3759 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion parameters. 3760
3761 -def calc_S2f_S2s_ts_d2jw_dS2fdts(data, params, j, k):
3762 """Spectral density Hessian. 3763 3764 Calculate the spectral desity values for the S2f - ts double partial derivative of the extended 3765 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without 3766 diffusion tensor parameters. 3767 3768 The model-free Hessian is:: 3769 3770 _k_ 3771 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 3772 -------- = - (1 - S2s) > ci . ti^2 -----------------------------. 3773 dS2f.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 3774 i=-k 3775 """ 3776 3777 return 0.4 * data.one_s2s * sum(data.ci * data.fact_djw_dts, axis=2)
3778 3779 3780 3781 # Extended 2 S2s - ts partial derivative. 3782 ######################################### 3783 3784 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion parameters. 3785
3786 -def calc_S2f_S2s_ts_d2jw_dS2sdts(data, params, j, k):
3787 """Spectral density Hessian. 3788 3789 Calculate the spectral desity values for the S2s - ts double partial derivative of the extended 3790 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without 3791 diffusion tensor parameters. 3792 3793 The model-free Hessian is:: 3794 3795 _k_ 3796 d2J(w) 2 \ (ts + ti)^2 - (w.ts.ti)^2 3797 -------- = - - S2f > ci . ti^2 -----------------------------. 3798 dS2s.dts 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^2 3799 i=-k 3800 """ 3801 3802 return -0.4 * params[data.s2f_i] * sum(data.ci * data.fact_djw_dts, axis=2)
3803 3804 3805 3806 # Extended 2 tf - tf partial derivative. 3807 ######################################## 3808 3809 # {S2f, tf, S2s, ts} with or without diffusion parameters. 3810
3811 -def calc_S2f_tf_S2s_ts_d2jw_dtf2(data, params, j, k):
3812 """Spectral density Hessian. 3813 3814 Calculate the spectral desity values for the tf - tf double partial derivative of the extended 3815 model-free formula with the parameters {S2f, tf, S2s, ts} with or without diffusion tensor 3816 parameters. 3817 3818 The model-free Hessian is:: 3819 3820 _k_ 3821 d2J(w) 4 \ (tf + ti)^3 + 3.w^2.ti^3.tf.(tf + ti) - (w.ti)^4.tf^3 3822 ------ = - - (1 - S2f) > ci . ti^2 -----------------------------------------------------. 3823 dtf**2 5 /__ ((tf + ti)^2 + (w.tf.ti)^2)^3 3824 i=-k 3825 """ 3826 3827 return -0.8 * data.one_s2f * sum(data.ci * data.ti**2 * (data.tf_ti**3 + 3.0 * data.frq_sqrd_list_ext * data.ti**3 * params[data.tf_i] * data.tf_ti - data.w_ti_sqrd**2 * params[data.tf_i]**3) * data.inv_tf_denom**3, axis=2)
3828 3829 3830 3831 # Extended 2 ts - ts partial derivative. 3832 ######################################## 3833 3834 # {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without diffusion parameters. 3835
3836 -def calc_S2f_S2s_ts_d2jw_dts2(data, params, j, k):
3837 """Spectral density Hessian. 3838 3839 Calculate the spectral desity values for the ts - ts double partial derivative of the extended 3840 model-free formula with the parameters {S2f, S2s, ts} or {S2f, tf, S2s, ts} with or without 3841 diffusion tensor parameters. 3842 3843 The model-free Hessian is:: 3844 3845 _k_ 3846 d2J(w) 4 \ (ts + ti)^3 + 3.w^2.ti^3.ts.(ts + ti) - (w.ti)^4.ts^3 3847 ------ = - - S2f(1 - S2s) > ci . ti^2 -----------------------------------------------------. 3848 dts**2 5 /__ ((ts + ti)^2 + (w.ts.ti)^2)^3 3849 i=-k 3850 """ 3851 3852 return -0.8 * data.s2f_s2 * sum(data.ci * data.ti**2 * (data.ts_ti**3 + 3.0 * data.frq_sqrd_list_ext * data.ti**3 * params[data.ts_i] * data.ts_ti - data.w_ti_sqrd**2 * params[data.ts_i]**3) * data.inv_ts_denom**3, axis=2)
3853