Commit 8af9f2d5 authored by William Clarke's avatar William Clarke
Browse files

Documentation for diff basis sets and update to denmatsim

parent 735e7b8f
......@@ -3,7 +3,8 @@ This document contains the FSL-MRS release history in reverse chronological orde
1.1.3 (TBC)
------------------------------
- Added mrs_tools script. Replaces mrs_vis and mrs_info. Adds split/merge/reorder functionality.
- Added basis_tools script. Tools for manipulating (shifting, scaling converting, and adding to) basis sets.
- Added basis_tools script. Tools for manipulating (shifting, scaling, converting, differencing, and adding to) basis sets.
- Improved display of basis sets using mrs_tools or basis_tools.
- Under the hood refactor of basis, MRS and MRSI classes.
1.1.2 (Friday 16th April 2021)
......
......@@ -7,7 +7,7 @@ basis_tools
-----------
The :code:`basis_tools` script provides the user with tools for manipulating basis spectra in the FSL-MRS JSON format.
Provide one of the following subcommands with :code:`basis_tools` to convert, scale, add to or shift basis spectra.
Provide one of the following subcommands with :code:`basis_tools` to convert, scale, add to, difference, or shift basis spectra.
info
****
......@@ -37,4 +37,9 @@ shift
scale
*****
| *Example* :code:`basis_tools shift path/to/my/fslbasis NAA path/to/my/scaled_fslbasis`
| Rescale a basis spectrum to the mean of all other basis spectra (or to specified target :code:`--target_scale`.
\ No newline at end of file
| Rescale a basis spectrum to the mean of all other basis spectra (or to specified target :code:`--target_scale`.
diff
****
| *Example* :code:`basis_tools diff --add_or_sub sub mega_on mega_off mega_diff`
| Form a basis set for a difference method using two other basis set. Add or subtract using :code:`--add_or_sub {'add'|'sub}`.
\ No newline at end of file
......@@ -44,6 +44,11 @@ Optionally:
- Automatic phasing of the spectra can be achieved by simulating a singlet peak at a specified offset from the receiver centre (:code:`-p, --autophase`, offset in ppm).
- Different format outputs can be specified (:code:`--jmrui, --raw, --lcmIN`).
Simulating basis spectra for j-difference editing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To simulate a basis spectrum for a j-difference edited sequence (e.g. MEGA-PRESS) simulate the basis for each condition and create the difference spectrum using the :code:`basis_tools diff` script.
Choosing metabolites
~~~~~~~~~~~~~~~~~~~~
The simulator is aware of the following metabolites. Spin systems are specified as in [SIMP17]_ and [GOVI00]_.
......
Subproject commit b3cdff2cab6704c2cb7ba818e300896924a1e7bc
Subproject commit 684b1be515d1314ba28c2dde872300f7980c2491
......@@ -343,13 +343,24 @@ def plot_basis(basis, ppmlim=(0.0, 4.5), shift=True, conjugate=False):
axis = basis.original_ppm_axis
first, last = limit_to_range(axis, ppmlim)
n_met = basis.n_metabs
if n_met <= 10:
colors = plt.cm.tab10(np.linspace(0, 1, n_met))
elif n_met <= 20:
colors = plt.cm.tab20(np.linspace(0, 1, n_met))
elif n_met > 20:
colors = plt.cm.nipy_spectral(np.linspace(0, 1, n_met))
ax = plt.figure().gca()
ax.set_prop_cycle('color', colors)
for idx, n in enumerate(basis.names):
FID = basis.original_basis_array[:, idx]
if conjugate:
FID = FID.conj()
plt.plot(axis[first:last],
np.real(FID2Spec(FID))[first:last],
label=n)
ax.plot(axis[first:last],
np.real(FID2Spec(FID))[first:last],
label=n)
plt.gca().invert_xaxis()
plt.xlabel('Chemical shift (ppm)')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment