spectrogram {zeitgebr} | R Documentation |
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 |
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.
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 thepower
is computed, for a givent
(in s) -
power
– the power the or equivalent (according toFUN
) -
ridge
– a logical defining whether the point (t
andperiod
) is a ridge
References
-
spectrogram tutorial – the relevant rehtomics tutorial
See Also
-
periodogram – to compute periodogram instead
-
cwt_spectrogram – The dunction use to compute individual spectrograms
-
ggetho::ggspectro – to plot spectrograms
Examples
data(dams_sample)
dt <- dams_sample[id %in% dams_sample[meta=TRUE, ,id[1:5]]]
spect_dt <- spectrogram(activity, dt)
require(ggetho)
ggspectro(spect_dt) +
stat_tile_etho() +
scale_y_log10() +
facet_wrap(~ id)