3. NWB APIs: PyNWB & MatNWB
The NWB team develops and supports APIs in Python (PyNWB) and MATLAB (MatNWB), which guide users in reading and writing NWB files. The features of these two APIs are very similar to each other, so choose whichever is more convenient. Note that most of the high-level conversion tools use PyNWB, but the APIs are interchangeable and there should be no problem with writing data using MatNWB even if you plan to read it using PyNWB later (or vice versa). Below is a table of the available tutorials illustrating the end-to-end conversion of common data types in each imaging modality:
PyNWB |
MatNWB |
|
---|---|---|
Reading NWB files |
||
Writing extracellular electrophysiology |
||
Writing intracellular electrophysiology |
||
Writing calcium imaging |
||
Advanced I/O |
These tutorials walk you through the most common data types of each of the modalities. With the tutorials for domain-specific conversion, extensions, advanced I/O, and the documentation for proprietary formats, you have all of the tools to create your own conversion. However, writing a full-fledged conversion script from the ground up with MatNWB and PyNWB is time-intensive, error-prone, and requires detailed knowledge of the source format. That is why, in the next section, we will introduce automated conversion tools that work on a large number of supported proprietary formats.