mcot.dippi.simulator

Classes

FibrePopulation([M0, phi, T2, T2_star, ...])

Represents a single fibre population with a single orientation and b-value

Functions

model_signal(pv_fibres, fibres, shells[, ...])

phase_shift(scan, fibre[, non_myelin_frequency])

Computes the phase shift experienced between first and second readout

random_confounds(shells[, movement, ...])

random_eddy_params(lmax[, odd])

Computes the phase offset due to eddy currents

simulation_signal(trajectories, geometry, ...)

Simulate the signal from Camino simulation

single_shell(pv_fibres, fibres[, shell, ...])

Computes the observed signal for N fibres

stick_magnitude1(scan, fibre[, ...])

Computes the magnitude contributed by a stick at the first readout

stick_signal2(scan, fibre[, ...])

Computes the signal/phase contributed by a stick at the second readout

model_signal

mcot.dippi.simulator.model_signal(pv_fibres, fibres: Sequence[mcot.dippi.simulator.FibrePopulation], shells: Sequence[mcot.dippi.scan.SimulatedShell], confounds=None, noise_level=0)[source]

phase_shift

mcot.dippi.simulator.phase_shift(scan, fibre, non_myelin_frequency=0.0)[source]

Computes the phase shift experienced between first and second readout

Parameters
  • scan – sequencing parameters

  • fibre – fibre population parameters

Returns

accumulated phase shift in radians

random_confounds

mcot.dippi.simulator.random_confounds(shells: Sequence[mcot.dippi.scan.SimulatedShell], movement=True, eddy_odd=True, eddy_even=False, non_myelin=True, eddy_lmax=6)[source]

random_eddy_params

mcot.dippi.simulator.random_eddy_params(lmax, odd=True)[source]

Computes the phase offset due to eddy currents

Parameters
  • lmax

  • odd

Returns

simulation_signal

mcot.dippi.simulator.simulation_signal(trajectories: numpy.ndarray, geometry, shell: mcot.dippi.scan.SimulatedShell, bvecs, R2=0.016666666666666666, R2_star=0.02857142857142857, phase_prime=False, global_phase=0.0, bulk_sigma=0)[source]

Simulate the signal from Camino simulation

Parameters
  • trajectories – structured array with the result from the simulation (loaded using mcutils.utils.trajectory) Should contain the time in seconds and 3-dimensional locations of each spin in meter

  • geometry – the geometry used to model the susceptibility field and separate intra- from extra-axonal axons

  • shell – Scanning parameters

  • bvecs – (N, 3) array with gradient orientations

  • R2 – irreversible dephasing in kHz (i.e., 1/ms)

  • R2_prime – reversible dephasing in kHz (i.e., 1/ms)

  • phase_prime – model reversible dephasing as Lorentzian distribution of off-resonance frequencies

  • global_phase – global off-frequency offset in fraction of the Larmor frequency

  • bulk_sigma – size of the Guassian distribution from which to draw the bulk linear motion in micrometer/ms

Returns

structure array with for every timepoint:

  • ”time”: time in ms

  • ”total”: total signal (complex number for each gradient orientation)

  • ”extra”: total extra-axonal signal (complex number for each gradient orientation)

  • ”intra”: total intra-axonal signal (complex number for each gradient orientation and axon population)

single_shell

mcot.dippi.simulator.single_shell(pv_fibres, fibres: Sequence[mcot.dippi.simulator.FibrePopulation], shell: Optional[mcot.dippi.scan.SimulatedShell] = None, confounds=None, noise_level=0)[source]

Computes the observed signal for N fibres

Parameters
  • pv_fibres – (N, ) array of partial volume of fibres (should add up to one)

  • fibres – (N, ) sequence describing each fibre population in the voxel

  • shell – scan parameters

  • confounds – dictionary with the confounds

  • noise_level – noise level to add to the data (relative to M0)

stick_magnitude1

mcot.dippi.simulator.stick_magnitude1(scan: mcot.dippi.scan.SimulatedShell, fibre: mcot.dippi.simulator.FibrePopulation, split_compartments=False)[source]

Computes the magnitude contributed by a stick at the first readout

Parameters
  • scan – sequencing parameters

  • fibre – fibre population parameters

  • split_compartments – if True return tuple with intra- and extra-axonal water separately

Returns

total magnitude at first readout (or separate intra- and extra-axonal contributions if split_compartments is True)

stick_signal2

mcot.dippi.simulator.stick_signal2(scan, fibre, split_compartments=False, non_myelin=0)[source]

Computes the signal/phase contributed by a stick at the second readout

Parameters
  • scan – sequencing parameters

  • fibre – fibre population parameters

  • split_compartments – if True return tuple with intra- and extra-axonal water separately

  • non_myelin – off-resonance frequency from non-myelin sources

Returns

total signal as complex number at second readout (or separate intra- and extra-axonal contributions if split_compartments is True)