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