Tools for quickly generating `.nwb` files from non-standard Mindscope Neuropixels experiments.
Project description
np_nwb
Tools for quickly generating .nwb files from non-standard Mindscope Neuropixels experiments.
Generating an .nwb file will entail:
- inputting a path to a folder of raw data from a single experiment (
session_folder) - creating an instance of
pynwb.NWBFileand writing to disk (nwb_file) - passing
nwb_file+session_folder, to various modules that add nwb components - each module should:
- accept or load an instance of
pynwb.NWBFilefromnwb_file - recognize the type of experiment contained in
session_folder - process raw data in
session_folderaccordingly - append tables to the
pynwb.NWBFileinstance - optionally write to disk
- return the
pynwb.NWBFileinstance
- accept or load an instance of
Each module should therefore provide a function implementing the following append() interface:
import logging
import pathlib
import tempfile
from typing import Optional
import np_tools
import pynwb
logger = logging.getLogger(__name__)
def append(
session_folder: str | pathlib.Path,
nwb_file: str | pathlib.Path | pynwb.NWBFile,
output_file: Optional[str | pathlib.Path] = None,
) -> pynwb.NWBFile:
"""Append one or more new components to an `.nwb` file.
- callable from within a Python process, by accepting & returning instances of `pynwb.NWBFile`
- callable from the command line, in which case all three input arguments are required, with `nwb_file` specified as a path
"""
session_folder = pathlib.Path(session_folder)
# ... process session_folder
if not isinstance(nwb_file, pynwb.NWBFile):
nwb_file = np_tools.load_nwb(nwb_file)
# ... append new components to nwb_file
if output_file is not None:
np_tools.save_nwb(nwb_file, output_file)
return nwb_file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file np_nwb-0.1.2.tar.gz.
File metadata
- Download URL: np_nwb-0.1.2.tar.gz
- Upload date:
- Size: 36.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.7.4 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
336c85347d2723a6e0e919db626300725f0c07e87908704b4a1f0c31c9408417
|
|
| MD5 |
dfb4b5292aea016312aa79119786c231
|
|
| BLAKE2b-256 |
c4da645bde35b26a32d144ce6be7cb43ece6fe82be54c2c4477ffe26053cc523
|
File details
Details for the file np_nwb-0.1.2-py3-none-any.whl.
File metadata
- Download URL: np_nwb-0.1.2-py3-none-any.whl
- Upload date:
- Size: 45.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.7.4 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71e4f8a7ad395630fca63748fbd0c2be9720be045bf2867f24bf2d7e92743539
|
|
| MD5 |
ac6c16ed4606406ee0d83be3a4ab2009
|
|
| BLAKE2b-256 |
9f057b7c89f74492e9c3f58295e46b67532cd735521bbb90e6bb9e5c0e6a156c
|