Electrode | R Documentation |
Stores single electrode or reference signals
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 electrode
has_power, has_phase, has_volt
whether power, phase, or voltage data exist in file system before and after reference
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)
info()
print electrode information
Electrode$info()
none
print()
overrides default print method
Electrode$print(...)
...
ignored
none
switch_reference()
switch reference (experimental)
Electrode$switch_reference(new_reference)
new_reference
An electrode instance
none
referenced()
get referenced data
Electrode$referenced(type = "power", ram = TRUE)
type
which data to reference, default is power
ram
whether to load data to memory
If ram
is true, then returns a list of matrices. The
length of the list equals the number of blocks, and each matrix is
frequency by time points. If ram
is false, then returns an
environment with each element a LazyH5
or
LazyFST
instance.
clean()
remove data from memory
Electrode$clean(types = c("power", "phase", "volt"), force = FALSE)
types
data types to clean
force
whether to remove pre-loaded data types
none
new()
constructor
Electrode$new( subject, electrode, reference_by = "noref", preload = NULL, is_reference = FALSE )
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 electrode
preload
data to load along with constructor
is_reference
is current instance a reference?
An Electrode
instance
epoch()
epoch electrode
Electrode$epoch( epoch_name, pre, post, types = c("volt", "power", "phase"), raw = FALSE, hybrid = TRUE )
epoch_name
epoch name, for example, epoch_name="default"
refers to epoch file "epoch_default.csv"
in subject meta folder
pre
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
list of data after epoch
Zhengjia Wang
## Not run:
# 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
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.