From af081e1f6848150477557bed12ec56bd1689ed26 Mon Sep 17 00:00:00 2001 From: Blaise deB Frederick Date: Tue, 31 Oct 2023 11:05:19 +0000 Subject: [PATCH] Added ability to normalize all timecourses to ease display on the same axis --- rapidtide/workflows/showtc.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rapidtide/workflows/showtc.py b/rapidtide/workflows/showtc.py index 19ca732e0..7bd87c01a 100644 --- a/rapidtide/workflows/showtc.py +++ b/rapidtide/workflows/showtc.py @@ -29,6 +29,7 @@ import rapidtide.filter as tide_filt import rapidtide.fit as tide_fit import rapidtide.io as tide_io +import rapidtide.miscmath as tide_math import rapidtide.util as tide_util import rapidtide.workflows.parser_funcs as pf @@ -122,6 +123,13 @@ def _get_parser(): help="Swap rows and columns in the input files.", default=False, ) + parser.add_argument( + "--normall", + action="store_true", + dest="normall", + help="Normalize all displayed timecourses to unit standard deviation and zero mean.", + default=False, + ) # add plot appearance options pf.addplotopts(parser) @@ -338,6 +346,9 @@ def showtc(args): elif demean: invec = invec - np.mean(invec) + if args.normall: + invec = tide_math.stdnormalize(invec) + if useHamming: freqaxis, spectrum = tide_filt.spectrum( tide_filt.hamming(len(invec)) * invec, @@ -356,7 +367,10 @@ def showtc(args): xvecs.append(freqaxis) yvecs.append(spectrum) else: - yvecs.append(invecs[j] * 1.0) + if args.normall: + yvecs.append(tide_math.stdnormalize(invecs[j] * 1.0)) + else: + yvecs.append(invecs[j] * 1.0) xvecs.append( thisstartoffset + np.arange(0.0, len(yvecs[-1]), 1.0) / thissamplerate )