plot.stft {GENEAread}R Documentation

plot stft

Description

Processes a dataset, creating an object contained processed time-frequency analyses. These can then be plotted.

Usage

## S3 method for class 'stft'
plot(
  x,
  mode = c("decibels", "modulus", "pval"),
  log = "",
  showmax = TRUE,
  median = FALSE,
  xaxis = TRUE,
  topthresh,
  reassign = (!(is.null(x$LGD)) && !("mv" %in% x$type)),
  ylim,
  xlim,
  new = TRUE,
  zlim.raw,
  zlim.quantile,
  cex,
  col = gray(63:0/63),
  ...
)

Arguments

x

"stft" class object to be processed.

mode

What should be plotted?

  • "decibels": log10 of FFT modulus

  • "modulus": Raw FFT modulus

  • "pvalue": P-value of each frequence's modulus assuming that window was in fact white noise of equal equal standard deviation

log

For log = "y", use a log scale on the y axis.

showmax

Vector or logical. Compute and plot the principle frequency components?

median

logical. If TRUE, smooth the STFT plot in the time direction with a running median.

xaxis

logical. If TRUE, plot pretty time axes.

topthresh

For finite values, crop plot for frequencies higher than this value, and show a summary plot up top.

reassign

logical. Plot reassigned stft, if available?

xlim, ylim

Parameters controlling axes limits of plot.

new

logical. If TRUE, make a new plot. Otherwise overlay on to existing plot.

zlim.raw

Raw values at which to threshold values for computation of heatmap colours.

zlim.quantile

Quantile values at which to threshold values for computation of heatmap colours.

cex

Size of points for reassigned STFT plotting.

col

Vector of colours to be used for plotting.

...

Additional arguments to be passed to methods.

Details

STFT objects are created by the stft function. These methods print some useful summary statistics about them, and produce plots. mode determines the type of plot. "decibel" and "modulus" work with the raw values, while "pvalue" conducts some degree of normalisation in each time window and so is perhaps more useful for data showing a large variation in sd across different points in time. If the null.calc was set in the original stft argument, that is used - otherwise, an Exponential distribution is fit to each window, and the pvalues computed from that.

By default, the function uses some empirical quantile based colour thresholds designed to give somewhat reasonable and informative plots. This can be overridden, however, by setting different zlim.raw or zlim.quantile results. This can be useful for comparing two different datasets.

Reassigned stft plots are constructed, by default, when they are available, and when the original was not a "mv" stft. Unlike the heatmap used in the usual stft plot, a 2d scatterplot is used instead. This means that if there are few data points, it can be advantageous to set a higher cex value for larger points and better display.

With Accelerometer data, often the frequencies of interest are concentrated at the lower frequencies. Topthresh crops the frequency display to show only those frequencies. A summary plot is show on the top, to compensate. Choosing a grid of frequencies, this plot draws one line to represent the energies present in the signal at that particular frequency, and higher. Black lines are drawn for frequencies less than 2/3 the topthresh, red lines for 2/3 - 1 times topthresh, and blue lines for frequencies higher than topthresh. Alternative, set log = "y" to put frequencies on a log scale.

Value

These functions are run for their side effects.

See Also

stft, image.default

Examples

 ## Not run: # Real data
 binfile  = system.file("binfile/TESTfile.bin", package = "GENEAread")[1]

#Read in the entire file, calibrated
 procfile<-read.bin(binfile)
 #Create stft object
 obj = stft(procfile, type = "svm", quiet = TRUE)
 #Look at it
 print(obj)

 plot(obj, cex = 5)
 plot(obj, showmax = FALSE, cex = 5) #suppress principals

 #pval plot
 plot(obj, mode = "pval", cex = 5)
 #disable reassigned stft
 plot(obj, mode = "pval", reassign = FALSE)
 #median smoothing
 plot(obj, mode = "pval", reassign = FALSE, median = TRUE)
 #log scale frequency, no top bar
 dev.new(); plot(obj, mode = "pval", reassign = FALSE, topthresh = Inf, log = "y")

## End(Not run)

[Package GENEAread version 2.0.10 Index]