# ndx-pinto-metadata
The NWB extension for storing ViRMEN experimental metadata for the Pinto lab.
## Installation
```bash
pip install ndx_pinto_metadata
```
## Usage
```python
from uuid import uuid4
from datetime import datetime
from dateutil.tz import tzlocal
import numpy as np
from pynwb import NWBFile, NWBHDF5IO
from hdmf.common.table import DynamicTable
from ndx_pinto_metadata import LabMetaDataExtension, MazeExtension
# Create NWBFile
nwbfile = NWBFile(
session_description="session_description",
identifier=str(uuid4()),
session_start_time=datetime(1970, 1, 1, tzinfo=tzlocal()),
)
# Add MazeExtension
maze_extension = MazeExtension(name="mazes", description="Holds information about the mazes for this task.")
# Add row for each maze
maze_extension.add_row(
antiFraction=0,
cueDensityPerM=3,
cueDuration=np.nan,
cueProbability=np.inf,
cueVisibleAt=10,
hideHintUntil=-15,
lContext=10,
lCue=45,
lMemory=10,
lStart=5,
maxTrialDuration=180,
turnHint=1,
numTrials=80,
numTrialsPerMin=2,
criteriaNTrials=100,
numSessions=1,
performance=np.inf,
maxBias=0.2,
easyBlock=np.nan,
easyBlockNTrials=10,
numBlockTrials=40,
blockPerform=0.55,
geoDistP=np.nan,
geoDistPEasy=np.nan,
)
# Create table for storing stimulus protocol parameters
stimulus_protocol = DynamicTable(name="stimulus_protocol", description="Holds information about the stimulus protocol.")
protocol_dict = dict(
stimulus_code="TowersTaskSwitchStimulusTrain",
numMazesInProtocol=11,
trialDraw="EradeCapped",
stimDraw="LeftOneOnly",
cueMinSeparation=12,
totalRepeatProbability=0.05,
numRepeatTrials=2,
visualcolor=np.array([0, 0, 1]),
memorycolor=np.array([0.5, 0.5, 0.]),
princetonImplementation=1,
)
for protocol_name in protocol_dict:
stimulus_protocol.add_column(
name=protocol_name,
description="stimulus protocol parameter.",
)
stimulus_protocol.add_row(**protocol_dict)
# Create LabMetaData
lab_meta_data = LabMetaDataExtension(
name="LabMetaData",
experiment_name="TowersTaskSwitchEasy",
experiment_code="TowersTaskSwitchEasy",
session_index=49,
total_reward=0.925,
surface_quality=74.22,
rig="VR_Widefield",
num_trials=242,
num_iterations=430233,
session_duration=3838.5730088,
advance=0,
mazes=maze_extension,
stimulus_protocol=stimulus_protocol,
)
# Add to NWBFile
nwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)
# Write LabMetaData to NWB file
nwbfile_path = "virmen_metadata.nwb"
with NWBHDF5IO(nwbfile_path, mode="w") as io:
io.write(nwbfile)
# Check LabMetaData was added to the NWB file
with NWBHDF5IO(nwbfile_path, mode="r", load_namespaces=True) as io:
read_nwbfile = io.read()
read_nwbfile_lab_metadata = read_nwbfile.lab_meta_data["LabMetaData"]
```
---
This extension was created using [ndx-template](https://github.com/nwb-extensions/ndx-template).
Raw data
{
"_id": null,
"home_page": "",
"name": "ndx-pinto-metadata",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "NeurodataWithoutBorders,NWB,nwb-extension,ndx-extension",
"author": "Szonja Weigl",
"author_email": "szonja.weigl@catalystneuro.com",
"download_url": "https://files.pythonhosted.org/packages/77/d2/ae04d92271a1faaaa21010c0268247a0e369f6f8019550013967599e60ab/ndx-pinto-metadata-0.1.2.tar.gz",
"platform": null,
"description": "# ndx-pinto-metadata\n\nThe NWB extension for storing ViRMEN experimental metadata for the Pinto lab.\n\n## Installation\n\n```bash\npip install ndx_pinto_metadata\n```\n\n## Usage\n\n```python\nfrom uuid import uuid4\nfrom datetime import datetime\nfrom dateutil.tz import tzlocal\nimport numpy as np\n\nfrom pynwb import NWBFile, NWBHDF5IO\nfrom hdmf.common.table import DynamicTable\n\nfrom ndx_pinto_metadata import LabMetaDataExtension, MazeExtension\n\n# Create NWBFile\nnwbfile = NWBFile(\n session_description=\"session_description\",\n identifier=str(uuid4()),\n session_start_time=datetime(1970, 1, 1, tzinfo=tzlocal()),\n )\n\n\n# Add MazeExtension\nmaze_extension = MazeExtension(name=\"mazes\", description=\"Holds information about the mazes for this task.\")\n# Add row for each maze\nmaze_extension.add_row(\n antiFraction=0,\n cueDensityPerM=3,\n cueDuration=np.nan,\n cueProbability=np.inf,\n cueVisibleAt=10,\n hideHintUntil=-15,\n lContext=10,\n lCue=45,\n lMemory=10,\n lStart=5,\n maxTrialDuration=180,\n turnHint=1,\n numTrials=80,\n numTrialsPerMin=2,\n criteriaNTrials=100,\n numSessions=1,\n performance=np.inf,\n maxBias=0.2,\n easyBlock=np.nan,\n easyBlockNTrials=10,\n numBlockTrials=40,\n blockPerform=0.55,\n geoDistP=np.nan,\n geoDistPEasy=np.nan,\n)\n\n# Create table for storing stimulus protocol parameters\nstimulus_protocol = DynamicTable(name=\"stimulus_protocol\", description=\"Holds information about the stimulus protocol.\")\n\nprotocol_dict = dict(\n stimulus_code=\"TowersTaskSwitchStimulusTrain\",\n numMazesInProtocol=11,\n trialDraw=\"EradeCapped\",\n stimDraw=\"LeftOneOnly\",\n cueMinSeparation=12,\n totalRepeatProbability=0.05,\n numRepeatTrials=2,\n visualcolor=np.array([0, 0, 1]),\n memorycolor=np.array([0.5, 0.5, 0.]),\n princetonImplementation=1, \n)\nfor protocol_name in protocol_dict:\n stimulus_protocol.add_column(\n name=protocol_name,\n description=\"stimulus protocol parameter.\",\n )\nstimulus_protocol.add_row(**protocol_dict)\n\n# Create LabMetaData\nlab_meta_data = LabMetaDataExtension(\n name=\"LabMetaData\",\n experiment_name=\"TowersTaskSwitchEasy\",\n experiment_code=\"TowersTaskSwitchEasy\",\n session_index=49,\n total_reward=0.925,\n surface_quality=74.22,\n rig=\"VR_Widefield\",\n num_trials=242,\n num_iterations=430233,\n session_duration=3838.5730088,\n advance=0,\n mazes=maze_extension,\n stimulus_protocol=stimulus_protocol,\n)\n\n# Add to NWBFile\nnwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)\n\n# Write LabMetaData to NWB file\nnwbfile_path = \"virmen_metadata.nwb\"\nwith NWBHDF5IO(nwbfile_path, mode=\"w\") as io:\n io.write(nwbfile)\n \n# Check LabMetaData was added to the NWB file\nwith NWBHDF5IO(nwbfile_path, mode=\"r\", load_namespaces=True) as io:\n read_nwbfile = io.read()\n read_nwbfile_lab_metadata = read_nwbfile.lab_meta_data[\"LabMetaData\"]\n\n```\n\n---\nThis extension was created using [ndx-template](https://github.com/nwb-extensions/ndx-template).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The NWB extension for storing ViRMEN experimental metadata for the Pinto lab.",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [
"neurodatawithoutborders",
"nwb",
"nwb-extension",
"ndx-extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f05c9cc5b82958da37f51faf966a97936f31e64931bed3b92d4ccc61bdb3b3dc",
"md5": "1545bcf83067bf8934557f6dec35be3a",
"sha256": "10a79ccf402b18decc030cb3d1c77c48adb78f2c5697030ee4aa05d526f9b867"
},
"downloads": -1,
"filename": "ndx_pinto_metadata-0.1.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "1545bcf83067bf8934557f6dec35be3a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 5915,
"upload_time": "2023-12-02T10:27:28",
"upload_time_iso_8601": "2023-12-02T10:27:28.561133Z",
"url": "https://files.pythonhosted.org/packages/f0/5c/9cc5b82958da37f51faf966a97936f31e64931bed3b92d4ccc61bdb3b3dc/ndx_pinto_metadata-0.1.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77d2ae04d92271a1faaaa21010c0268247a0e369f6f8019550013967599e60ab",
"md5": "8849a2a6dd12b40411e0eed5032b5027",
"sha256": "9df7aacc0f53ef3659eba897b26d90ac341fb52b643bd66ce95eed13e4cbe14b"
},
"downloads": -1,
"filename": "ndx-pinto-metadata-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "8849a2a6dd12b40411e0eed5032b5027",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14275,
"upload_time": "2023-12-02T10:27:30",
"upload_time_iso_8601": "2023-12-02T10:27:30.587655Z",
"url": "https://files.pythonhosted.org/packages/77/d2/ae04d92271a1faaaa21010c0268247a0e369f6f8019550013967599e60ab/ndx-pinto-metadata-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-02 10:27:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "ndx-pinto-metadata"
}