Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michiel Cottaar
fsl_mrs
Commits
0443d171
Commit
0443d171
authored
Mar 11, 2021
by
William Clarke
Browse files
All SNR measures now take max(abs(real())) rather than max(real()) to deal with negative peaks.
parent
25d9cd96
Changes
1
Hide whitespace changes
Inline
Side-by-side
fsl_mrs/utils/qc.py
View file @
0443d171
...
...
@@ -60,7 +60,7 @@ def calcQC(mrs, res, ppmlim=(0.2, 4.2)):
first
,
last
=
mrs
.
ppmlim_to_range
(
ppmlim
=
res
.
ppmlim
)
baseline
=
FIDToSpec
(
res
.
predictedFID
(
mrs
,
mode
=
'baseline'
))[
first
:
last
]
spectrumMinusBaseline
=
mrs
.
get_spec
(
ppmlim
=
res
.
ppmlim
)
-
baseline
snrResidual_height
=
np
.
max
(
np
.
real
(
spectrumMinusBaseline
))
snrResidual_height
=
np
.
max
(
np
.
abs
(
np
.
real
(
spectrumMinusBaseline
))
)
rmse
=
2.0
*
np
.
sqrt
(
res
.
mse
)
snrResidual
=
snrResidual_height
/
rmse
...
...
@@ -97,7 +97,7 @@ def calcQCOnResults(mrs, res, resparams, ppmlim):
# Calculate single spectrum SNR - based on max value of actual data in region
# No apodisation applied.
allSpecHeight
=
np
.
max
(
np
.
real
(
mrs
.
get_spec
(
ppmlim
=
ppmlim
)))
allSpecHeight
=
np
.
max
(
np
.
abs
(
np
.
real
(
mrs
.
get_spec
(
ppmlim
=
ppmlim
)))
)
unApodNoise
=
noiseSD
(
mrs
.
get_spec
(),
noisemask
)
specSNR
=
allSpecHeight
/
unApodNoise
...
...
@@ -195,7 +195,7 @@ def matchedFilterSNR(mrs, basismrs, lw, noisemask, ppmlim):
apodSpec
=
specApodise
(
mrs
,
lw
)
currNoise
=
noiseSD
(
apodSpec
,
noisemask
)
first
,
last
=
mrs
.
ppmlim_to_range
(
ppmlim
=
ppmlim
)
peakHeight
=
np
.
max
(
np
.
real
(
apodbasis
[
first
:
last
]))
peakHeight
=
np
.
max
(
np
.
abs
(
np
.
real
(
apodbasis
[
first
:
last
]))
)
# import matplotlib.pyplot as plt
# plt.plot(np.real(apodSpec))
# plt.plot(noisemask*np.max(np.real(apodSpec)))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment