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

Source Code for Module maths_fns.jw_mf

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