Stores single electrode or reference signals
Public fields
electrode
electrode number in integer
raw_power
stores pre-epoch power spectrum with no reference
raw_phase
stores pre-epoch phase with no reference
raw_volt
stores pre-epoch analog traces with no reference
phase
stores pre-epoch phase after reference
power
stores pre-epoch power spectrum after reference
volt
stores pre-epoch analog traces after reference
preload
which of the three data are pre-loaded
reference
character or
Electrode
instance indicating the reference for current electrodehas_power, has_phase, has_volt
whether power, phase, or voltage data exist in file system before and after reference
Active bindings
has_power, has_phase, has_volt
whether power, phase, or voltage data exist in file system before and after reference
blocks
character vector of block names (read-only)
subject_id
character of subject ID (read-only)
reference_electrode
whether this is a reference (read-only)
Methods
Method print()
overrides default print method
Method clean()
remove data from memory
Usage
Electrode$clean(types = c("power", "phase", "volt"), force = FALSE)
Method new()
constructor
Usage
Electrode$new(
subject,
electrode,
reference_by = "noref",
preload = NULL,
is_reference = FALSE
)
Arguments
subject
Subject
instance or characters like"proj/sub"
electrode
number, integer
reference_by
reference signals, choices are character, or
Electrode
instance; default is"noref"
, meaning no reference to the electrodepreload
data to load along with constructor
is_reference
is current instance a reference?
Method epoch()
epoch electrode
Usage
Electrode$epoch(
epoch_name,
pre,
post,
types = c("volt", "power", "phase"),
raw = FALSE,
hybrid = TRUE
)
Arguments
epoch_name
epoch name, for example,
epoch_name="default"
refers to epoch file"epoch_default.csv"
in subject meta folderpre
seconds before trial onset to load
post
seconds after trial onset to load
types
characters, data types to load; choices are
"volt"
,"power"
, and"phase"
raw
whether epoch pre-referenced data?
hybrid
whether to fast-cache the data on hard-drive? See also
Tensor
Examples
if (FALSE) {
# Electrode with no reference
e1 <- Electrode$new('demo/YAB', electrode = 14, reference_by = 'noref')
e1$reference
#> Subject: demo/YAB
#> Electrode: noref (Reference)
# Add Common Average Reference in rave/data/reference/ref_13-63,65-84.h5
e2 <- Electrode$new('demo/YAB', electrode = 14,
reference_by = 'ref_13-63,65-84')
# Electrode with bipolar reference by another electrode
e3 <- Electrode$new('demo/YAB', electrode = 14, reference_by = 'ref_15')
# Alternative way
reference <- Electrode$new('demo/YAB', electrode = 15, is_reference = TRUE)
e4 <- Electrode$new('demo/YAB', electrode = 14, reference_by = reference)
# e3, e4 are the same in scientific meaning. To test it, epoch them
power3 <- e3$epoch('YABaOutlier', 1, 2, 'power',
raw = FALSE, hybrid = FALSE)$power
power4 <- e4$epoch('YABaOutlier', 1, 2, 'power',
raw = FALSE, hybrid = TRUE)$power
# Compare e3 and e4, result difference should be 0
range(power3$get_data() - power4$get_data())
#> 0
# With or without hybrid, the size will be different
# No hybrid, totally in memory
lobstr::obj_size(power3)
#> 12 MB
# Hybrid, data is swapped to hard-drive
lobstr::obj_size(power4)
#> 908 kB
}