Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed May 20, 2024
1 parent cfd1561 commit d1bc20f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ default_range: string
enums:
Experimenters:
permissible_values:
Oliver Rübel:
Bilbo Baggins:
description: He who must not be named.
meaning: ORC:0000-0001-9902-1984
Ryan Ly:
description: The chosen one.
meaning: ORC:0000-0001-9238-0642

meaning: ORC:111


13 changes: 13 additions & 0 deletions docs/gallery/general/nwb_gallery_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespaces:
core:
version: 2.7.0-alpha
data_types:
Subject:
species:
termset: nwb_subject_termset.yaml
NWBFile:
experimenter:
termset: experimenter_termset.yaml
# ElectrodeGroup: This will return when electrode table is redefined
# location:
# termset: location_termset.yaml
27 changes: 27 additions & 0 deletions docs/gallery/general/nwb_subject_termset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
id: termset/species_example
name: Species
version: 0.0.1
prefixes:
NCBI_TAXON: https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=
imports:
- linkml:types
default_range: string

enums:
Species:
permissible_values:
Homo sapiens:
description: the species is human
meaning: NCBI_TAXON:9606
Mus musculus:
description: the species is a house mouse
meaning: NCBI_TAXON:10090
Ursus arctos horribilis:
description: the species is a grizzly bear
meaning: NCBI_TAXON:116960
Myrmecophaga tridactyla:
description: the species is an anteater
meaning: NCBI_TAXON:71006
Ailuropoda melanoleuca:
description: the species is a panda
meaning: NCBI_TAXON:9646
24 changes: 16 additions & 8 deletions docs/gallery/general/plot_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
--------------------------------
Before taking advantage of the all the wonders that comes with using a configuration file,
the user needs to create one following some simple guidelines. To follow along with an example,
please refer to ``nwb_config.yaml`` under ``src/config``.
please refer to ``nwb_config.yaml`` under ``src/config``.
The configuration files is built on the foundation of the YAML syntax. The
user will construct a series of nested dictioanries to encompass all the necessary information.

Check failure on line 34 in docs/gallery/general/plot_configurator.py

View workflow job for this annotation

GitHub Actions / Check for spelling errors

dictioanries ==> dictionaries
Expand All @@ -44,7 +44,14 @@
import linkml_runtime # noqa: F401
except ImportError as e:
raise ImportError("Please install linkml-runtime to run this example: pip install linkml-runtime") from e
from hdmf.term_set import TermSet, TermSetWrapper

from dateutil import tz
from datetime import datetime
from uuid import uuid4
import os

from pynwb import NWBFile, get_loaded_type_config, load_type_config, unload_type_config
from pynwb.file import Subject

# How to use a Configuration file
# -------------------------------
Expand All @@ -53,12 +60,13 @@
# It is important to remember that with the configuration loaded, the fields
# are wrapped automatically, meaning the user should proceed with creating
# the instances normally, i.e., without wrapping directly. In this example,
# we load the the NWB curated configuration file that associates a
# :py:class:`~hdmf.term_set.TermSet` for the species field in Subject.
# The NWB configuration file is the default when you call
# :py:func:`~pynwb.load_type_config`.
# we load the a configuration file that associates a
# :py:class:`~hdmf.term_set.TermSet` for the ``species`` field in
# :py:class:`~pynwb.file.Subject`.

load_type_config()
dir_path = os.path.dirname(os.path.abspath(__file__))
yaml_file = os.path.join(dir_path, 'nwb_gallery_config.yaml')
load_type_config(config_path=yaml_file)

session_start_time = datetime(2018, 4, 25, hour=2, minute=30, second=3, tzinfo=tz.gettz("US/Pacific"))

Expand All @@ -68,7 +76,7 @@
session_start_time=session_start_time, # required
session_id="session_1234", # optional
experimenter=[
"Baggins, Bilbo",
"Bilbo Baggins",
], # optional
lab="Bag End Laboratory", # optional
institution="University of My Institution", # optional
Expand Down
16 changes: 0 additions & 16 deletions src/pynwb/config/location_termset.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions src/pynwb/config/nwb_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ namespaces:
Subject:
species:
termset: nwb_subject_termset.yaml
NWBFile:
experimenter:
termset: experimenter_termset.yaml
# ElectrodeGroup: This will return when electrode table is redefined
# location:
# termset: location_termset.yaml
5 changes: 2 additions & 3 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from hdmf.term_set import TermSetWrapper

from pynwb import NWBFile,get_loaded_type_config, load_type_config, unload_type_config
from pynwb import NWBFile, get_loaded_type_config, load_type_config, unload_type_config
from pynwb.file import Subject
from pynwb.testing import TestCase

Expand All @@ -28,8 +28,7 @@ def test_get_loaded_type_config(self):
config = get_loaded_type_config()
self.assertEqual(config,
{'namespaces': {'core': {'version': '2.7.0-alpha',
'data_types': {'Subject': {'species': {'termset': 'nwb_subject_termset.yaml'}},
'NWBFile': {'experimenter': {'termset': 'experimenter_termset.yaml'}}}}}})
'data_types': {'Subject': {'species': {'termset': 'nwb_subject_termset.yaml'}}}}}})

def test_default_config(self):
session_start_time = datetime(2018, 4, 25, 2, 30, 3, tzinfo=tz.gettz("US/Pacific"))
Expand Down

0 comments on commit d1bc20f

Please sign in to comment.