Abstract definition of electrode class in 'RAVE'
Source:R/class007-abstract_electrode.R
RAVEAbstarctElectrode.RdThis class is not intended for direct use. Please create new child classes and implement some key methods.
Value
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.
Super class
ravepipeline::RAVESerializable -> RAVEAbstarctElectrode
Public fields
subjectsubject instance (
RAVESubject)numberinteger stands for electrode number or reference ID
referencereference electrode, either
NULLfor no reference or an electrode instance inheritsRAVEAbstarctElectrodeepocha
RAVEEpochinstancestitch_eventsevents to stitch, when loading window is not default to trial onset; must be
NULLor a character vector of length 2
Active bindings
typesignal type of the electrode, such as 'LFP', 'Spike', and 'EKG'; default is 'Unknown'
power_enabledwhether the electrode can be used in power analyses such as frequency, or frequency-time analyses; this usually requires transforming the electrode raw voltage signals using signal processing methods such as 'Fourier', 'wavelet', 'Hilbert', 'Multitaper', etc.
is_referencewhether this instance is a reference electrode
locationlocation type of the electrode, see
LOCATION_TYPESfor detailsexistswhether electrode exists in subject
preprocess_filepath to preprocess 'HDF5' file
power_filepath to power 'HDF5' file
phase_filepath to phase 'HDF5' file
voltage_filepath to voltage 'HDF5' file
reference_namereference electrode name
epoch_namecurrent epoch name
cache_rootrun-time cache path;
NAif epoch or trial intervals are missingtrial_intervalstrial intervals relative to epoch onset
Methods
Method new()
constructor
Usage
RAVEAbstarctElectrode$new(subject, number, quiet = FALSE)Arguments
subjectcharacter or
RAVESubjectinstancenumbercurrent electrode number or reference ID
quietreserved, whether to suppress warning messages
Method set_epoch()
set epoch instance for the electrode
Arguments
epochcharacters or
RAVEEpochinstance. For characters, make sure"epoch_<name>.csv"is in meta folder.stitch_eventsevents to stitch, default is
NULL, meaning when loading data, the time is relative to the trial onset (column"Time"in the epoch file); set to a character of length 2, representing the events if time is not relative to trial onset. Please remove the prefix. For example, for a column named"Event_name", the event name is"name".
Method load_data_with_blocks()
load electrode block-wise data (with reference), useful when epoch is absent
Examples
if( has_rave_subject("demo/DemoSubject") ) {
# To run this example, please download demo subject (~700 MB) from
# https://github.com/beauchamplab/rave/releases/tag/v0.1.9-beta
generator <- RAVEAbstarctElectrode
# load demo subject electrode 14
e <- generator$new("demo/DemoSubject", number = 14)
# set epoch
e$subject$epoch_names
e$set_epoch("auditory_onset")
head(e$epoch$table)
# set epoch range (-1 to 2 seconds relative to onset)
e$trial_intervals <- c(-1,2)
# or to set multiple ranges
e$trial_intervals <- list(c(-2,-1), c(0, 2))
# set reference
e$subject$reference_names
reference_table <- e$subject$meta_data(
meta_type = "reference",
meta_name = "default")
ref_name <- subset(reference_table, Electrode == 14)[["Reference"]]
# the reference is CAR type, mean of electrode 13-16,24
ref_name
# load & set reference
ref <- generator$new(e$subject, ref_name)
e$set_reference(ref)
}