A repository to keep subject information, including electrode instances, reference information, epoch data, and offers method to epoch data.
Public fields
subjectSubjectinstancerawdictionary to store
Electrodeinstancesreferencedictionary to store references for electrodes
epochsdictionary to store epoch data
raw_voltenvironment, stores pre-referenced analog traces
raw_powerenvironment, stores pre-referenced power spectrum
raw_phaseenvironment, stores pre-referenced phase data
voltenvironment, stores referenced analog traces
powerenvironment, stores referenced power spectrum
phaseenvironment, stores referenced phase data
Methods
Method print()
print memory address
Method new()
constructor
Usage
ECoGRepository$new(subject, reference = "default", autoload = TRUE)Arguments
subjectcharacter such as
"project/subject"orSubjectinstancereferencecharacter, reference name, default is
"default", which refers to"reference_default.csv"in subject meta folderautoloadlogical, whether to auto-load reference for all electrodes, default is yes.
Method get_electrode()
get Electrode instances
Method load_electrodes()
load electrodes; usually don't need to directly call this
method if autoload is true when initializing the repository
Method epoch()
slice the data according to epoch table
Usage
ECoGRepository$epoch(
epoch_name,
pre,
post,
electrodes = NULL,
frequency_range = NULL,
data_type = "power",
referenced = TRUE,
func = NULL,
quiet = FALSE
)Arguments
epoch_namethe name of epoch; for example,
"YABa"refers to"epoch_YABa.csv"in subject meta folder.prepositive number in seconds, how long should the time be kept before the onset
postpositive number in seconds, how long should the time be kept after onset
electrodesintegers, electrode numbers
frequency_rangeexperimental, frequency range to include
data_typedata types to epoch; default is
"power", which is power spectrum, or amplitude. Other choices are"phase"for phase data and"volt"for voltage or analog signal traces.referencedwhether to load data referenced or without reference
funcexperimental, function to apply to each electrodes
quietwhether to suppress output messages, default is no
Method baseline()
baseline signals (deprecated)
Returns
data after baseline. Please use baseline
instead
Examples
if (FALSE) { # \dontrun{
# Two ways to create instances
repo <- ECoGRepository$new('demo/YAB')
subject <- Subject$new(project_name = 'demo', subject_code = 'YAB')
repo <- ECoGRepository$new(subject)
# Create an instance without auto collecting references, only load
# interesting electrodes
repo <- ECoGRepository$new('demo/YAB', autoload = FALSE)
repo$load_electrodes(c(14,15))
# Create an instance with non-default reference
repo <- ECoGRepository$new('demo/YAB', reference = 'bipolar')
# Epoch data according to epoch file "epoch_YABaOutlier.csv" in meta folder
# epoch_name should be "epoch_(name).csv"
repo$epoch(epoch_name = 'YABaOutlier', pre = 1, post = 2,
electrodes = 14, referenced = TRUE, data_type = "power")
repo$power
#> Dimension: 287 x 16 x 301 x 1
#> - Trial: 1, 2, 3, 4, 5, 6,...
#> - Frequency: 2, 12, 22, 32, 42...
#> - Time: -1, -0.99, -0.98,...
#> - Electrode: 14
} # }