Parameters

from mcot.dippi.model import Parameters
class mcot.dippi.model.Parameters(as_dict: dict, shells: Union[mcot.dippi.scan.MultiShell, Sequence[Union[mcot.dippi.scan.ObservedShell, mcot.dippi.scan.SimulatedShell]]], eddy_lmax: int)[source]

Object representing a set of model parameters across all shells and fibre populations (for a single voxel)

All parameters: - orient Bingham distribution orientation - width width of Bingham distribution - log_g average log(g). Only used for single-population model - f_myelin fraction of myelinated axons. Only used for two-population model - log_g_myelin log g-ratio of myelinated axons. Only used for two-population model - non_myelin off-resonance frequency due to non-myelin sources - movement_phase random phase offset due to movement - amplitude_se amplitude of the signal parallel to the fibres at the first spin echo readout - amplitude_ase amplitude of the signal parallel to the fibres at the second asymmetric spin echo readout - R2 irreversible rate of transverse signal decay (inverse of T2) - R2i reversible rate of transverse signal decay (R2 + R2i is the inverse of T2*) - eddy_odd odd components of the eddy currents - eddy_even even components of the eddy currents

__init__(as_dict: dict, shells: Union[mcot.dippi.scan.MultiShell, Sequence[Union[mcot.dippi.scan.ObservedShell, mcot.dippi.scan.SimulatedShell]]], eddy_lmax: int)[source]

Creates a new parameter set based on provided dictionary

Parameters
  • as_dict

    maps parameters name to a tuple with:

    • (N, ) index array for N shells, where each shell is mapped to M parameters (with M<= N)

    • (M, ) jax array with the parameter values

  • shells – (N, ) sequence of shells defining how the data was acquired

  • eddy_lmax – maximum degree of the spherical harmonic fit to the eddy components (odd or even)

Inheritance diagram

Inheritance diagram of mcot.dippi.model.Parameters

Methods

copy()

Copies the object

empty(shells[, nfibres, eddy_lmax, dependencies])

Defines for each parameter on which level they will vary.

from_dict(a_dict)

Converts dictionary back into Parameters object

guess_orient(all_data)

Guesses the fibre orientation fits and updates them in place

random_confounds([shot_phase, eddy_odd, …])

Randomly set any of the confounds that are set to True

set_population(index, population)

Sets the magnitude and log(g) based on the fibre population

to_change(tofit)

Returns sequence of arrays that should be changed during fitting

to_dict()

Converts object into a dictionary

to_xarray()

Converts all parameters (excluding movement_phase) to an xarray object for later analysis

Attributes

nfibres

Number of fibre populations estimated

copy

Parameters.copy()[source]

Copies the object

Returns

new Parameter object with a deep copy of the actual parameters, but shallow copy of the shells

empty

classmethod Parameters.empty(shells: Union[mcot.dippi.scan.MultiShell, Sequence[Union[mcot.dippi.scan.ObservedShell, mcot.dippi.scan.SimulatedShell]]], nfibres=2, eddy_lmax=1, dependencies=None)[source]

Defines for each parameter on which level they will vary.

Parameters
  • shells – sequence of shells defining how the data was acquired

  • nfibres – number of crossing fibres

  • eddy_lmax – maximum order of the spherical harmonics used to fit the eddy currents

  • dependencies – on what observatinal variables does each parameter depend (defaults to result of default_dependencies())

from_dict

classmethod Parameters.from_dict(a_dict)[source]

Converts dictionary back into Parameters object

guess_orient

Parameters.guess_orient(all_data)[source]

Guesses the fibre orientation fits and updates them in place

Guesses are based on diffusion tensor fit to the the spin echo data for the first shell

First fibre is updated to point in direction of V1 Second fibre is updated to point in direction of V2 Third fibre is updated to point in direction of V3

random_confounds

Parameters.random_confounds(shot_phase=True, eddy_odd=True, eddy_even=False, non_myelin=True)[source]

Randomly set any of the confounds that are set to True

Parameters
  • shot_phase – assign each shot a random phase between 0 and 2 pi

  • eddy_odd – odd components of the eddy current spherical harmonics

  • eddy_even – even components of the eddy current spherical harmonics

  • non_myelin – susceptibility from non-myelin sources

set_population

Parameters.set_population(index, population: mcot.dippi.simulator.FibrePopulation)[source]

Sets the magnitude and log(g) based on the fibre population

Parameters
  • index – which crossing fibre to set (0-based)

  • population – object describing a fibre population

to_change

Parameters.to_change(tofit)[source]

Returns sequence of arrays that should be changed during fitting

Parameters

tofit – name of the parameters to fit

Returns

tuple with

  • (N, ) list of arrays

  • dictionary mapping (parameter name, idx_shell, idx_fibre) to corresponding index in the returned array

to_dict

Parameters.to_dict()[source]

Converts object into a dictionary

to_xarray

Parameters.to_xarray()[source]

Converts all parameters (excluding movement_phase) to an xarray object for later analysis