NWBHDF5IO {ieegio} | R Documentation |
Creates a NWBHDF5IO
file container
Description
Class definition for 'PyNWB' container; use read_nwb
for construction function.
Active bindings
opened
Whether the container is opened.
Methods
Public methods
Method new()
Initialize the class
Usage
NWBHDF5IO$new(path = NULL, mode = c("r", "w", "r+", "a", "w-", "x"), ...)
Arguments
path
Path to a
'.nwb'
filemode
Mode for opening the file
...
Other parameters passed to
nwb$NWBHDF5IO
Method get_handler()
Get internal file handler. Please make sure you close the handler correctly.
Usage
NWBHDF5IO$get_handler()
Returns
File handler, i.e. 'PyNWB' NWBHDF5IO
instance.
Method open()
Open the connections, must be used together with $close
method.
For high-level method, see $with
Usage
NWBHDF5IO$open()
Returns
container itself
Examples
\dontrun{ # low-level method to open NWB file, for safer methods, see # `container$with()` below container$open() data <- container$read() # process data... # Make sure the container is closed! container$close() }
Method close()
Close the connections (low-level method, see 'with' method below)
Usage
NWBHDF5IO$close(close_links = TRUE)
Arguments
close_links
Whether to close all files linked to from this file; default is true
Returns
Nothing
Method close_linked_files()
Close all opened, linked-to files. 'MacOS'
and 'Linux'
automatically release the linked-to file after the linking file is
closed, but 'Windows'
does not, which prevents the linked-to
file from being deleted or truncated. Use this method to close all
opened, linked-to files.
Usage
NWBHDF5IO$close_linked_files()
Returns
Nothing
Method read()
Read the 'NWB'
file from the 'IO' source. Please use along with
'$with'
method
Usage
NWBHDF5IO$read()
Returns
'NWBFile'
container
Method with()
Safe wrapper for reading and handling 'NWB'
file. See class examples.
Usage
NWBHDF5IO$with(expr, quoted = FALSE, envir = parent.frame())
Arguments
expr
R expression to evaluate
quoted
Whether
expr
is quoted; default is falseenvir
environment for
expr
to evaluate; default is the parent frame (seeparent.frame
)
Returns
Whatever results generated by expr
Examples
\dontrun{ container$with({ data <- container$read() # process data }) }
Method clone()
The objects of this class are cloneable with this method.
Usage
NWBHDF5IO$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## Not run:
# Running this example requires a .nwb file
library(rnwb)
container <- NWBHDF5IO$new(path = file)
container$with({
data <- container$read()
electrode_table <- data$electrodes[convert = TRUE]
})
print(electrode_table)
## End(Not run)
## ------------------------------------------------
## Method `NWBHDF5IO$open`
## ------------------------------------------------
## Not run:
# low-level method to open NWB file, for safer methods, see
# `container$with()` below
container$open()
data <- container$read()
# process data...
# Make sure the container is closed!
container$close()
## End(Not run)
## ------------------------------------------------
## Method `NWBHDF5IO$with`
## ------------------------------------------------
## Not run:
container$with({
data <- container$read()
# process data
})
## End(Not run)