Skip to content

Commit

Permalink
Added ability to normalize all timecourses to ease display on the sam…
Browse files Browse the repository at this point in the history
…e axis
  • Loading branch information
bbfrederick committed Oct 31, 2023
1 parent 715d21d commit af081e1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion rapidtide/workflows/showtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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
)
Expand Down

0 comments on commit af081e1

Please sign in to comment.