diff --git a/README.md b/README.md index f8470a3f..dd9e9cdd 100644 --- a/README.md +++ b/README.md @@ -1,196 +1,153 @@ -![MatNWB Logo](logo/logo_matnwb_small.png) - -[![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/basicUsage.mlx) -[![codecov](https://codecov.io/gh/NeurodataWithoutBorders/matnwb/branch/master/graph/badge.svg?token=apA7F24NsO)](https://codecov.io/gh/NeurodataWithoutBorders/matnwb) -[![Run tests](https://github.com/NeurodataWithoutBorders/matnwb/actions/workflows/run_tests.yml/badge.svg)](https://github.com/NeurodataWithoutBorders/matnwb/actions/workflows/run_tests.yml?query=event%3Apush+branch%3Amaster) -[![Codespell](https://github.com/NeurodataWithoutBorders/matnwb/actions/workflows/run_codespell.yml/badge.svg?branch=master)](https://github.com/NeurodataWithoutBorders/matnwb/actions/workflows/run_codespell.yml?query=event%3Apush+branch%3Amaster) - -MatNWB is a Matlab interface for reading and writing Neurodata Without Borders (NWB) 2.x files. - -## Setup - -### Step 1: Download MatNWB - -Download the current release of MatNWB from the [MatNWB releases page](https://github.com/NeurodataWithoutBorders/matnwb/releases) or from the [![View NeurodataWithoutBorders/matnwb on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/67741-neurodatawithoutborders-matnwb). You can also check out the latest development version via +
+ ⚙️ Installation • + 🚀 Getting Started • + 🎓 Tutorials • + 💡 Use Cases • + 🤝 Contributing • + 📄 Citing NWB +
+ + +## Installation +Download the current release of MatNWB from the [Releases page](https://github.com/NeurodataWithoutBorders/matnwb/releases) or from [![View NeurodataWithoutBorders/matnwb on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/67741-neurodatawithoutborders-matnwb). You can also check out the latest development version via ```bash git clone https://github.com/NeurodataWithoutBorders/matnwb.git ``` - -### Step 2a: Reading from a NWB File - -If you wish to read from a NWB file, you can do so using the `nwbRead` command: - +From MATLAB's command window, add MatNWB to the [search path](https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html). ```matlab -File = nwbRead('/path/to/file.nwb'); +addpath('path/to/matnwb'); ``` -The returned NwbFile object provides an in-memory view of the underlying NWB data. For more information, see the [NWB Overview Documentation](https://nwb-overview.readthedocs.io/en/latest/file_read/file_read.html#reading-with-matnwb) - -### Step 2b: Writing a NWB File - -From the MATLAB command line, add MatNWB to the path. The generated classes are normally placed in the `+types` subdirectory in the MatNWB installation directory. As MATLAB [packages](https://www.mathworks.com/help/matlab/matlab_oop/scoping-classes-with-packages.html), these generated classes comprise the building blocks you will need to write your NWB file. +## Getting Started +The MatNWB 📖 documentation can be found at https://matnwb.readthedocs.io. If you find MatNWB useful, please come back later and leave us a star ⭐ +### Reading from an NWB File +If you wish to read from an NWB file, you can do so using the `nwbRead` command: ```matlab -addpath('path/to/matnwb'); +nwbFile = nwbRead('/path/to/file.nwb'); ``` -Once you have configured your NWB File, you may write the `NwbFile` object to disk using the `nwbExport` function. +The returned NwbFile object provides an in-memory view of the underlying NWB data. For more information, see the [MatNWB Documentation](https://matnwb.readthedocs.io/en/latest/pages/getting_started/file_read.html#reading-with-matnwb) + +### Writing an NWB File +The building blocks of an NWB file are the neurodata types defined in the [NWB Format Specification](https://nwb-schema.readthedocs.io/en/latest/). In MatNWB, these types are autogenerated from the schema specifications and located as classes in the [`+types`](https://github.com/NeurodataWithoutBorders/matnwb/tree/master/%2Btypes) [namespace](https://www.mathworks.com/help/matlab/matlab_oop/scoping-classes-with-packages.html) of the MatNWB root directory. +To create an NWB file, you can create neurodata objects, add them to an NwbFile object and write to disk using the `nwbExport` function (detailed examples are provided in the tutorials): ```matlab -nwbExport(NwbFile, 'path/to/file.nwb'); +nwbExport(nwbFile, 'path/to/file.nwb'); ``` -### Extensions: Generate MatNWB Classes for Extensions - -The `generateExtension` command generates extension classes given a file path to the extension's namespace. This can be useful if you need to work with NWB Extension Schemas outside of Core. +### Generate MatNWB Classes for Extensions +The `generateExtension` command generates extension classes given a file path to an extension's namespace. This can be useful if you need to work with data types from [neurodata extensions](https://nwb-extensions.github.io). ```matlab -generateExtension('schema/core/nwb.namespace.yaml', '.../my_extensions1.namespace.yaml',...); +generateExtension('some/folder/my_extension1.namespace.yaml', ...); ``` ### Advanced: Generating Legacy MatNWB Classes - -The `generateCore` command can generate older versions of the nwb schema. +The `generateCore` command can generate classes for older versions of the nwb schema. ```matlab generateCore('2.1.0'); % generates classes for NWB schema version 2.1.0 ``` -Supported schema versions are provided in the MatNWB installation directory under `nwb-schema`. +Supported schema versions are provided in the MatNWB root directory under [`nwb-schema`](https://github.com/NeurodataWithoutBorders/matnwb/tree/master/nwb-schema). -## Tutorials -[Intro to MatNWB](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/intro.html) +## Tutorials +[Intro to MatNWB](https://matnwb.readthedocs.io/en/latest/pages/tutorials/intro.html) -[Basic File Reading](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/read_demo.html) | a demo showcase for basic visualization from a DANDI dataset. +[Basic File Reading](https://matnwb.readthedocs.io/en/latest/pages/tutorials/read_demo.html) | a demo showcase for basic visualization from a DANDI dataset. -[Extracellular Electrophysiology](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/ecephys.html) | +[Extracellular Electrophysiology](https://matnwb.readthedocs.io/en/latest/pages/tutorials/ecephys.html) | [▶️ in MATLAB Online](https://matlab.mathworks.com/open/github/v1?repo=NeurodataWithoutBorders/matnwb&file=tutorials/ecephys.mlx) | [YouTube walkthrough](https://www.youtube.com/watch?v=W8t4_quIl1k&ab_channel=NeurodataWithoutBorders) -[Calcium Imaging](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/ophys.html) | +[Calcium Imaging](https://matnwb.readthedocs.io/en/latest/pages/tutorials/ophys.html) | ▶️ in MATLAB Online | [YouTube walkthrough](https://www.youtube.com/watch?v=OBidHdocnTc&ab_channel=NeurodataWithoutBorders) -[Intracellular Electrophysiology](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/icephys.html) - -[Behavior](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/behavior.html) - -[Optogenetics](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/ogen.html) - -[Dynamic tables](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/dynamic_tables.html) - -[Images](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/images.html) +[Intracellular Electrophysiology](https://matnwb.readthedocs.io/en/latest/pages/tutorials/icephys.html) -[Advanced data write](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/dataPipe.html) | [YouTube walkthrough](https://www.youtube.com/watch?v=PIE_F4iVv98&ab_channel=NeurodataWithoutBorders) +[Behavior](https://matnwb.readthedocs.io/en/latest/pages/tutorials/behavior.html) -[Using Dynamically Loaded Filters](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/dynamically_loaded_filters.html) - -[Remote read](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/remote_read.html) - -[Scratch Space](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/scratch.html) - -## API Documentation - -For more information regarding the MatNWB API or any of the NWB Core types in MatNWB, visit the [MatNWB API Documentation pages](https://neurodatawithoutborders.github.io/matnwb/doc/index.html). - - -## Under the Hood +[Optogenetics](https://matnwb.readthedocs.io/en/latest/pages/tutorials/ogen.html) -NWB files are HDF5 files with data stored according to the Neurodata Without Borders (NWB) [schema](https://github.com/NeurodataWithoutBorders/nwb-schema/tree/dev/core). The schema is described in a set of YAML documents which defines the various types and their attributes. +[Dynamic tables](https://matnwb.readthedocs.io/en/latest/pages/tutorials/dynamic_tables.html) -Certain functions, like `generateCore` and `nwbRead`, automatically read these specifications and converts them to a MATLAB class file. These classes generally map directly to attributes and constraints of the types defined in the schema. +[Images](https://matnwb.readthedocs.io/en/latest/pages/tutorials/images.html) -## Sources +[Advanced data write](https://matnwb.readthedocs.io/en/latest/pages/tutorials/dataPipe.html) | [YouTube walkthrough](https://www.youtube.com/watch?v=PIE_F4iVv98&ab_channel=NeurodataWithoutBorders) -MatNWB is available online at https://github.com/NeurodataWithoutBorders/matnwb +[Using Dynamically Loaded Filters](https://matnwb.readthedocs.io/en/latest/pages/tutorials/dynamically_loaded_filters.html) -## Data Dimensions +[Remote read](https://matnwb.readthedocs.io/en/latest/pages/tutorials/remote_read.html) -NWB files use the HDF5 format to store data. There are two main differences between the way MATLAB and HDF5 represents dimensions. The first is that HDF5 is C-ordered, which means it stores data is a rows-first pattern, and the MATLAB is F-ordered, storing data in the reverse pattern, with the last dimension of the array stored consecutively. The result is that the data in HDF5 is effectively the transpose of the array in MATLAB. The second difference is that HDF5 can store 1-D arrays, but in MATLAB the lowest dimensionality of an array is 2-D. Due to differences in how MATLAB and HDF5 represent data, the dimensions of datasets are flipped when writing to/from file in MatNWB. This behavior differs depending on whether ```VectorData``` use ```DataPipe``` objects to contain the data. It's important to keep in mind the mappings below to make sure is written to and read from file as expected. +[Scratch Space](https://matnwb.readthedocs.io/en/latest/pages/tutorials/scratch.html) -[without DataPipes](https://neurodatawithoutborders.github.io/matnwb/tutorials/html/dimensionMapNoDataPipes.html) -**Writing to File** - -| Shape