LFP_electrode | R Documentation |
Please use a safer new_electrode
function to
create instances. This documentation is to describe the member methods
of the electrode class LFP_electrode
if the reference number if NULL
or 'noref'
, then
returns 0, otherwise returns a FileArray-class
If simplify
is enabled, and only one block is loaded,
then the result will be a vector (type="voltage"
) or a matrix
(others), otherwise the result will be a named list where the names
are the blocks.
raveio::RAVEAbstarctElectrode
-> LFP_electrode
h5_fname
'HDF5' file name
valid
whether current electrode is valid: subject exists and contains current electrode or reference; subject electrode type matches with current electrode type
raw_sample_rate
voltage sample rate
power_sample_rate
power/phase sample rate
preprocess_info
preprocess information
power_file
path to power 'HDF5' file
phase_file
path to phase 'HDF5' file
voltage_file
path to voltage 'HDF5' file
print()
print electrode summary
LFP_electrode$print()
set_reference()
set reference for current electrode
LFP_electrode$set_reference(reference)
reference
either NULL
or LFP_electrode
instance
new()
constructor
LFP_electrode$new(subject, number, quiet = FALSE)
subject, number, quiet
see constructor in
RAVEAbstarctElectrode
.load_noref_wavelet()
load non-referenced wavelet coefficients (internally used)
LFP_electrode$.load_noref_wavelet(reload = FALSE)
reload
whether to reload cache
.load_noref_voltage()
load non-referenced voltage (internally used)
LFP_electrode$.load_noref_voltage(reload = FALSE)
reload
whether to reload cache
srate
voltage signal sample rate
.load_wavelet()
load referenced wavelet coefficients (internally used)
LFP_electrode$.load_wavelet( type = c("power", "phase", "wavelet-coefficient"), reload = FALSE )
type
type of data to load
reload
whether to reload cache
.load_voltage()
load referenced voltage (internally used)
LFP_electrode$.load_voltage(reload = FALSE)
reload
whether to reload cache
.load_raw_voltage()
load raw voltage (no process)
LFP_electrode$.load_raw_voltage(reload = FALSE)
reload
whether to reload cache
load_data()
method to load electrode data
LFP_electrode$load_data( type = c("power", "phase", "voltage", "wavelet-coefficient", "raw-voltage") )
type
data type such as "power"
, "phase"
,
"voltage"
, "wavelet-coefficient"
, and
"raw-voltage"
. For "power"
, "phase"
,
and "wavelet-coefficient"
, 'Wavelet' transforms are required.
For "voltage"
, 'Notch' filters must be applied. All these
types except for "raw-voltage"
will be referenced.
For "raw-voltage"
, no reference will be performed since the data
will be the "raw" signal (no processing).
load_blocks()
load electrode block-wise data (with no reference), useful when epoch is absent
LFP_electrode$load_blocks( blocks, type = c("power", "phase", "voltage", "wavelet-coefficient", "raw-voltage"), simplify = TRUE )
blocks
session blocks
type
data type such as "power"
, "phase"
,
"voltage"
, "raw-voltage"
(with no filters applied, as-is
from imported), "wavelet-coefficient"
. Note that if type
is "raw-voltage"
, then the data only needs to be imported;
for "voltage"
data, 'Notch' filters must be applied; for
all other types, 'Wavelet' transforms are required.
simplify
whether to simplify the result
clear_cache()
method to clear cache on hard drive
LFP_electrode$clear_cache(...)
...
ignored
clear_memory()
method to clear memory
LFP_electrode$clear_memory(...)
...
ignored
clone()
The objects of this class are cloneable with this method.
LFP_electrode$clone(deep = FALSE)
deep
Whether to make a deep clone.
# Download subject demo/DemoSubject
subject <- as_rave_subject("demo/DemoSubject", strict = FALSE)
if(dir.exists(subject$path)) {
# Electrode 14 in demo/DemoSubject
e <- new_electrode(subject = subject, number = 14, signal_type = "LFP")
# Load CAR reference "ref_13-16,24"
ref <- new_reference(subject = subject, number = "ref_13-16,24",
signal_type = "LFP")
e$set_reference(ref)
# Set epoch
e$set_epoch(epoch = 'auditory_onset')
# Set loading window
e$trial_intervals <- list(c(-1, 2))
# Preview
print(e)
# Now epoch power
power <- e$load_data("power")
names(dimnames(power))
# Subset power
subset(power, Time ~ Time < 0, Electrode ~ Electrode == 14)
# Draw baseline
tempfile <- tempfile()
bl <- power_baseline(power, baseline_windows = c(-1, 0),
method = "decibel", filebase = tempfile)
collapsed_power <- collapse2(bl, keep = c(2,1))
# Visualize
dname <- dimnames(bl)
image(collapsed_power, x = dname$Time, y = dname$Frequency,
xlab = "Time (s)", ylab = "Frequency (Hz)",
main = "Mean power over trial (Baseline: -1~0 seconds)",
sub = glue('Electrode {e$number} (Reference: {ref$number})'))
abline(v = 0, lty = 2, col = 'blue')
text(x = 0, y = 20, "Audio onset", col = "blue", cex = 0.6)
# clear cache on hard disk
e$clear_cache()
ref$clear_cache()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.