FTGramImage: Display Fourier spectrogram

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/rendering_and_plotting.R

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

1
2
3
FTGramImage(sig, dt, ft, time.span = NULL, freq.span = NULL, 
     amp.span = NULL, blur = 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

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.

blur

Apply a Gaussian smoother. Default NULL - no smoothing

.

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 [email protected]

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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")

Example output

Adjusting Time and Frequency limits to nice looking numbers (the "pretty" option is currently set to TRUE)

hht documentation built on May 29, 2017, 9:26 a.m.