Package 'rnwb'

Title: 'Neurodata' Without Borders in R
Description: Supports 'Neurodata' Without Borders ('NWB') format in R.
Authors: Zhengjia Wang [aut, cre]
Maintainer: Zhengjia Wang <[email protected]>
License: file LICENSE
Version: 0.0.0.9000
Built: 2024-06-29 02:13:15 UTC
Source: https://github.com/dipterix/rnwb

Help Index


Install 'NWB' via 'pynwb'

Description

Install 'NWB' via 'pynwb'

Usage

install_nwb(python_ver = "auto", verbose = TRUE)

Arguments

python_ver

'Python' version, see configure_conda; default is "auto", which is suggested

verbose

whether to print the installation messages

Value

This function returns nothing.


Get 'pynwb' module

Description

Get 'pynwb' module

Usage

nwb

load_nwb(force = FALSE, error_if_missing = TRUE)

Arguments

force

whether to force reloading pynwb module; default is false

error_if_missing

whether to raise errors when the module is unable to load; default is true.

Value

A 'Python' module if successfully loaded. If error_if_missing is set to false and module is unable to load, return NULL


Creates a NWBHDF5IO file container

Description

Creates a NWBHDF5IO file container

Creates a NWBHDF5IO file container

Value

Nothing

Nothing

'NWBFile' container

Whatever results generated by expr

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' file

mode

Mode for opening the file

...

Other parameters passed to nwb$NWBHDF5IO


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


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()

Method read()

Read the 'NWB' file from the 'IO' source. Please use along with '$with' method

Usage
NWBHDF5IO$read()

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 false

envir

environment for expr to evaluate; default is the parent frame (see parent.frame)

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)

Get 'Python' main process environment

Description

Get 'Python' main process environment

Usage

py

Format

An object of class NULL of length 0.

Value

The 'Python' main process as a module


Try to convert an object to an R object

Description

Try to convert an object to an R object

Usage

to_r(x, on_fail = c("ignore", "error", "warning"))

Arguments

x

input data, can be either an 'R' or 'Python' object

on_fail

what to do when the object is still a 'Python' object; default is to 'ignore', other choices are 'error' and 'warning'

Value

The converted R object