API Documentation

API reference for the module.

Table of Contents

File I/O

Functions for file I/O.

NWB & Custom file I/O

save_nwbfile(nwbfile, file_name[, folder])

Save out an NWB file.

load_nwbfile(file_name[, folder, return_io])

Load an NWB file.

save_config(cdict, file_name[, folder])

Save out a config file.

load_config(file_name[, folder])

Load an individual config file.

load_configs(files[, folder])

Load all configs together.

save_task_object(task, file_name[, folder])

Save a task object.

load_task_object(file_name[, folder])

Load a task object.

General file I/O

save_txt(text, file_name[, folder])

Save out text to a txt file.

load_txt(file_name[, folder])

Load text from a txt file.

save_json(data, file_name[, folder])

Save out a dictionary of data to a JSON file.

load_json(file_name[, folder])

Load from a JSON file.

save_jsonlines(data, file_name[, folder])

Save out data to a JSONlines file.

load_matfile(file_name[, folder])

Load a .mat file.

load_jsons_to_df(files[, folder])

Load a collection of JSON files into a dataframe.

open_h5file(file_name[, folder, ext])

Open a hdf5 file.

load_from_h5file(field, file_name[, folder, ext])

Load a specified field from a HDF5 file.

Objects

Custom objects.

Electrodes

Electrodes()

Object for collecting electrode information.

TaskBase

TaskBase()

Base object for collecting task information.

Paths

Path management.

Paths Object

Paths(project_path[, subject, experiment, ...])

Paths object for a session of single-unit data.

Directory Creators

make_folder(path)

Make a folder, if it does not already exist.

create_project_directory(base_path, project)

Create the folder structure for a project.

create_subject_directory(project_path, subject)

Create the folder structure for a subject.

create_session_directory(project_path, ...)

Create the folder structure for a session of data.

Plots

Plotting functions and utilities.

Timestamps

plot_alignment(sync1, sync2[, n_pulses, ax])

Plot the alignment between synchronization pulses.

plot_peaks(data, peak_inds, peak_heights[, ax])

Plot detected peaks on a time series.

Timestamps

Functions and helpers for managing timestamps and temporal alignment.

Alignment

fit_sync_alignment(sync_behav, sync_neural)

Fit a model to align synchronization pulses from different recording systems.

predict_times(times, intercept, coef)

Predict times alignment from model coefficients.

predict_times_model(times, model)

Predict times alignment from a model object.

match_pulses(sync_behav, sync_neural, n_pulses)

Match pulses to each other based on ISIs.

Peaks

detect_peaks(data, fs, height[, distance, ...])

Process peaks from a time series.

Update

offset_time(times, offset)

Apply an offset to timestamps.

change_time_units(times, value[, operation])

Change the units of timestamps.

Utils

Utilities & helper functions.

Check Functions

is_empty(var)

Check if a variable is empty, across possible types.

is_type(var, var_type)

Check is a variable is of the given type(s).

clean_strings(lst)

Helper function to clean a list of string values for adding to NWB.

Convert Functions

convert_str_to_bool(string)

Convert a string to a boolean.

convert_strlist_to_bool(lst)

Convert a list of strings to a list of boolean.

convert_type(variable, dtype)

Convert type of a given variable.

convert_to_array(data, dtype)

Convert to an array of specified data type.

convert_time_to_date(timestamp[, tz])

Convert a time value to a datetime date.

Extract Functions

get_event_time(event_times, start, end)

Select a (single) event based on time range, returning NaN if not found.

get_trial_value(trials, data, trial[, dtype])

Extract a value for a specified trial.

Log Functions

print_status(verbose, message[, level])

Print a status update.

Run Functions

catch_error(proceed, name, path[, verbose, ...])

Catch a raised error, with the option to save an error log and proceed.

Tool Functions

incrementer([start, end])

Generator that returns an incrementing index value.

get_current_date([tz])

Get the current datetime.

Validate Functions

validate_nwb(file_name[, folder, ...])

Validate a NWB file.