FTGramImage: Display Fourier spectrogram

View source: R/rendering_and_plotting.R

FTGramImageR Documentation

Display Fourier spectrogram

Description

This function displays a Fourier spectrogram using the same plot structure and options as HHGramImage. It uses the function EvolutiveFFT to generate a spectrogram, then wraps it in the same plotting format as HHGramImage.

Usage

FTGramImage(sig, dt, ft, time.span = NULL, freq.span = NULL, 
     amp.span = NULL, taper=0.05, scaling = "none", grid=TRUE, 
    colorbar=TRUE, backcol=c(0, 0, 0), colormap=NULL, pretty=FALSE, ...)

Arguments

sig

The signal to process

dt

sample rate

ft

Fourier spectrogram options

  • ft$nfft is the fft length

  • ft$ns is the number of samples in a window

  • ft$nov is the number of samples to overlap

time.span

Time span to render spectrogram over. NULL will draw the spectrogram over the entire signal.

freq.span

Frequency span to render spectrogram over. NULL plots everything up to the Nyquist frequency.

amp.span

Amplitude range to plot. NULL plots everything.

taper

Taper value to use for spectrogram (default is 0.05), see spec.taper in the base package.

scaling

determines whether to apply logarithmic (log), or square root (sqrt) scaling to the amplitude data

grid

Boolean - whether to display grid lines or not

colorbar

Boolean - whether to display amplitude colorbar or not

backcol

What background color to use behind the spectrogram, in a 3 element vector: c(red, green, blue)

colormap

What palette object to use for the spectrogram, defaults to rainbow

pretty

Boolean - choose nice axes values, some adjustment may result

...

This function supports some optional parameters as well:

  • trace.format - the format of the trace minima and maxima in sprintf format

  • img.x.format - the format of the X axis labels of the image in sprintf format

  • img.y.format - the format of the Y axis labels of the image in sprintf format

  • colorbar.format - the format of the colorbar labels in sprintf format

  • cex.lab - the font size of the image axis labels

  • cex.colorbar - the font size of the colorbar

  • cex.trace - the font size of the trace axis labels

  • img.x.lab - the X - axis label of the image, it defaults to "time"

  • img.y.lab- the Y - axis label of the image, it defaults to "frequency"

  • main - figure title

Details

This function is a simple Fourier spectrogram plotter. It's useful to compare this image with images generated by HHGramImage to see how the Fourier and Hilbert spectrograms differ.

Value

img

The spectrogram image, suitable for plotting with the generic image function

Author(s)

Daniel Bowman danny.c.bowman@gmail.com

References

Jonathan M. Lees (2012). RSEIS: Seismic Time Series Analysis Tools. R package version 3.0-6. http://CRAN.R-project.org/package=RSEIS

See Also

HHGramImage, EvolutiveFFT

Examples

data(PortFosterEvent)

dt <- mean(diff(tt))

ft <- list()
ft$nfft <- 4096
ft$ns <- 30
ft$nov <- 29

time.span <- c(5, 10)
freq.span <- c(0, 25)
amp.span <- c(1e-5, 0.0003)
FTGramImage(sig, dt, ft, time.span = time.span, freq.span = freq.span, 
    amp.span = amp.span, pretty = TRUE, img.x.format = "%.1f",
    img.y.format = "%.0f",
    main = "Port Foster Event - Fourier Spectrogram")

hht documentation built on March 31, 2023, 10:08 p.m.

Related to FTGramImage in hht...