Commit 0940e592 authored by William Clarke's avatar William Clarke
Browse files

Update tests and documentation with water scaling reference options.

parent 4581561a
......@@ -168,6 +168,14 @@ Below are detailed explanations of some of the optional arguments in the wrapper
Allow independent scaling of specified basis spectra before fitting. For example this can be used to independently scale empirically measured macromolecules combined with simulated metabolite spectra.
:code:`--disable_MH_priors`
Disable the priors on the MH fitting. The priors are tuned for *in vivo* human brain spectroscopy. Use this option if your spectra has significantly different line widths, phases or large shifts. E.g. in liquid phase phantom or (potentially) pre-clinical systems. Priors can be fine tuned by altering the values in :code:`fsl_mrs.utils.constants`.
:code:`--internal_ref`
Set alternative metabolites for internal reference scaling (default is tCr = Cr + PCr). Multiple arguments can be specified for a combined internal reference.
:code:`--wref_metabolite`
Set alternative water scaling reference (default is Cr). Must be used if none of Cr, PCr and NAA are present in the basis set.
:code:`--ref_protons`
Number of protons that the water scaling reference is equivalent to (between defined integration limits). E.g. Cr is equivalent to 5 between 2 and 5 ppm. Only active when --wref_metabolite is used.
:code:`--ref_int_limits`
Integration limits for water scaling reference. Only active when --wref_metabolite is used.
The wrapper scripts can also take a configuration file as an input. For example, say we have a text file called :code:`config.txt` which contains the below:
......
......@@ -107,7 +107,7 @@ def main():
optional.add_argument('--ref_protons', type=int, default=None,
help='Number of protons that reference metabolite is equivalent to.'
' No effect without setting --wref_metabolite.')
optional.add_argument('--ref_int_limits', type=int, default=None, nargs=2,
optional.add_argument('--ref_int_limits', type=float, default=None, nargs=2,
help='Reference spectrum integration limits (low, high).'
' No effect without setting --wref_metabolite.')
optional.add_argument('--h2o_scale', type=float, default=1.0,
......
......@@ -100,7 +100,7 @@ def main():
optional.add_argument('--ref_protons', type=int, default=None,
help='Number of protons that reference metabolite is equivalent to.'
' No effect without setting --wref_metabolite.')
optional.add_argument('--ref_int_limits', type=int, default=None, nargs=2,
optional.add_argument('--ref_int_limits', type=float, default=None, nargs=2,
help='Reference spectrum integration limits (low, high).'
' No effect without setting --wref_metabolite.')
optional.add_argument('--report', action="store_true",
......
......@@ -47,3 +47,30 @@ def test_fsl_mrs(tmp_path):
assert op.exists(op.join(tmp_path, 'qc.csv'))
assert op.exists(op.join(tmp_path, 'all_parameters.csv'))
assert op.exists(op.join(tmp_path, 'options.txt'))
def test_alt_ref(tmp_path):
subprocess.check_call(['fsl_mrs',
'--data', data['metab'],
'--basis', data['basis'],
'--output', tmp_path,
'--h2o', data['water'],
'--TE', '11',
'--metab_groups', 'Mac',
'--tissue_frac', '0.45', '0.45', '0.1',
'--overwrite',
'--combine', 'Cr', 'PCr',
'--combine', 'NAA', 'NAAG',
'--internal_ref', 'NAA', 'NAAG',
'--wref_metabolite', 'PCh',
'--ref_protons', '3',
'--ref_int_limits', '3.0', '3.4',
'--report'])
assert op.exists(op.join(tmp_path, 'report.html'))
assert op.exists(op.join(tmp_path, 'summary.csv'))
assert op.exists(op.join(tmp_path, 'concentrations.csv'))
assert op.exists(op.join(tmp_path, 'qc.csv'))
assert op.exists(op.join(tmp_path, 'all_parameters.csv'))
assert op.exists(op.join(tmp_path, 'options.txt'))
......@@ -239,7 +239,7 @@ class QuantificationInfo(object):
raise TypeError(f'Specified reference metabolite should be string not {type(specified_metab)}')
if not isinstance(specified_protons, int):
raise TypeError(f'Specified reference metabolite protons should be int not {type(specified_protons)}')
if not isinstance(specified_limits, {list, tuple}):
if not isinstance(specified_limits, (list, tuple)):
raise TypeError(f'Specified reference metabolite limits should be tuple not {type(specified_limits)}')
if specified_metab in metab_list:
......
Markdown is supported
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