Learn R Programming

zeitgebr (version 0.3.5)

spectrogram: Computes spectrogram

Description

This function builds spectrogram, using CWT, for each individual of a behavr table

Usage

spectrogram(var, data, period_range = c(hours(16), hours(32)),
  resample_rate = 1/mins(15), FUN = cwt_spectrogram, ...)

Arguments

var

variable to analyse

data

behavr table

period_range

vector of size 2 defining minimal and maximal range of period to study (in seconds)

resample_rate

frequency to resample (up or down) the data at (in hertz)

FUN

function used to compute spectrograms (so far, only CWT is implemented via cwt_spectrogram)

...

additional arguments to be passed to FUN

Value

A behavr::behavr table. In addition to the metadata, it contains data that encodes a spectrogram (i.e. power vs period). The data contains the columns:

  • t -- the time (in s) (same range the input time)

  • period -- the period at which the power is computed, for a given t (in s)

  • power -- the power the or equivalent (according to FUN)

  • ridge -- a logical defining whether the point (t and period) is a ridge

Details

A spectrogram is a estimation of the local periodicity of a signal at a given time. In the context of circadian rhythm, it can be useful to understand how infradian rhythms change along the day or, for instance, how circadian rhythm change ver the course of an multi-day experiment.

References

See Also

Examples

Run this code
# NOT RUN {
data(dams_sample)
dt <- dams_sample[id %in% dams_sample[meta=TRUE, ,id[1:5]]]
spect_dt <- spectrogram(activity, dt)

# }
# NOT RUN {
require(ggetho)
ggspectro(spect_dt) +
        stat_tile_etho() +
        scale_y_log10() +
        facet_wrap(~ id)
# }

Run the code above in your browser using DataLab