diff --git a/docs/notes/todo.md b/docs/notes/todo.md new file mode 100644 index 0000000..fad2cf1 --- /dev/null +++ b/docs/notes/todo.md @@ -0,0 +1,5 @@ +# TODO + +Stuff to keep track of that might have been manually overrided that needs to be fixed pre-release + +- Coerce all listlike things into lists if they are passed as single elements! \ No newline at end of file diff --git a/hdf5_linkml/README.md b/hdf5_linkml/README.md new file mode 100644 index 0000000..6225f9f --- /dev/null +++ b/hdf5_linkml/README.md @@ -0,0 +1,3 @@ +# hdf5_linkml + +HDF5 adapter to linkml models \ No newline at end of file diff --git a/hdf5_linkml/src/hdf5_linkml/io.py b/hdf5_linkml/src/hdf5_linkml/io.py index 4e307b8..901d9e7 100644 --- a/hdf5_linkml/src/hdf5_linkml/io.py +++ b/hdf5_linkml/src/hdf5_linkml/io.py @@ -19,7 +19,7 @@ class H5File: """ pass - def translate_schema(self, dict) -> SchemaDefinition: + def translate_schema(self, schema: List[dict]) -> List[SchemaDefinition]: """ Optionally translate schema from source language into LinkML diff --git a/nwb_linkml/adapters/classes.py b/nwb_linkml/adapters/classes.py index 5eb89cc..64d2615 100644 --- a/nwb_linkml/adapters/classes.py +++ b/nwb_linkml/adapters/classes.py @@ -130,13 +130,13 @@ class ClassAdapter(Adapter): # return self._get_full_name() name = None if self.cls.neurodata_type_def: - #name = camel_to_snake(self.cls.neurodata_type_def) + # name = camel_to_snake(self.cls.neurodata_type_def) name = self.cls.neurodata_type_def elif self.cls.name is not None: # we do have a unique name name = self.cls.name elif self.cls.neurodata_type_inc: - #name = camel_to_snake(self.cls.neurodata_type_inc) + # name = camel_to_snake(self.cls.neurodata_type_inc) name = self.cls.neurodata_type_inc if name is None: @@ -144,6 +144,29 @@ class ClassAdapter(Adapter): return name + def _get_slot_name(self) -> str: + """ + Get the name to use as the name when this is a subclass used as a slot, + used to dodge name overlaps by snake-casing! + again distinct from the actual name of the instantiated object + """ + # return self._get_full_name() + name = None + if self.cls.neurodata_type_def: + name = camel_to_snake(self.cls.neurodata_type_def) + # name = self.cls.neurodata_type_def + elif self.cls.name is not None: + # we do have a unique name + name = self.cls.name + elif self.cls.neurodata_type_inc: + name = camel_to_snake(self.cls.neurodata_type_inc) + # name = self.cls.neurodata_type_inc + + if name is None: + raise ValueError(f'Class has no name!: {self.cls}') + + return name + def handle_dtype(self, dtype: DTypeType | None) -> str: if isinstance(dtype, ReferenceDtype): return dtype.target_type @@ -198,7 +221,7 @@ class ClassAdapter(Adapter): If we are a child class, we make a slot so our parent can refer to us """ return SlotDefinition( - name=self._get_attr_name(), + name=self._get_slot_name(), description=self.cls.doc, range=self._get_full_name(), **QUANTITY_MAP[self.cls.quantity] diff --git a/nwb_linkml/adapters/dataset.py b/nwb_linkml/adapters/dataset.py index b7ccf6f..f3a5268 100644 --- a/nwb_linkml/adapters/dataset.py +++ b/nwb_linkml/adapters/dataset.py @@ -1,13 +1,15 @@ """ Adapter for NWB datasets to linkml Classes """ +import pdb from typing import Optional, List +import warnings from linkml_runtime.linkml_model import ClassDefinition, SlotDefinition from pydantic import PrivateAttr from nwb_schema_language import Dataset, ReferenceDtype, CompoundDtype, DTypeType -from nwb_linkml.adapters.classes import ClassAdapter +from nwb_linkml.adapters.classes import ClassAdapter, camel_to_snake from nwb_linkml.adapters.adapter import BuildResult from nwb_linkml.maps import QUANTITY_MAP @@ -21,11 +23,13 @@ class DatasetAdapter(ClassAdapter): def build(self) -> BuildResult: res = self.build_base() + res = self.drop_dynamic_table(res) res = self.handle_arraylike(res, self.cls, self._get_full_name()) res = self.handle_1d_vector(res) res = self.handle_listlike(res) res = self.handle_scalar(res) + if len(self._handlers) > 1: raise RuntimeError(f"Only one handler should have been triggered, instead triggered {self._handlers}") @@ -171,7 +175,8 @@ class DatasetAdapter(ClassAdapter): return res elif not all((dataset.dims, dataset.shape)): # need to have both if one is present! - raise ValueError(f"A dataset needs both dims and shape to define an arraylike object") + warnings.warn(f"A dataset needs both dims and shape to define an arraylike object. This is allowed for compatibility with some badly formatted NWB files, but should in general be avoided. Treating like we dont have an array") + return res # Special cases if dataset.neurodata_type_inc == 'VectorData': @@ -193,6 +198,9 @@ class DatasetAdapter(ClassAdapter): if isinstance(inner_dim, list): # list of lists dims_shape.extend([(dim, shape) for dim, shape in zip(inner_dim, inner_shape)]) + elif isinstance(inner_shape, list): + # Some badly formatted schema will have the shape be a LoL but the dims won't be... + dims_shape.extend([(inner_dim, shape) for shape in inner_shape]) else: # single-layer list dims_shape.append((inner_dim, inner_shape)) @@ -239,7 +247,7 @@ class DatasetAdapter(ClassAdapter): range=dtype )) - # and then the class is just a subclass of `Arraylike` (which is imported by default from `nwb.language.yaml`) + # and then the class is just a subclass of `Arraylist` (which is imported by default from `nwb.language.yaml`) if name: pass elif dataset.neurodata_type_def: @@ -268,3 +276,46 @@ class DatasetAdapter(ClassAdapter): self._handlers.append('arraylike') return res + + def drop_dynamic_table(self, res:BuildResult) -> BuildResult: + """ + DynamicTables in hdmf are so special-cased that we have to just special-case them ourselves. + + Typically they include a '*' quantitied, unnamed VectorData object to contain arbitrary columns, + this would normally get converted to its own container class, but since they're unnamed they conflict with + names in the containing scope. + + We just convert them into multivalued slots and don't use them + """ + if self.cls.name is None and \ + self.cls.neurodata_type_def is None and \ + self.cls.neurodata_type_inc in ('VectorIndex', 'VectorData') and \ + self.cls.quantity == '*': + self._handlers.append('dynamic_table') + this_slot = SlotDefinition( + name=camel_to_snake(self.cls.neurodata_type_inc), + description=self.cls.doc, + range=self.cls.neurodata_type_inc, + required=False, + multivalued=True + ) + # No need to make a class for us, so we replace the existing build results + res = BuildResult(slots=[this_slot]) + return res + elif self.cls.name is None and \ + self.cls.neurodata_type_def is None and \ + self.cls.neurodata_type_inc and \ + self.cls.quantity in ('*', '+'): + self._handlers.append('generic_container') + this_slot = SlotDefinition( + name=camel_to_snake(self.cls.neurodata_type_inc), + description=self.cls.doc, + range=self.cls.neurodata_type_inc, + **QUANTITY_MAP[self.cls.quantity] + ) + # No need to make a class for us, so we replace the existing build results + res = BuildResult(slots=[this_slot]) + return res + else: + return res + diff --git a/nwb_linkml/adapters/group.py b/nwb_linkml/adapters/group.py index 11dde34..dcab2ff 100644 --- a/nwb_linkml/adapters/group.py +++ b/nwb_linkml/adapters/group.py @@ -15,7 +15,8 @@ class GroupAdapter(ClassAdapter): cls: Group def build(self) -> BuildResult: - + if self.cls.neurodata_type_def == "Subject": + pdb.set_trace() # Handle container groups with only * quantity unnamed groups if len(self.cls.groups) > 0 and \ all([self._check_if_container(g) for g in self.cls.groups]) and \ @@ -24,6 +25,7 @@ class GroupAdapter(ClassAdapter): # handle if we are a terminal container group without making a new class if len(self.cls.groups) == 0 and \ + len(self.cls.datasets) == 0 and \ self.cls.neurodata_type_inc is not None and \ self.parent is not None: return self.handle_container_slot(self.cls) @@ -160,7 +162,7 @@ class GroupAdapter(ClassAdapter): quantity: '*' """ if not group.name and \ - group.quantity == '*' and \ + group.quantity in ('*','+') and \ group.neurodata_type_inc: return True else: diff --git a/nwb_linkml/adapters/namespaces.py b/nwb_linkml/adapters/namespaces.py index 9ab7af3..b5a4b23 100644 --- a/nwb_linkml/adapters/namespaces.py +++ b/nwb_linkml/adapters/namespaces.py @@ -6,9 +6,12 @@ for extracting information and generating translated schema """ import pdb from typing import List, Optional +from pathlib import Path from pydantic import BaseModel, Field, validator, PrivateAttr from pprint import pformat from linkml_runtime.linkml_model import SchemaDefinition +from linkml_runtime.dumpers import yaml_dumper + from nwb_schema_language import Namespaces @@ -47,13 +50,15 @@ class NamespacesAdapter(Adapter): # now generate the top-level namespaces that import everything for ns in self.namespaces.namespaces: - ns_schemas = [sch for sch in self.schemas if sch.namespace == ns.name] + ns_schemas = [sch.name for sch in self.schemas if sch.namespace == ns.name] + # also add imports bc, well, we need them + ns_schemas.extend([ns.name for imported in self.imported for ns in imported.namespaces.namespaces]) ns_schema = SchemaDefinition( name = ns.name, id = ns.name, description = ns.doc, version = ns.version, - imports=[sch.name for sch in ns_schemas], + imports=ns_schemas, annotations=[{'tag': 'namespace', 'value': True}] ) sch_result.schemas.append(ns_schema) @@ -91,7 +96,7 @@ class NamespacesAdapter(Adapter): # find which namespace imports this schema file for ns in self.namespaces.namespaces: sources = [sch.source for sch in ns.schema_] - if sch_name in sources: + if sch_name in sources or sch.path.stem in sources: sch.namespace = ns.name break @@ -148,4 +153,14 @@ class NamespacesAdapter(Adapter): self._imports_populated = True + def to_yaml(self, base_dir:Path): + schemas = self.build().schemas + base_dir = Path(base_dir) + + base_dir.mkdir(exist_ok=True) + + for schema in schemas: + output_file = base_dir / (schema.name + '.yaml') + yaml_dumper.dump(schema, output_file) + diff --git a/nwb_linkml/adapters/schema.py b/nwb_linkml/adapters/schema.py index 2d05a9b..277faba 100644 --- a/nwb_linkml/adapters/schema.py +++ b/nwb_linkml/adapters/schema.py @@ -37,7 +37,7 @@ class SchemaAdapter(Adapter): split: bool = Field( False, description="Split anonymous subclasses into a separate schema file" - ) + ) _created_classes: List[Type[Group | Dataset]] = PrivateAttr(default_factory=list) @property diff --git a/nwb_linkml/generators/pydantic.py b/nwb_linkml/generators/pydantic.py index 6dbe3c1..5ab9365 100644 --- a/nwb_linkml/generators/pydantic.py +++ b/nwb_linkml/generators/pydantic.py @@ -17,7 +17,11 @@ The `serialize` method """ import pdb +from dataclasses import dataclass +from pathlib import Path from typing import List, Dict, Set, Tuple, Optional +import os, sys +from types import ModuleType from copy import deepcopy import warnings @@ -34,6 +38,7 @@ ElementName ) from linkml_runtime.utils.formatutils import camelcase, underscore from linkml_runtime.utils.schemaview import SchemaView +from linkml_runtime.utils.compile_python import file_text from jinja2 import Template @@ -128,12 +133,13 @@ class {{ c.name }} \"\"\" {%- endif %} {% for attr in c.attributes.values() if c.attributes -%} - {{attr.name}}: {{ attr.annotations['python_range'].value }} = Field( + {{attr.name}}: {%- if attr.equals_string -%} + Literal[{{ predefined_slot_values[c.name][attr.name] }}] + {%- else -%} + {{ attr.annotations['python_range'].value }} + {%- endif -%} = Field( {%- if predefined_slot_values[c.name][attr.name] -%} {{ predefined_slot_values[c.name][attr.name] }} - {%- if attr.equals_string -%} - , const=True - {%- endif -%} {%- elif attr.required -%} ... {%- else -%} @@ -169,10 +175,15 @@ class {{ c.name }} return template - +@dataclass class NWBPydanticGenerator(PydanticGenerator): SKIP_ENUM=('FlatDType',) + # SKIP_SLOTS=('VectorData',) + SKIP_SLOTS=('',) + SKIP_CLASSES=('',) + # SKIP_CLASSES=('VectorData','VectorIndex') + split:bool=True def _locate_imports( self, @@ -229,6 +240,8 @@ class NWBPydanticGenerator(PydanticGenerator): needed_classes.append(cls.is_a) # get needed classes used as ranges in class attributes for slot_name in sv.class_slots(cls.name): + if slot_name in self.SKIP_SLOTS: + continue slot = deepcopy(sv.induced_slot(slot_name, cls.name)) if slot.range in all_classes: needed_classes.append(slot.range) @@ -316,7 +329,7 @@ class NWBPydanticGenerator(PydanticGenerator): else: shape_part = "*" # do this cheaply instead of using regex because i want to see if this works at all first... - name_part = attr.name.replace(',', '_').replace(' ', '_').replace('__', '_') + name_part = attr.name.replace(',', '_').replace(' ', '_').replace('__', '_').replace('|','_') dim_pieces.append(' '.join([shape_part, name_part])) @@ -371,6 +384,7 @@ class NWBPydanticGenerator(PydanticGenerator): Modified from original to allow for imported classes """ clist = list(clist) + clist = [c for c in clist if c.name not in self.SKIP_CLASSES] slist = [] # sorted while len(clist) > 0: can_add = False @@ -454,13 +468,24 @@ class NWBPydanticGenerator(PydanticGenerator): # filter skipped enums enums = {k:v for k,v in enums.items() if k not in self.SKIP_ENUM} - # import from local references, rather than serializing every class in every file - if 'namespace' in schema.annotations.keys() and schema.annotations['namespace']['value'] == 'True': - imports = self._get_namespace_imports(sv) - else: - imports = self._get_imports(sv) + if self.split: + # import from local references, rather than serializing every class in every file + if 'namespace' in schema.annotations.keys() and schema.annotations['namespace']['value'] == 'True': + imports = self._get_namespace_imports(sv) + else: + imports = self._get_imports(sv) + + sorted_classes = self._get_classes(sv, imports) + else: + sorted_classes = self.sort_classes(list(sv.all_classes().values()), []) + imports = {} + + # Don't want to generate classes when class_uri is linkml:Any, will + # just swap in typing.Any instead down below + sorted_classes = [c for c in sorted_classes if c.class_uri != "linkml:Any"] + self.sorted_class_names = [camelcase(c.name) for c in sorted_classes] + - sorted_classes = self._get_classes(sv, imports) for class_original in sorted_classes: # Generate class definition @@ -479,6 +504,8 @@ class NWBPydanticGenerator(PydanticGenerator): class_name = class_original.name for sn in sv.class_slots(class_name): + if sn in self.SKIP_SLOTS: + continue # TODO: fix runtime, copy should not be necessary s = deepcopy(sv.induced_slot(sn, class_name)) # logging.error(f'Induced slot {class_name}.{sn} == {s.name} {s.range}') @@ -536,4 +563,54 @@ class NWBPydanticGenerator(PydanticGenerator): version=self.schema.version, class_isa_plus_mixins=self.get_class_isa_plus_mixins(sorted_classes), ) - return code \ No newline at end of file + return code + + def compile_module(self, module_path:Path=None, **kwargs) -> ModuleType: + """ + Compiles generated python code to a module + :return: + """ + pycode = self.serialize(**kwargs) + if module_path is not None: + module_path = Path(module_path) + init_file = module_path / '__init__.py' + with open(init_file, 'w') as ifile: + ifile.write(' ') + + try: + return compile_python(pycode, module_path) + except NameError as e: + raise e + +def compile_python(text_or_fn: str, package_path: Path = None) -> ModuleType: + """ + Compile the text or file and return the resulting module + @param text_or_fn: Python text or file name that references python file + @param package_path: Root package path. If omitted and we've got a python file, the package is the containing + directory + @return: Compiled module + """ + python_txt = file_text(text_or_fn) + if package_path is None and python_txt != text_or_fn: + package_path = Path(text_or_fn) + spec = compile(python_txt, '', 'exec') + module = ModuleType('test') + # if package_path: + # if package_path.is_absolute(): + # module.__package__ = str(package_path) + # else: + # package_path_abs = os.path.join(os.getcwd(), package_path) + # # We have to calculate the path to expected path relative to the current working directory + # for path in sys.path: + # if package_path.startswith(path): + # path_from_tests_parent = os.path.relpath(package_path, path) + # break + # if package_path_abs.startswith(path): + # path_from_tests_parent = os.path.relpath(package_path_abs, path) + # break + # else: + # path_from_tests_parent = os.path.relpath(package_path, os.path.join(os.getcwd(), '..')) + # module.__package__ = os.path.dirname(os.path.relpath(path_from_tests_parent, os.getcwd())).replace(os.path.sep, '.') + # sys.modules[module.__name__] = module + exec(spec, module.__dict__) + return module diff --git a/nwb_linkml/io.py b/nwb_linkml/io.py index 65e2203..c149853 100644 --- a/nwb_linkml/io.py +++ b/nwb_linkml/io.py @@ -1,8 +1,9 @@ """ Loading/saving NWB Schema yaml files """ +import pdb from pathlib import Path -from typing import TypedDict, List, Dict +from typing import TypedDict, List, Dict, Optional from pprint import pprint import warnings @@ -39,8 +40,11 @@ def load_namespaces(path:Path|NamespaceRepo) -> Namespaces: -def load_schema_file(path:Path) -> SchemaAdapter: - source = load_yaml(path) +def load_schema_file(path:Path, yaml:Optional[dict] = None) -> SchemaAdapter: + if yaml is not None: + source = yaml + else: + source = load_yaml(path) datasets = [] @@ -125,3 +129,4 @@ def load_nwb_core() -> NamespacesAdapter: + diff --git a/nwb_linkml/map.py b/nwb_linkml/map.py index f901a66..244be5e 100644 --- a/nwb_linkml/map.py +++ b/nwb_linkml/map.py @@ -65,3 +65,9 @@ class KeyMap(Map): return out +def apply_preload(ns_dict) -> dict: + from nwb_linkml.maps import preload + maps = [m for m in Map.instances if m.phase == PHASES.postload] + for amap in maps: + ns_dict = amap.apply(ns_dict) + return ns_dict \ No newline at end of file diff --git a/nwb_linkml/models/core.py b/nwb_linkml/models/core.py index d17657b..b802a40 100644 --- a/nwb_linkml/models/core.py +++ b/nwb_linkml/models/core.py @@ -11,6 +11,132 @@ else: from typing_extensions import Literal +from .core_nwb_retinotopy import ( + ImagingRetinotopy +) + +from .core_nwb_base import ( + NWBData, + TimeSeriesReferenceVectorData, + Image, + ImageReferences, + NWBContainer, + NWBDataInterface, + TimeSeries, + ProcessingModule, + Images +) + +from .hdmf_common_table import ( + VectorData, + VectorIndex, + ElementIdentifiers, + DynamicTableRegion, + DynamicTable, + AlignedDynamicTable +) + +from .hdmf_common_base import ( + Data, + Container, + SimpleMultiContainer +) + +from .core_nwb_ophys import ( + OnePhotonSeries, + TwoPhotonSeries, + RoiResponseSeries, + DfOverF, + Fluorescence, + ImageSegmentation, + PlaneSegmentation, + ImagingPlane, + OpticalChannel, + MotionCorrection, + CorrectedImageStack +) + +from .core_nwb_device import ( + Device +) + +from .core_nwb_image import ( + GrayscaleImage, + RGBImage, + RGBAImage, + ImageSeries, + ImageMaskSeries, + OpticalSeries, + IndexSeries +) + +from .core_nwb_ogen import ( + OptogeneticSeries, + OptogeneticStimulusSite +) + +from .core_nwb_icephys import ( + PatchClampSeries, + CurrentClampSeries, + IZeroClampSeries, + CurrentClampStimulusSeries, + VoltageClampSeries, + VoltageClampStimulusSeries, + IntracellularElectrode, + SweepTable, + IntracellularElectrodesTable, + IntracellularStimuliTable, + IntracellularResponsesTable, + IntracellularRecordingsTable, + SimultaneousRecordingsTable, + SequentialRecordingsTable, + RepetitionsTable, + ExperimentalConditionsTable +) + +from .core_nwb_ecephys import ( + ElectricalSeries, + SpikeEventSeries, + FeatureExtraction, + EventDetection, + EventWaveform, + FilteredEphys, + LFP, + ElectrodeGroup, + ClusterWaveforms, + Clustering +) + +from .core_nwb_behavior import ( + SpatialSeries, + BehavioralEpochs, + BehavioralEvents, + BehavioralTimeSeries, + PupilTracking, + EyeTracking, + CompassDirection, + Position +) + +from .core_nwb_misc import ( + AbstractFeatureSeries, + AnnotationSeries, + IntervalSeries, + DecompositionSeries, + Units +) + +from .core_nwb_file import ( + ScratchData, + NWBFile, + LabMetaData, + Subject +) + +from .core_nwb_epoch import ( + TimeIntervals +) + metamodel_version = "None" version = "2.6.0-alpha" diff --git a/nwb_linkml/models/core_nwb_base.py b/nwb_linkml/models/core_nwb_base.py index 8ba36a9..a16b3f0 100644 --- a/nwb_linkml/models/core_nwb_base.py +++ b/nwb_linkml/models/core_nwb_base.py @@ -11,23 +11,14 @@ else: from typing_extensions import Literal -from .hdmf_common_table import ( - DynamicTable, - VectorData -) - from .hdmf_common_base import ( Data, Container ) -from .core_nwb_base_include import ( - TimeSeriesStartingTime, - ImageArray, - ImageReferencesArray, - TimeSeriesSync, - ImagesOrderOfImages, - TimeSeriesData +from .hdmf_common_table import ( + DynamicTable, + VectorData ) @@ -47,92 +38,135 @@ class NWBData(Data): """ An abstract data type for a dataset. """ - name: str = Field(...) + name:str= Field(...) class TimeSeriesReferenceVectorData(VectorData): """ Column storing references to a TimeSeries (rows). For each TimeSeries this VectorData column stores the start_index and count to indicate the range in time to be selected as well as an object reference to the TimeSeries. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ NDArray[Shape["* dim0"], Any], NDArray[Shape["* dim0, * dim1"], Any], NDArray[Shape["* dim0, * dim1, * dim2"], Any], NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) + ]]= Field(None) class Image(NWBData): """ An abstract data type for an image. Shape can be 2-D (x, y), or 3-D where the third dimension can have three or four elements, e.g. (x, y, (r, g, b)) or (x, y, (r, g, b, a)). """ - name: str = Field(...) - resolution: Optional[float] = Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") - description: Optional[str] = Field(None, description="""Description of the image.""") - array: Optional[Union[ + name:str= Field(...) + resolution:Optional[float]= Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") + description:Optional[str]= Field(None, description="""Description of the image.""") + array:Optional[Union[ NDArray[Shape["* x, * y"], Number], NDArray[Shape["* x, * y, 3 r_g_b"], Number], NDArray[Shape["* x, * y, 3 r_g_b, 4 r_g_b_a"], Number] - ]] = Field(None) + ]]= Field(None) class ImageReferences(NWBData): """ Ordered dataset of references to Image objects. """ - name: str = Field(...) - array: Optional[List[Image] | Image] = Field(None) + name:str= Field(...) + array:Optional[List[Image] | Image]= Field(None) class NWBContainer(Container): """ An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers. """ - name: str = Field(...) + name:str= Field(...) class NWBDataInterface(NWBContainer): """ An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - name: str = Field(...) + name:str= Field(...) class TimeSeries(NWBDataInterface): """ General purpose time series. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - data: TimeSeriesData = Field(..., description="""Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + data:TimeSeriesData= Field(..., description="""Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class TimeSeriesData(ConfiguredBaseModel): + """ + Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file. + """ + name:Literal["data"]= Field("data") + conversion:Optional[float]= Field(None, description="""Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as signed 16-bit integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' multiplier to get from raw data acquisition values to recorded volts is 2.5/32768/8000 = 9.5367e-9.""") + offset:Optional[float]= Field(None, description="""Scalar to add to the data after scaling by 'conversion' to finalize its coercion to the specified 'unit'. Two common examples of this include (a) data stored in an unsigned type that requires a shift after scaling to re-center the data, and (b) specialized recording devices that naturally cause a scalar offset with respect to the true units.""") + resolution:Optional[float]= Field(None, description="""Smallest meaningful difference between values in data, stored in the specified by unit, e.g., the change in value of the least significant bit, or a larger number if signal noise is known to be present. If unknown, use -1.0.""") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + continuity:Optional[str]= Field(None, description="""Optionally describe the continuity of the data. Can be \"continuous\", \"instantaneous\", or \"step\". For example, a voltage trace would be \"continuous\", because samples are recorded from a continuous process. An array of lick times would be \"instantaneous\", because the data represents distinct moments in time. Times of image presentations would be \"step\" because the picture remains the same until the next timepoint. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.""") + array:Optional[Union[ + NDArray[Shape["* num_times"], Any], + NDArray[Shape["* num_times, * num_DIM2"], Any], + NDArray[Shape["* num_times, * num_DIM2, * num_DIM3"], Any], + NDArray[Shape["* num_times, * num_DIM2, * num_DIM3, * num_DIM4"], Any] + ]]= Field(None) + + +class TimeSeriesStartingTime(ConfiguredBaseModel): + """ + Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute. + """ + name:Literal["starting_time"]= Field("starting_time") + rate:Optional[float]= Field(None, description="""Sampling rate, in Hz.""") + unit:Optional[str]= Field(None, description="""Unit of measurement for time, which is fixed to 'seconds'.""") + value:float= Field(...) + + +class TimeSeriesSync(ConfiguredBaseModel): + """ + Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes. + """ + name:Literal["sync"]= Field("sync") class ProcessingModule(NWBContainer): """ A collection of processed data. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of this collection of processed data.""") - nwb_data_interface: Optional[List[NWBDataInterface]] = Field(default_factory=list, description="""Data objects stored in this collection.""") - dynamic_table: Optional[List[DynamicTable]] = Field(default_factory=list, description="""Tables stored in this collection.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of this collection of processed data.""") + nwb_data_interface:Optional[List[NWBDataInterface]]= Field(default_factory=list, description="""Data objects stored in this collection.""") + dynamic_table:Optional[List[DynamicTable]]= Field(default_factory=list, description="""Tables stored in this collection.""") class Images(NWBDataInterface): """ A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of this collection of images.""") - Image: List[Image] = Field(default_factory=list, description="""Images stored in this collection.""") - order_of_images: Optional[ImagesOrderOfImages] = Field(None, description="""Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of this collection of images.""") + image:List[Image]= Field(default_factory=list, description="""Images stored in this collection.""") + order_of_images:Optional[ImagesOrderOfImages]= Field(None, description="""Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images.""") + + +class ImagesOrderOfImages(ImageReferences): + """ + Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images. + """ + name:Literal["order_of_images"]= Field("order_of_images") + array:Optional[List[Image] | Image]= Field(None) @@ -145,6 +179,10 @@ ImageReferences.model_rebuild() NWBContainer.model_rebuild() NWBDataInterface.model_rebuild() TimeSeries.model_rebuild() +TimeSeriesData.model_rebuild() +TimeSeriesStartingTime.model_rebuild() +TimeSeriesSync.model_rebuild() ProcessingModule.model_rebuild() Images.model_rebuild() +ImagesOrderOfImages.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_base_include.py b/nwb_linkml/models/core_nwb_base_include.py deleted file mode 100644 index 6eb4c60..0000000 --- a/nwb_linkml/models/core_nwb_base_include.py +++ /dev/null @@ -1,109 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .nwb_language import ( - Arraylike -) - -from .core_nwb_base import ( - ImageReferences, - Image -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class ImageArray(Arraylike): - - x: float = Field(...) - y: float = Field(...) - r_g_b: Optional[float] = Field(None) - r_g_b_a: Optional[float] = Field(None) - - -class ImageReferencesArray(Arraylike): - - num_images: Image = Field(...) - - -class TimeSeriesData(ConfiguredBaseModel): - """ - Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension should always represent time. This can also be used to store binary data (e.g., image frames). This can also be a link to data stored in an external file. - """ - name: str = Field("data", const=True) - conversion: Optional[float] = Field(None, description="""Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as signed 16-bit integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' multiplier to get from raw data acquisition values to recorded volts is 2.5/32768/8000 = 9.5367e-9.""") - offset: Optional[float] = Field(None, description="""Scalar to add to the data after scaling by 'conversion' to finalize its coercion to the specified 'unit'. Two common examples of this include (a) data stored in an unsigned type that requires a shift after scaling to re-center the data, and (b) specialized recording devices that naturally cause a scalar offset with respect to the true units.""") - resolution: Optional[float] = Field(None, description="""Smallest meaningful difference between values in data, stored in the specified by unit, e.g., the change in value of the least significant bit, or a larger number if signal noise is known to be present. If unknown, use -1.0.""") - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - continuity: Optional[str] = Field(None, description="""Optionally describe the continuity of the data. Can be \"continuous\", \"instantaneous\", or \"step\". For example, a voltage trace would be \"continuous\", because samples are recorded from a continuous process. An array of lick times would be \"instantaneous\", because the data represents distinct moments in time. Times of image presentations would be \"step\" because the picture remains the same until the next timepoint. This field is optional, but is useful in providing information about the underlying data. It may inform the way this data is interpreted, the way it is visualized, and what analysis methods are applicable.""") - array: Optional[Union[ - NDArray[Shape["* num_times"], Any], - NDArray[Shape["* num_times, * num_DIM2"], Any], - NDArray[Shape["* num_times, * num_DIM2, * num_DIM3"], Any], - NDArray[Shape["* num_times, * num_DIM2, * num_DIM3, * num_DIM4"], Any] - ]] = Field(None) - - -class TimeSeriesDataArray(Arraylike): - - num_times: Any = Field(...) - num_DIM2: Optional[Any] = Field(None) - num_DIM3: Optional[Any] = Field(None) - num_DIM4: Optional[Any] = Field(None) - - -class TimeSeriesStartingTime(ConfiguredBaseModel): - """ - Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute. - """ - name: str = Field("starting_time", const=True) - rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") - unit: Optional[str] = Field(None, description="""Unit of measurement for time, which is fixed to 'seconds'.""") - - -class TimeSeriesSync(ConfiguredBaseModel): - """ - Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes. - """ - name: str = Field("sync", const=True) - - -class ImagesOrderOfImages(ImageReferences): - """ - Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images. - """ - name: str = Field("order_of_images", const=True) - array: Optional[List[Image] | Image] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -ImageArray.model_rebuild() -ImageReferencesArray.model_rebuild() -TimeSeriesData.model_rebuild() -TimeSeriesDataArray.model_rebuild() -TimeSeriesStartingTime.model_rebuild() -TimeSeriesSync.model_rebuild() -ImagesOrderOfImages.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_behavior.py b/nwb_linkml/models/core_nwb_behavior.py index e7dc6c8..7ba8ca6 100644 --- a/nwb_linkml/models/core_nwb_behavior.py +++ b/nwb_linkml/models/core_nwb_behavior.py @@ -12,14 +12,12 @@ else: from .core_nwb_base import ( + TimeSeriesStartingTime, TimeSeries, + TimeSeriesSync, NWBDataInterface ) -from .core_nwb_behavior_include import ( - SpatialSeriesData -) - from .core_nwb_misc import ( IntervalSeries ) @@ -41,78 +39,93 @@ class SpatialSeries(TimeSeries): """ Direction, e.g., of gaze or travel, or position. The TimeSeries::data field is a 2D array storing position or direction relative to some reference frame. Array structure: [num measurements] [num dimensions]. Each SpatialSeries has a text dataset reference_frame that indicates the zero-position, or the zero-axes for direction. For example, if representing gaze direction, 'straight-ahead' might be a specific pixel on the monitor, or some other point in space. For position data, the 0,0 point might be the top-left corner of an enclosure, as viewed from the tracking camera. The unit of data will indicate how to interpret SpatialSeries values. """ - name: str = Field(...) - data: SpatialSeriesData = Field(..., description="""1-D or 2-D array storing position or direction relative to some reference frame.""") - reference_frame: Optional[str] = Field(None, description="""Description defining what exactly 'straight-ahead' means.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:SpatialSeriesData= Field(..., description="""1-D or 2-D array storing position or direction relative to some reference frame.""") + reference_frame:Optional[str]= Field(None, description="""Description defining what exactly 'straight-ahead' means.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class SpatialSeriesData(ConfiguredBaseModel): + """ + 1-D or 2-D array storing position or direction relative to some reference frame. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. The default value is 'meters'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + array:Optional[Union[ + NDArray[Shape["* num_times"], Number], + NDArray[Shape["* num_times, 1 x"], Number], + NDArray[Shape["* num_times, 1 x, 2 x_y"], Number], + NDArray[Shape["* num_times, 1 x, 2 x_y, 3 x_y_z"], Number] + ]]= Field(None) class BehavioralEpochs(NWBDataInterface): """ TimeSeries for storing behavioral epochs. The objective of this and the other two Behavioral interfaces (e.g. BehavioralEvents and BehavioralTimeSeries) is to provide generic hooks for software tools/scripts. This allows a tool/script to take the output one specific interface (e.g., UnitTimes) and plot that data relative to another data modality (e.g., behavioral events) without having to define all possible modalities in advance. Declaring one of these interfaces means that one or more TimeSeries of the specified type is published. These TimeSeries should reside in a group having the same name as the interface. For example, if a BehavioralTimeSeries interface is declared, the module will have one or more TimeSeries defined in the module sub-group 'BehavioralTimeSeries'. BehavioralEpochs should use IntervalSeries. BehavioralEvents is used for irregular events. BehavioralTimeSeries is for continuous data. """ - name: str = Field(...) - interval_series: Optional[List[IntervalSeries]] = Field(default_factory=list, description="""IntervalSeries object containing start and stop times of epochs.""") + name:str= Field(...) + interval_series:Optional[List[IntervalSeries]]= Field(default_factory=list, description="""IntervalSeries object containing start and stop times of epochs.""") class BehavioralEvents(NWBDataInterface): """ TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - name: str = Field(...) - time_series: Optional[List[TimeSeries]] = Field(default_factory=list, description="""TimeSeries object containing behavioral events.""") + name:str= Field(...) + time_series:Optional[List[TimeSeries]]= Field(default_factory=list, description="""TimeSeries object containing behavioral events.""") class BehavioralTimeSeries(NWBDataInterface): """ TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - name: str = Field(...) - time_series: Optional[List[TimeSeries]] = Field(default_factory=list, description="""TimeSeries object containing continuous behavioral data.""") + name:str= Field(...) + time_series:Optional[List[TimeSeries]]= Field(default_factory=list, description="""TimeSeries object containing continuous behavioral data.""") class PupilTracking(NWBDataInterface): """ Eye-tracking data, representing pupil size. """ - name: str = Field(...) - time_series: List[TimeSeries] = Field(default_factory=list, description="""TimeSeries object containing time series data on pupil size.""") + name:str= Field(...) + time_series:List[TimeSeries]= Field(default_factory=list, description="""TimeSeries object containing time series data on pupil size.""") class EyeTracking(NWBDataInterface): """ Eye-tracking data, representing direction of gaze. """ - name: str = Field(...) - spatial_series: Optional[List[SpatialSeries]] = Field(default_factory=list, description="""SpatialSeries object containing data measuring direction of gaze.""") + name:str= Field(...) + spatial_series:Optional[List[SpatialSeries]]= Field(default_factory=list, description="""SpatialSeries object containing data measuring direction of gaze.""") class CompassDirection(NWBDataInterface): """ With a CompassDirection interface, a module publishes a SpatialSeries object representing a floating point value for theta. The SpatialSeries::reference_frame field should indicate what direction corresponds to 0 and which is the direction of rotation (this should be clockwise). The si_unit for the SpatialSeries should be radians or degrees. """ - name: str = Field(...) - spatial_series: Optional[List[SpatialSeries]] = Field(default_factory=list, description="""SpatialSeries object containing direction of gaze travel.""") + name:str= Field(...) + spatial_series:Optional[List[SpatialSeries]]= Field(default_factory=list, description="""SpatialSeries object containing direction of gaze travel.""") class Position(NWBDataInterface): """ Position data, whether along the x, x/y or x/y/z axis. """ - name: str = Field(...) - spatial_series: List[SpatialSeries] = Field(default_factory=list, description="""SpatialSeries object containing position data.""") + name:str= Field(...) + spatial_series:List[SpatialSeries]= Field(default_factory=list, description="""SpatialSeries object containing position data.""") # Model rebuild # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model SpatialSeries.model_rebuild() +SpatialSeriesData.model_rebuild() BehavioralEpochs.model_rebuild() BehavioralEvents.model_rebuild() BehavioralTimeSeries.model_rebuild() diff --git a/nwb_linkml/models/core_nwb_behavior_include.py b/nwb_linkml/models/core_nwb_behavior_include.py deleted file mode 100644 index df2b19d..0000000 --- a/nwb_linkml/models/core_nwb_behavior_include.py +++ /dev/null @@ -1,58 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class SpatialSeriesData(ConfiguredBaseModel): - """ - 1-D or 2-D array storing position or direction relative to some reference frame. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. The default value is 'meters'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - array: Optional[Union[ - NDArray[Shape["* num_times"], Number], - NDArray[Shape["* num_times, 1 x"], Number], - NDArray[Shape["* num_times, 1 x, 2 x_y"], Number], - NDArray[Shape["* num_times, 1 x, 2 x_y, 3 x_y_z"], Number] - ]] = Field(None) - - -class SpatialSeriesDataArray(Arraylike): - - num_times: float = Field(...) - x: Optional[float] = Field(None) - xy: Optional[float] = Field(None) - xyz: Optional[float] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -SpatialSeriesData.model_rebuild() -SpatialSeriesDataArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_device.py b/nwb_linkml/models/core_nwb_device.py index 1467dd3..fda064b 100644 --- a/nwb_linkml/models/core_nwb_device.py +++ b/nwb_linkml/models/core_nwb_device.py @@ -32,9 +32,9 @@ class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of the device (e.g., model, firmware version, processing software version, etc.) as free-form text.""") - manufacturer: Optional[str] = Field(None, description="""The name of the manufacturer of the device.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of the device (e.g., model, firmware version, processing software version, etc.) as free-form text.""") + manufacturer:Optional[str]= Field(None, description="""The name of the manufacturer of the device.""") diff --git a/nwb_linkml/models/core_nwb_ecephys.py b/nwb_linkml/models/core_nwb_ecephys.py index fa575f3..d15f861 100644 --- a/nwb_linkml/models/core_nwb_ecephys.py +++ b/nwb_linkml/models/core_nwb_ecephys.py @@ -12,19 +12,16 @@ else: from .core_nwb_base import ( - TimeSeries, + TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeries, NWBDataInterface ) -from .core_nwb_ecephys_include import ( - FeatureExtractionElectrodes, - ClusterWaveformsWaveformSd, - ClusterWaveformsWaveformMean, - SpikeEventSeriesData, - ElectricalSeriesElectrodes, - ElectricalSeriesData, - FeatureExtractionFeatures +from .hdmf_common_table import ( + DynamicTable, + DynamicTableRegion ) @@ -44,125 +41,211 @@ class ElectricalSeries(TimeSeries): """ A time series of acquired voltage data from extracellular recordings. The data field is an int or float array storing data in volts. The first dimension should always represent time. The second dimension, if present, should represent channels. """ - name: str = Field(...) - filtering: Optional[str] = Field(None, description="""Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.""") - data: ElectricalSeriesData = Field(..., description="""Recorded voltage data.""") - electrodes: ElectricalSeriesElectrodes = Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") - channel_conversion: Optional[List[float]] = Field(default_factory=list, description="""Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + filtering:Optional[str]= Field(None, description="""Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.""") + data:ElectricalSeriesData= Field(..., description="""Recorded voltage data.""") + electrodes:ElectricalSeriesElectrodes= Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") + channel_conversion:Optional[List[float]]= Field(default_factory=list, description="""Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class ElectricalSeriesData(ConfiguredBaseModel): + """ + Recorded voltage data. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. This value is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion', followed by 'channel_conversion' (if present), and then add 'offset'.""") + array:Optional[Union[ + NDArray[Shape["* num_times"], Number], + NDArray[Shape["* num_times, * num_channels"], Number], + NDArray[Shape["* num_times, * num_channels, * num_samples"], Number] + ]]= Field(None) + + +class ElectricalSeriesElectrodes(DynamicTableRegion): + """ + DynamicTableRegion pointer to the electrodes that this time series was generated from. + """ + name:Literal["electrodes"]= Field("electrodes") + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class SpikeEventSeries(ElectricalSeries): """ Stores snapshots/snippets of recorded spike events (i.e., threshold crossings). This may also be raw data, as reported by ephys hardware. If so, the TimeSeries::description field should describe how events were detected. All SpikeEventSeries should reside in a module (under EventWaveform interface) even if the spikes were reported and stored by hardware. All events span the same recording channels and store snapshots of equal duration. TimeSeries::data array structure: [num events] [num channels] [num samples] (or [num events] [num samples] for single electrode). """ - name: str = Field(...) - data: SpikeEventSeriesData = Field(..., description="""Spike waveforms.""") - timestamps: List[float] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time. Timestamps are required for the events. Unlike for TimeSeries, timestamps are required for SpikeEventSeries and are thus re-specified here.""") - filtering: Optional[str] = Field(None, description="""Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.""") - electrodes: ElectricalSeriesElectrodes = Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") - channel_conversion: Optional[List[float]] = Field(default_factory=list, description="""Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:SpikeEventSeriesData= Field(..., description="""Spike waveforms.""") + timestamps:List[float]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time. Timestamps are required for the events. Unlike for TimeSeries, timestamps are required for SpikeEventSeries and are thus re-specified here.""") + filtering:Optional[str]= Field(None, description="""Filtering applied to all channels of the data. For example, if this ElectricalSeries represents high-pass-filtered data (also known as AP Band), then this value could be \"High-pass 4-pole Bessel filter at 500 Hz\". If this ElectricalSeries represents low-pass-filtered LFP data and the type of filter is unknown, then this value could be \"Low-pass filter at 300 Hz\". If a non-standard filter type is used, provide as much detail about the filter properties as possible.""") + electrodes:ElectricalSeriesElectrodes= Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") + channel_conversion:Optional[List[float]]= Field(default_factory=list, description="""Channel-specific conversion factor. Multiply the data in the 'data' dataset by these values along the channel axis (as indicated by axis attribute) AND by the global conversion factor in the 'conversion' attribute of 'data' to get the data values in Volts, i.e, data in Volts = data * data.conversion * channel_conversion. This approach allows for both global and per-channel data conversion factors needed to support the storage of electrical recordings as native values generated by data acquisition systems. If this dataset is not present, then there is no channel-specific conversion factor, i.e. it is 1 for all channels.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class SpikeEventSeriesData(ConfiguredBaseModel): + """ + Spike waveforms. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Unit of measurement for waveforms, which is fixed to 'volts'.""") + array:Optional[Union[ + NDArray[Shape["* num_events, * num_samples"], Number], + NDArray[Shape["* num_events, * num_samples, * num_channels"], Number] + ]]= Field(None) class FeatureExtraction(NWBDataInterface): """ Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - name: str = Field(...) - description: List[str] = Field(default_factory=list, description="""Description of features (eg, ''PC1'') for each of the extracted features.""") - features: FeatureExtractionFeatures = Field(..., description="""Multi-dimensional array of features extracted from each event.""") - times: List[float] = Field(default_factory=list, description="""Times of events that features correspond to (can be a link).""") - electrodes: FeatureExtractionElectrodes = Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") + name:str= Field(...) + description:List[str]= Field(default_factory=list, description="""Description of features (eg, ''PC1'') for each of the extracted features.""") + features:FeatureExtractionFeatures= Field(..., description="""Multi-dimensional array of features extracted from each event.""") + times:List[float]= Field(default_factory=list, description="""Times of events that features correspond to (can be a link).""") + electrodes:FeatureExtractionElectrodes= Field(..., description="""DynamicTableRegion pointer to the electrodes that this time series was generated from.""") + + +class FeatureExtractionFeatures(ConfiguredBaseModel): + """ + Multi-dimensional array of features extracted from each event. + """ + name:Literal["features"]= Field("features") + array:Optional[NDArray[Shape["* num_events, * num_channels, * num_features"], Float32]]= Field(None) + + +class FeatureExtractionElectrodes(DynamicTableRegion): + """ + DynamicTableRegion pointer to the electrodes that this time series was generated from. + """ + name:Literal["electrodes"]= Field("electrodes") + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class EventDetection(NWBDataInterface): """ Detected spike events from voltage trace(s). """ - name: str = Field(...) - detection_method: str = Field(..., description="""Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values.""") - source_idx: List[int] = Field(default_factory=list, description="""Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. ''description'' should define what is meant by time of event (e.g., .25 ms before action potential peak, zero-crossing time, etc). The index points to each event from the raw data.""") - times: List[float] = Field(default_factory=list, description="""Timestamps of events, in seconds.""") + name:str= Field(...) + detection_method:str= Field(..., description="""Description of how events were detected, such as voltage threshold, or dV/dT threshold, as well as relevant values.""") + source_idx:List[int]= Field(default_factory=list, description="""Indices (zero-based) into source ElectricalSeries::data array corresponding to time of event. ''description'' should define what is meant by time of event (e.g., .25 ms before action potential peak, zero-crossing time, etc). The index points to each event from the raw data.""") + times:List[float]= Field(default_factory=list, description="""Timestamps of events, in seconds.""") class EventWaveform(NWBDataInterface): """ Represents either the waveforms of detected events, as extracted from a raw data trace in /acquisition, or the event waveforms that were stored during experiment acquisition. """ - name: str = Field(...) - spike_event_series: Optional[List[SpikeEventSeries]] = Field(default_factory=list, description="""SpikeEventSeries object(s) containing detected spike event waveforms.""") + name:str= Field(...) + spike_event_series:Optional[List[SpikeEventSeries]]= Field(default_factory=list, description="""SpikeEventSeries object(s) containing detected spike event waveforms.""") class FilteredEphys(NWBDataInterface): """ Electrophysiology data from one or more channels that has been subjected to filtering. Examples of filtered data include Theta and Gamma (LFP has its own interface). FilteredEphys modules publish an ElectricalSeries for each filtered channel or set of channels. The name of each ElectricalSeries is arbitrary but should be informative. The source of the filtered data, whether this is from analysis of another time series or as acquired by hardware, should be noted in each's TimeSeries::description field. There is no assumed 1::1 correspondence between filtered ephys signals and electrodes, as a single signal can apply to many nearby electrodes, and one electrode may have different filtered (e.g., theta and/or gamma) signals represented. Filter properties should be noted in the ElectricalSeries 'filtering' attribute. """ - name: str = Field(...) - electrical_series: List[ElectricalSeries] = Field(default_factory=list, description="""ElectricalSeries object(s) containing filtered electrophysiology data.""") + name:str= Field(...) + electrical_series:List[ElectricalSeries]= Field(default_factory=list, description="""ElectricalSeries object(s) containing filtered electrophysiology data.""") class LFP(NWBDataInterface): """ LFP data from one or more channels. The electrode map in each published ElectricalSeries will identify which channels are providing LFP data. Filter properties should be noted in the ElectricalSeries 'filtering' attribute. """ - name: str = Field(...) - electrical_series: List[ElectricalSeries] = Field(default_factory=list, description="""ElectricalSeries object(s) containing LFP data for one or more channels.""") + name:str= Field(...) + electrical_series:List[ElectricalSeries]= Field(default_factory=list, description="""ElectricalSeries object(s) containing LFP data for one or more channels.""") class ElectrodeGroup(NWBContainer): """ A physical grouping of electrodes, e.g. a shank of an array. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of this electrode group.""") - location: Optional[str] = Field(None, description="""Location of electrode group. Specify the area, layer, comments on estimation of area/layer, etc. Use standard atlas names for anatomical regions when possible.""") - position: Optional[Any] = Field(None, description="""stereotaxic or common framework coordinates""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of this electrode group.""") + location:Optional[str]= Field(None, description="""Location of electrode group. Specify the area, layer, comments on estimation of area/layer, etc. Use standard atlas names for anatomical regions when possible.""") + position:Optional[Any]= Field(None, description="""stereotaxic or common framework coordinates""") class ClusterWaveforms(NWBDataInterface): """ DEPRECATED The mean waveform shape, including standard deviation, of the different clusters. Ideally, the waveform analysis should be performed on data that is only high-pass filtered. This is a separate module because it is expected to require updating. For example, IMEC probes may require different storage requirements to store/display mean waveforms, requiring a new interface or an extension of this one. """ - name: str = Field(...) - waveform_filtering: str = Field(..., description="""Filtering applied to data before generating mean/sd""") - waveform_mean: ClusterWaveformsWaveformMean = Field(..., description="""The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled)""") - waveform_sd: ClusterWaveformsWaveformSd = Field(..., description="""Stdev of waveforms for each cluster, using the same indices as in mean""") + name:str= Field(...) + waveform_filtering:str= Field(..., description="""Filtering applied to data before generating mean/sd""") + waveform_mean:ClusterWaveformsWaveformMean= Field(..., description="""The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled)""") + waveform_sd:ClusterWaveformsWaveformSd= Field(..., description="""Stdev of waveforms for each cluster, using the same indices as in mean""") + + +class ClusterWaveformsWaveformMean(ConfiguredBaseModel): + """ + The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled) + """ + name:Literal["waveform_mean"]= Field("waveform_mean") + array:Optional[NDArray[Shape["* num_clusters, * num_samples"], Float32]]= Field(None) + + +class ClusterWaveformsWaveformSd(ConfiguredBaseModel): + """ + Stdev of waveforms for each cluster, using the same indices as in mean + """ + name:Literal["waveform_sd"]= Field("waveform_sd") + array:Optional[NDArray[Shape["* num_clusters, * num_samples"], Float32]]= Field(None) class Clustering(NWBDataInterface): """ DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - name: str = Field(...) - description: str = Field(..., description="""Description of clusters or clustering, (e.g. cluster 0 is noise, clusters curated using Klusters, etc)""") - num: List[int] = Field(default_factory=list, description="""Cluster number of each event""") - peak_over_rms: List[float] = Field(default_factory=list, description="""Maximum ratio of waveform peak to RMS on any channel in the cluster (provides a basic clustering metric).""") - times: List[float] = Field(default_factory=list, description="""Times of clustered events, in seconds. This may be a link to times field in associated FeatureExtraction module.""") + name:str= Field(...) + description:str= Field(..., description="""Description of clusters or clustering, (e.g. cluster 0 is noise, clusters curated using Klusters, etc)""") + num:List[int]= Field(default_factory=list, description="""Cluster number of each event""") + peak_over_rms:List[float]= Field(default_factory=list, description="""Maximum ratio of waveform peak to RMS on any channel in the cluster (provides a basic clustering metric).""") + times:List[float]= Field(default_factory=list, description="""Times of clustered events, in seconds. This may be a link to times field in associated FeatureExtraction module.""") # Model rebuild # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model ElectricalSeries.model_rebuild() +ElectricalSeriesData.model_rebuild() +ElectricalSeriesElectrodes.model_rebuild() SpikeEventSeries.model_rebuild() +SpikeEventSeriesData.model_rebuild() FeatureExtraction.model_rebuild() +FeatureExtractionFeatures.model_rebuild() +FeatureExtractionElectrodes.model_rebuild() EventDetection.model_rebuild() EventWaveform.model_rebuild() FilteredEphys.model_rebuild() LFP.model_rebuild() ElectrodeGroup.model_rebuild() ClusterWaveforms.model_rebuild() +ClusterWaveformsWaveformMean.model_rebuild() +ClusterWaveformsWaveformSd.model_rebuild() Clustering.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_ecephys_include.py b/nwb_linkml/models/core_nwb_ecephys_include.py deleted file mode 100644 index f0989c9..0000000 --- a/nwb_linkml/models/core_nwb_ecephys_include.py +++ /dev/null @@ -1,162 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .hdmf_common_table import ( - DynamicTableRegion -) - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class ElectricalSeriesData(ConfiguredBaseModel): - """ - Recorded voltage data. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. This value is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion', followed by 'channel_conversion' (if present), and then add 'offset'.""") - array: Optional[Union[ - NDArray[Shape["* num_times"], Number], - NDArray[Shape["* num_times, * num_channels"], Number], - NDArray[Shape["* num_times, * num_channels, * num_samples"], Number] - ]] = Field(None) - - -class ElectricalSeriesDataArray(Arraylike): - - num_times: float = Field(...) - num_channels: Optional[float] = Field(None) - num_samples: Optional[float] = Field(None) - - -class ElectricalSeriesElectrodes(DynamicTableRegion): - """ - DynamicTableRegion pointer to the electrodes that this time series was generated from. - """ - name: str = Field("electrodes", const=True) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class SpikeEventSeriesData(ConfiguredBaseModel): - """ - Spike waveforms. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for waveforms, which is fixed to 'volts'.""") - array: Optional[Union[ - NDArray[Shape["* num_events, * num_samples"], Number], - NDArray[Shape["* num_events, * num_samples, * num_channels"], Number] - ]] = Field(None) - - -class SpikeEventSeriesDataArray(Arraylike): - - num_events: float = Field(...) - num_samples: float = Field(...) - num_channels: Optional[float] = Field(None) - - -class FeatureExtractionFeatures(ConfiguredBaseModel): - """ - Multi-dimensional array of features extracted from each event. - """ - name: str = Field("features", const=True) - array: Optional[NDArray[Shape["* num_events, * num_channels, * num_features"], Float32]] = Field(None) - - -class FeatureExtractionFeaturesArray(Arraylike): - - num_events: float = Field(...) - num_channels: float = Field(...) - num_features: float = Field(...) - - -class FeatureExtractionElectrodes(DynamicTableRegion): - """ - DynamicTableRegion pointer to the electrodes that this time series was generated from. - """ - name: str = Field("electrodes", const=True) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class ClusterWaveformsWaveformMean(ConfiguredBaseModel): - """ - The mean waveform for each cluster, using the same indices for each wave as cluster numbers in the associated Clustering module (i.e, cluster 3 is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should be empty (e.g., zero- filled) - """ - name: str = Field("waveform_mean", const=True) - array: Optional[NDArray[Shape["* num_clusters, * num_samples"], Float32]] = Field(None) - - -class ClusterWaveformsWaveformMeanArray(Arraylike): - - num_clusters: float = Field(...) - num_samples: float = Field(...) - - -class ClusterWaveformsWaveformSd(ConfiguredBaseModel): - """ - Stdev of waveforms for each cluster, using the same indices as in mean - """ - name: str = Field("waveform_sd", const=True) - array: Optional[NDArray[Shape["* num_clusters, * num_samples"], Float32]] = Field(None) - - -class ClusterWaveformsWaveformSdArray(Arraylike): - - num_clusters: float = Field(...) - num_samples: float = Field(...) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -ElectricalSeriesData.model_rebuild() -ElectricalSeriesDataArray.model_rebuild() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeriesData.model_rebuild() -SpikeEventSeriesDataArray.model_rebuild() -FeatureExtractionFeatures.model_rebuild() -FeatureExtractionFeaturesArray.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -ClusterWaveformsWaveformMean.model_rebuild() -ClusterWaveformsWaveformMeanArray.model_rebuild() -ClusterWaveformsWaveformSd.model_rebuild() -ClusterWaveformsWaveformSdArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_epoch.py b/nwb_linkml/models/core_nwb_epoch.py index d9890ce..755e1ec 100644 --- a/nwb_linkml/models/core_nwb_epoch.py +++ b/nwb_linkml/models/core_nwb_epoch.py @@ -12,13 +12,13 @@ else: from .hdmf_common_table import ( + VectorIndex, + VectorData, DynamicTable ) -from .core_nwb_epoch_include import ( - TimeIntervalsTimeseriesIndex, - TimeIntervalsTimeseries, - TimeIntervalsTagsIndex +from .core_nwb_base import ( + TimeSeriesReferenceVectorData ) @@ -38,21 +38,68 @@ class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - name: str = Field(...) - start_time: Optional[List[float]] = Field(default_factory=list, description="""Start time of epoch, in seconds.""") - stop_time: Optional[List[float]] = Field(default_factory=list, description="""Stop time of epoch, in seconds.""") - tags: Optional[List[str]] = Field(default_factory=list, description="""User-defined tags that identify or categorize events.""") - tags_index: Optional[TimeIntervalsTagsIndex] = Field(None, description="""Index for tags.""") - timeseries: Optional[TimeIntervalsTimeseries] = Field(None, description="""An index into a TimeSeries object.""") - timeseries_index: Optional[TimeIntervalsTimeseriesIndex] = Field(None, description="""Index for timeseries.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + start_time:Optional[List[float]]= Field(default_factory=list, description="""Start time of epoch, in seconds.""") + stop_time:Optional[List[float]]= Field(default_factory=list, description="""Stop time of epoch, in seconds.""") + tags:Optional[List[str]]= Field(default_factory=list, description="""User-defined tags that identify or categorize events.""") + tags_index:Optional[TimeIntervalsTagsIndex]= Field(None, description="""Index for tags.""") + timeseries:Optional[TimeIntervalsTimeseries]= Field(None, description="""An index into a TimeSeries object.""") + timeseries_index:Optional[TimeIntervalsTimeseriesIndex]= Field(None, description="""Index for timeseries.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class TimeIntervalsTagsIndex(VectorIndex): + """ + Index for tags. + """ + name:Literal["tags_index"]= Field("tags_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class TimeIntervalsTimeseries(TimeSeriesReferenceVectorData): + """ + An index into a TimeSeries object. + """ + name:Literal["timeseries"]= Field("timeseries") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class TimeIntervalsTimeseriesIndex(VectorIndex): + """ + Index for timeseries. + """ + name:Literal["timeseries_index"]= Field("timeseries_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) # Model rebuild # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model TimeIntervals.model_rebuild() +TimeIntervalsTagsIndex.model_rebuild() +TimeIntervalsTimeseries.model_rebuild() +TimeIntervalsTimeseriesIndex.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_epoch_include.py b/nwb_linkml/models/core_nwb_epoch_include.py deleted file mode 100644 index 5f68166..0000000 --- a/nwb_linkml/models/core_nwb_epoch_include.py +++ /dev/null @@ -1,85 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .hdmf_common_table import ( - VectorIndex -) - -from .core_nwb_base import ( - TimeSeriesReferenceVectorData -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class TimeIntervalsTagsIndex(VectorIndex): - """ - Index for tags. - """ - name: str = Field("tags_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class TimeIntervalsTimeseries(TimeSeriesReferenceVectorData): - """ - An index into a TimeSeries object. - """ - name: str = Field("timeseries", const=True) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class TimeIntervalsTimeseriesIndex(VectorIndex): - """ - Index for timeseries. - """ - name: str = Field("timeseries_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_file.py b/nwb_linkml/models/core_nwb_file.py index efa62f8..7331f77 100644 --- a/nwb_linkml/models/core_nwb_file.py +++ b/nwb_linkml/models/core_nwb_file.py @@ -11,24 +11,49 @@ else: from typing_extensions import Literal +from .core_nwb_base import ( + NWBContainer, + Images, + TimeSeries, + NWBDataInterface, + ProcessingModule, + NWBData +) + +from .core_nwb_ecephys import ( + ElectrodeGroup +) + +from .core_nwb_ogen import ( + OptogeneticStimulusSite +) + +from .core_nwb_device import ( + Device +) + +from .core_nwb_ophys import ( + ImagingPlane +) + +from .core_nwb_epoch import ( + TimeIntervals +) + +from .core_nwb_icephys import ( + IntracellularElectrode, + IntracellularRecordingsTable, + RepetitionsTable, + SimultaneousRecordingsTable, + ExperimentalConditionsTable, + SweepTable, + SequentialRecordingsTable +) + from .hdmf_common_table import ( DynamicTable ) -from .core_nwb_base import ( - NWBData, - ProcessingModule, - NWBDataInterface, - NWBContainer -) - -from .core_nwb_file_include import ( - NWBFileGeneral, - SubjectAge, - NWBFileIntervals, - NWBFileStimulus -) - from .core_nwb_misc import ( Units ) @@ -50,52 +75,144 @@ class ScratchData(NWBData): """ Any one-off datasets """ - name: str = Field(...) - notes: Optional[str] = Field(None, description="""Any notes the user has about the dataset being stored""") + name:str= Field(...) + notes:Optional[str]= Field(None, description="""Any notes the user has about the dataset being stored""") class NWBFile(NWBContainer): """ An NWB file storing cellular-based neurophysiology data from a single experimental session. """ - name: str = Field("root", const=True) - nwb_version: Optional[str] = Field(None, description="""File version string. Use semantic versioning, e.g. 1.2.1. This will be the name of the format with trailing major, minor and patch numbers.""") - file_create_date: List[datetime ] = Field(default_factory=list, description="""A record of the date the file was created and of subsequent modifications. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted strings: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. The file can be created after the experiment was run, so this may differ from the experiment start time. Each modification to the nwb file adds a new entry to the array.""") - identifier: str = Field(..., description="""A unique text identifier for the file. For example, concatenated lab name, file creation date/time and experimentalist, or a hash of these and/or other values. The goal is that the string should be unique to all other files.""") - session_description: str = Field(..., description="""A description of the experimental session and data in the file.""") - session_start_time: datetime = Field(..., description="""Date and time of the experiment/session start. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds.""") - timestamps_reference_time: datetime = Field(..., description="""Date and time corresponding to time zero of all timestamps. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. All times stored in the file use this time as reference (i.e., time zero).""") - acquisition: Optional[List[Union[DynamicTable, NWBDataInterface]]] = Field(default_factory=list, description="""Data streams recorded from the system, including ephys, ophys, tracking, etc. This group should be read-only after the experiment is completed and timestamps are corrected to a common timebase. The data stored here may be links to raw data stored in external NWB files. This will allow keeping bulky raw data out of the file while preserving the option of keeping some/all in the file. Acquired data includes tracking and experimental data streams (i.e., everything measured from the system). If bulky data is stored in the /acquisition group, the data can exist in a separate NWB file that is linked to by the file being used for processing and analysis.""") - analysis: Optional[List[Union[DynamicTable, NWBContainer]]] = Field(default_factory=list, description="""Lab-specific and custom scientific analysis of data. There is no defined format for the content of this group - the format is up to the individual user/lab. To facilitate sharing analysis data between labs, the contents here should be stored in standard types (e.g., neurodata_types) and appropriately documented. The file can store lab-specific and custom data analysis without restriction on its form or schema, reducing data formatting restrictions on end users. Such data should be placed in the analysis group. The analysis data should be documented so that it could be shared with other labs.""") - scratch: Optional[List[Union[DynamicTable, NWBContainer]]] = Field(default_factory=list, description="""A place to store one-off analysis results. Data placed here is not intended for sharing. By placing data here, users acknowledge that there is no guarantee that their data meets any standard.""") - processing: Optional[List[ProcessingModule]] = Field(default_factory=list, description="""The home for ProcessingModules. These modules perform intermediate analysis of data that is necessary to perform before scientific analysis. Examples include spike clustering, extracting position from tracking data, stitching together image slices. ProcessingModules can be large and express many data sets from relatively complex analysis (e.g., spike detection and clustering) or small, representing extraction of position information from tracking video, or even binary lick/no-lick decisions. Common software tools (e.g., klustakwik, MClust) are expected to read/write data here. 'Processing' refers to intermediate analysis of the acquired data to make it more amenable to scientific analysis.""") - stimulus: NWBFileStimulus = Field(..., description="""Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file.""") - general: NWBFileGeneral = Field(..., description="""Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them.""") - intervals: Optional[NWBFileIntervals] = Field(None, description="""Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data.""") - units: Optional[Units] = Field(None, description="""Data about sorted spike units.""") + name:Literal["root"]= Field("root") + nwb_version:Optional[str]= Field(None, description="""File version string. Use semantic versioning, e.g. 1.2.1. This will be the name of the format with trailing major, minor and patch numbers.""") + file_create_date:List[datetime ]= Field(default_factory=list, description="""A record of the date the file was created and of subsequent modifications. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted strings: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. The file can be created after the experiment was run, so this may differ from the experiment start time. Each modification to the nwb file adds a new entry to the array.""") + identifier:str= Field(..., description="""A unique text identifier for the file. For example, concatenated lab name, file creation date/time and experimentalist, or a hash of these and/or other values. The goal is that the string should be unique to all other files.""") + session_description:str= Field(..., description="""A description of the experimental session and data in the file.""") + session_start_time:datetime = Field(..., description="""Date and time of the experiment/session start. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds.""") + timestamps_reference_time:datetime = Field(..., description="""Date and time corresponding to time zero of all timestamps. The date is stored in UTC with local timezone offset as ISO 8601 extended formatted string: 2018-09-28T14:43:54.123+02:00. Dates stored in UTC end in \"Z\" with no timezone offset. Date accuracy is up to milliseconds. All times stored in the file use this time as reference (i.e., time zero).""") + acquisition:Optional[List[Union[DynamicTable, NWBDataInterface]]]= Field(default_factory=list, description="""Data streams recorded from the system, including ephys, ophys, tracking, etc. This group should be read-only after the experiment is completed and timestamps are corrected to a common timebase. The data stored here may be links to raw data stored in external NWB files. This will allow keeping bulky raw data out of the file while preserving the option of keeping some/all in the file. Acquired data includes tracking and experimental data streams (i.e., everything measured from the system). If bulky data is stored in the /acquisition group, the data can exist in a separate NWB file that is linked to by the file being used for processing and analysis.""") + analysis:Optional[List[Union[DynamicTable, NWBContainer]]]= Field(default_factory=list, description="""Lab-specific and custom scientific analysis of data. There is no defined format for the content of this group - the format is up to the individual user/lab. To facilitate sharing analysis data between labs, the contents here should be stored in standard types (e.g., neurodata_types) and appropriately documented. The file can store lab-specific and custom data analysis without restriction on its form or schema, reducing data formatting restrictions on end users. Such data should be placed in the analysis group. The analysis data should be documented so that it could be shared with other labs.""") + scratch:Optional[List[Union[DynamicTable, NWBContainer]]]= Field(default_factory=list, description="""A place to store one-off analysis results. Data placed here is not intended for sharing. By placing data here, users acknowledge that there is no guarantee that their data meets any standard.""") + processing:Optional[List[ProcessingModule]]= Field(default_factory=list, description="""The home for ProcessingModules. These modules perform intermediate analysis of data that is necessary to perform before scientific analysis. Examples include spike clustering, extracting position from tracking data, stitching together image slices. ProcessingModules can be large and express many data sets from relatively complex analysis (e.g., spike detection and clustering) or small, representing extraction of position information from tracking video, or even binary lick/no-lick decisions. Common software tools (e.g., klustakwik, MClust) are expected to read/write data here. 'Processing' refers to intermediate analysis of the acquired data to make it more amenable to scientific analysis.""") + stimulus:NWBFileStimulus= Field(..., description="""Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file.""") + general:NWBFileGeneral= Field(..., description="""Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them.""") + intervals:Optional[NWBFileIntervals]= Field(None, description="""Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data.""") + units:Optional[Units]= Field(None, description="""Data about sorted spike units.""") + + +class NWBFileStimulus(ConfiguredBaseModel): + """ + Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file. + """ + name:Literal["stimulus"]= Field("stimulus") + presentation:Optional[List[TimeSeries]]= Field(default_factory=list, description="""Stimuli presented during the experiment.""") + templates:Optional[List[Union[Images, TimeSeries]]]= Field(default_factory=list, description="""Template stimuli. Timestamps in templates are based on stimulus design and are relative to the beginning of the stimulus. When templates are used, the stimulus instances must convert presentation times to the experiment`s time reference frame.""") + + +class NWBFileGeneral(ConfiguredBaseModel): + """ + Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them. + """ + name:Literal["general"]= Field("general") + data_collection:Optional[str]= Field(None, description="""Notes about data collection and analysis.""") + experiment_description:Optional[str]= Field(None, description="""General description of the experiment.""") + experimenter:Optional[List[str]]= Field(default_factory=list, description="""Name of person(s) who performed the experiment. Can also specify roles of different people involved.""") + institution:Optional[str]= Field(None, description="""Institution(s) where experiment was performed.""") + keywords:Optional[List[str]]= Field(default_factory=list, description="""Terms to search over.""") + lab:Optional[str]= Field(None, description="""Laboratory where experiment was performed.""") + notes:Optional[str]= Field(None, description="""Notes about the experiment.""") + pharmacology:Optional[str]= Field(None, description="""Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.""") + protocol:Optional[str]= Field(None, description="""Experimental protocol, if applicable. e.g., include IACUC protocol number.""") + related_publications:Optional[List[str]]= Field(default_factory=list, description="""Publication information. PMID, DOI, URL, etc.""") + session_id:Optional[str]= Field(None, description="""Lab-specific ID for the session.""") + slices:Optional[str]= Field(None, description="""Description of slices, including information about preparation thickness, orientation, temperature, and bath solution.""") + source_script:Optional[NWBFileGeneralSourceScript]= Field(None, description="""Script file or link to public source code used to create this NWB file.""") + stimulus:Optional[str]= Field(None, description="""Notes about stimuli, such as how and where they were presented.""") + surgery:Optional[str]= Field(None, description="""Narrative description about surgery/surgeries, including date(s) and who performed surgery.""") + virus:Optional[str]= Field(None, description="""Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.""") + lab_meta_data:Optional[List[LabMetaData]]= Field(default_factory=list, description="""Place-holder than can be extended so that lab-specific meta-data can be placed in /general.""") + devices:Optional[List[Device]]= Field(default_factory=list, description="""Description of hardware devices used during experiment, e.g., monitors, ADC boards, microscopes, etc.""") + subject:Optional[Subject]= Field(None, description="""Information about the animal or person from which the data was measured.""") + extracellular_ephys:Optional[NWBFileGeneralExtracellularEphys]= Field(None, description="""Metadata related to extracellular electrophysiology.""") + intracellular_ephys:Optional[NWBFileGeneralIntracellularEphys]= Field(None, description="""Metadata related to intracellular electrophysiology.""") + optogenetics:Optional[List[OptogeneticStimulusSite]]= Field(default_factory=list, description="""Metadata describing optogenetic stimuluation.""") + optophysiology:Optional[List[ImagingPlane]]= Field(default_factory=list, description="""Metadata related to optophysiology.""") + + +class NWBFileGeneralSourceScript(ConfiguredBaseModel): + """ + Script file or link to public source code used to create this NWB file. + """ + name:Literal["source_script"]= Field("source_script") + file_name:Optional[str]= Field(None, description="""Name of script file.""") + value:str= Field(...) + + +class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): + """ + Metadata related to extracellular electrophysiology. + """ + name:Literal["extracellular_ephys"]= Field("extracellular_ephys") + electrode_group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Physical group of electrodes.""") + electrodes:Optional[DynamicTable]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""") + + +class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): + """ + Metadata related to intracellular electrophysiology. + """ + name:Literal["intracellular_ephys"]= Field("intracellular_ephys") + filtering:Optional[str]= Field(None, description="""[DEPRECATED] Use IntracellularElectrode.filtering instead. Description of filtering used. Includes filtering type and parameters, frequency fall-off, etc. If this changes between TimeSeries, filter description should be stored as a text attribute for each TimeSeries.""") + intracellular_electrode:Optional[List[IntracellularElectrode]]= Field(default_factory=list, description="""An intracellular electrode.""") + sweep_table:Optional[SweepTable]= Field(None, description="""[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions tables provide enhanced support for experiment metadata.""") + intracellular_recordings:Optional[IntracellularRecordingsTable]= Field(None, description="""A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response are recorded as as part of an experiment. In this case both, the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.""") + simultaneous_recordings:Optional[SimultaneousRecordingsTable]= Field(None, description="""A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes""") + sequential_recordings:Optional[SequentialRecordingsTable]= Field(None, description="""A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where the a sequence of stimuli of the same type with varying parameters have been presented in a sequence.""") + repetitions:Optional[RepetitionsTable]= Field(None, description="""A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.""") + experimental_conditions:Optional[ExperimentalConditionsTable]= Field(None, description="""A table for grouping different intracellular recording repetitions together that belong to the same experimental experimental_conditions.""") + + +class NWBFileIntervals(ConfiguredBaseModel): + """ + Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data. + """ + name:Literal["intervals"]= Field("intervals") + epochs:Optional[TimeIntervals]= Field(None, description="""Divisions in time marking experimental stages or sub-divisions of a single recording session.""") + trials:Optional[TimeIntervals]= Field(None, description="""Repeated experimental events that have a logical grouping.""") + invalid_times:Optional[TimeIntervals]= Field(None, description="""Time intervals that should be removed from analysis.""") + time_intervals:Optional[List[TimeIntervals]]= Field(default_factory=list, description="""Optional additional table(s) for describing other experimental time intervals.""") class LabMetaData(NWBContainer): """ Lab-specific meta-data. """ - name: str = Field(...) + name:str= Field(...) class Subject(NWBContainer): """ Information about the animal or person from which the data was measured. """ - name: str = Field(...) - age: Optional[SubjectAge] = Field(None, description="""Age of subject. Can be supplied instead of 'date_of_birth'.""") - date_of_birth: Optional[datetime ] = Field(None, description="""Date of birth of subject. Can be supplied instead of 'age'.""") - description: Optional[str] = Field(None, description="""Description of subject and where subject came from (e.g., breeder, if animal).""") - genotype: Optional[str] = Field(None, description="""Genetic strain. If absent, assume Wild Type (WT).""") - sex: Optional[str] = Field(None, description="""Gender of subject.""") - species: Optional[str] = Field(None, description="""Species of subject.""") - strain: Optional[str] = Field(None, description="""Strain of subject.""") - subject_id: Optional[str] = Field(None, description="""ID of animal/person used/participating in experiment (lab convention).""") - weight: Optional[str] = Field(None, description="""Weight at time of experiment, at time of surgery and at other important times.""") + name:str= Field(...) + age:Optional[SubjectAge]= Field(None, description="""Age of subject. Can be supplied instead of 'date_of_birth'.""") + date_of_birth:Optional[datetime ]= Field(None, description="""Date of birth of subject. Can be supplied instead of 'age'.""") + description:Optional[str]= Field(None, description="""Description of subject and where subject came from (e.g., breeder, if animal).""") + genotype:Optional[str]= Field(None, description="""Genetic strain. If absent, assume Wild Type (WT).""") + sex:Optional[str]= Field(None, description="""Gender of subject.""") + species:Optional[str]= Field(None, description="""Species of subject.""") + strain:Optional[str]= Field(None, description="""Strain of subject.""") + subject_id:Optional[str]= Field(None, description="""ID of animal/person used/participating in experiment (lab convention).""") + weight:Optional[str]= Field(None, description="""Weight at time of experiment, at time of surgery and at other important times.""") + + +class SubjectAge(ConfiguredBaseModel): + """ + Age of subject. Can be supplied instead of 'date_of_birth'. + """ + name:Literal["age"]= Field("age") + reference:Optional[str]= Field(None, description="""Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.""") + value:str= Field(...) @@ -103,6 +220,13 @@ class Subject(NWBContainer): # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model ScratchData.model_rebuild() NWBFile.model_rebuild() +NWBFileStimulus.model_rebuild() +NWBFileGeneral.model_rebuild() +NWBFileGeneralSourceScript.model_rebuild() +NWBFileGeneralExtracellularEphys.model_rebuild() +NWBFileGeneralIntracellularEphys.model_rebuild() +NWBFileIntervals.model_rebuild() LabMetaData.model_rebuild() Subject.model_rebuild() +SubjectAge.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_file_include.py b/nwb_linkml/models/core_nwb_file_include.py deleted file mode 100644 index 09c121a..0000000 --- a/nwb_linkml/models/core_nwb_file_include.py +++ /dev/null @@ -1,171 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .core_nwb_base import ( - TimeSeries, - Images -) - -from .core_nwb_icephys import ( - ExperimentalConditionsTable, - SweepTable, - IntracellularElectrode, - SequentialRecordingsTable, - RepetitionsTable, - SimultaneousRecordingsTable, - IntracellularRecordingsTable -) - -from .core_nwb_ogen import ( - OptogeneticStimulusSite -) - -from .core_nwb_epoch import ( - TimeIntervals -) - -from .core_nwb_file import ( - LabMetaData, - Subject -) - -from .hdmf_common_table import ( - DynamicTable -) - -from .core_nwb_device import ( - Device -) - -from .core_nwb_ecephys import ( - ElectrodeGroup -) - -from .core_nwb_ophys import ( - ImagingPlane -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class NWBFileStimulus(ConfiguredBaseModel): - """ - Data pushed into the system (eg, video stimulus, sound, voltage, etc) and secondary representations of that data (eg, measurements of something used as a stimulus). This group should be made read-only after experiment complete and timestamps are corrected to common timebase. Stores both presented stimuli and stimulus templates, the latter in case the same stimulus is presented multiple times, or is pulled from an external stimulus library. Stimuli are here defined as any signal that is pushed into the system as part of the experiment (eg, sound, video, voltage, etc). Many different experiments can use the same stimuli, and stimuli can be re-used during an experiment. The stimulus group is organized so that one version of template stimuli can be stored and these be used multiple times. These templates can exist in the present file or can be linked to a remote library file. - """ - name: str = Field("stimulus", const=True) - presentation: Optional[List[TimeSeries]] = Field(default_factory=list, description="""Stimuli presented during the experiment.""") - templates: Optional[List[Union[Images, TimeSeries]]] = Field(default_factory=list, description="""Template stimuli. Timestamps in templates are based on stimulus design and are relative to the beginning of the stimulus. When templates are used, the stimulus instances must convert presentation times to the experiment`s time reference frame.""") - - -class NWBFileGeneral(ConfiguredBaseModel): - """ - Experimental metadata, including protocol, notes and description of hardware device(s). The metadata stored in this section should be used to describe the experiment. Metadata necessary for interpreting the data is stored with the data. General experimental metadata, including animal strain, experimental protocols, experimenter, devices, etc, are stored under 'general'. Core metadata (e.g., that required to interpret data fields) is stored with the data itself, and implicitly defined by the file specification (e.g., time is in seconds). The strategy used here for storing non-core metadata is to use free-form text fields, such as would appear in sentences or paragraphs from a Methods section. Metadata fields are text to enable them to be more general, for example to represent ranges instead of numerical values. Machine-readable metadata is stored as attributes to these free-form datasets. All entries in the below table are to be included when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology experiment) should not be created unless there is data to store within them. - """ - name: str = Field("general", const=True) - data_collection: Optional[str] = Field(None, description="""Notes about data collection and analysis.""") - experiment_description: Optional[str] = Field(None, description="""General description of the experiment.""") - experimenter: Optional[List[str]] = Field(default_factory=list, description="""Name of person(s) who performed the experiment. Can also specify roles of different people involved.""") - institution: Optional[str] = Field(None, description="""Institution(s) where experiment was performed.""") - keywords: Optional[List[str]] = Field(default_factory=list, description="""Terms to search over.""") - lab: Optional[str] = Field(None, description="""Laboratory where experiment was performed.""") - notes: Optional[str] = Field(None, description="""Notes about the experiment.""") - pharmacology: Optional[str] = Field(None, description="""Description of drugs used, including how and when they were administered. Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc.""") - protocol: Optional[str] = Field(None, description="""Experimental protocol, if applicable. e.g., include IACUC protocol number.""") - related_publications: Optional[List[str]] = Field(default_factory=list, description="""Publication information. PMID, DOI, URL, etc.""") - session_id: Optional[str] = Field(None, description="""Lab-specific ID for the session.""") - slices: Optional[str] = Field(None, description="""Description of slices, including information about preparation thickness, orientation, temperature, and bath solution.""") - source_script: Optional[NWBFileGeneralSourceScript] = Field(None, description="""Script file or link to public source code used to create this NWB file.""") - stimulus: Optional[str] = Field(None, description="""Notes about stimuli, such as how and where they were presented.""") - surgery: Optional[str] = Field(None, description="""Narrative description about surgery/surgeries, including date(s) and who performed surgery.""") - virus: Optional[str] = Field(None, description="""Information about virus(es) used in experiments, including virus ID, source, date made, injection location, volume, etc.""") - lab_meta_data: Optional[List[LabMetaData]] = Field(default_factory=list, description="""Place-holder than can be extended so that lab-specific meta-data can be placed in /general.""") - devices: Optional[List[Device]] = Field(default_factory=list, description="""Description of hardware devices used during experiment, e.g., monitors, ADC boards, microscopes, etc.""") - subject: Optional[Subject] = Field(None, description="""Information about the animal or person from which the data was measured.""") - extracellular_ephys: Optional[NWBFileGeneralExtracellularEphys] = Field(None, description="""Metadata related to extracellular electrophysiology.""") - intracellular_ephys: Optional[NWBFileGeneralIntracellularEphys] = Field(None, description="""Metadata related to intracellular electrophysiology.""") - optogenetics: Optional[List[OptogeneticStimulusSite]] = Field(default_factory=list, description="""Metadata describing optogenetic stimuluation.""") - optophysiology: Optional[List[ImagingPlane]] = Field(default_factory=list, description="""Metadata related to optophysiology.""") - - -class NWBFileGeneralSourceScript(ConfiguredBaseModel): - """ - Script file or link to public source code used to create this NWB file. - """ - name: str = Field("source_script", const=True) - file_name: Optional[str] = Field(None, description="""Name of script file.""") - - -class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): - """ - Metadata related to extracellular electrophysiology. - """ - name: str = Field("extracellular_ephys", const=True) - electrode_group: Optional[List[ElectrodeGroup]] = Field(default_factory=list, description="""Physical group of electrodes.""") - electrodes: Optional[DynamicTable] = Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""") - - -class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): - """ - Metadata related to intracellular electrophysiology. - """ - name: str = Field("intracellular_ephys", const=True) - filtering: Optional[str] = Field(None, description="""[DEPRECATED] Use IntracellularElectrode.filtering instead. Description of filtering used. Includes filtering type and parameters, frequency fall-off, etc. If this changes between TimeSeries, filter description should be stored as a text attribute for each TimeSeries.""") - intracellular_electrode: Optional[List[IntracellularElectrode]] = Field(default_factory=list, description="""An intracellular electrode.""") - sweep_table: Optional[SweepTable] = Field(None, description="""[DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions tables provide enhanced support for experiment metadata.""") - intracellular_recordings: Optional[IntracellularRecordingsTable] = Field(None, description="""A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response are recorded as as part of an experiment. In this case both, the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used.""") - simultaneous_recordings: Optional[SimultaneousRecordingsTable] = Field(None, description="""A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes""") - sequential_recordings: Optional[SequentialRecordingsTable] = Field(None, description="""A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where the a sequence of stimuli of the same type with varying parameters have been presented in a sequence.""") - repetitions: Optional[RepetitionsTable] = Field(None, description="""A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence.""") - experimental_conditions: Optional[ExperimentalConditionsTable] = Field(None, description="""A table for grouping different intracellular recording repetitions together that belong to the same experimental experimental_conditions.""") - - -class NWBFileIntervals(ConfiguredBaseModel): - """ - Experimental intervals, whether that be logically distinct sub-experiments having a particular scientific goal, trials (see trials subgroup) during an experiment, or epochs (see epochs subgroup) deriving from analysis of data. - """ - name: str = Field("intervals", const=True) - epochs: Optional[TimeIntervals] = Field(None, description="""Divisions in time marking experimental stages or sub-divisions of a single recording session.""") - trials: Optional[TimeIntervals] = Field(None, description="""Repeated experimental events that have a logical grouping.""") - invalid_times: Optional[TimeIntervals] = Field(None, description="""Time intervals that should be removed from analysis.""") - time_intervals: Optional[List[TimeIntervals]] = Field(default_factory=list, description="""Optional additional table(s) for describing other experimental time intervals.""") - - -class SubjectAge(ConfiguredBaseModel): - """ - Age of subject. Can be supplied instead of 'date_of_birth'. - """ - name: str = Field("age", const=True) - reference: Optional[str] = Field(None, description="""Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.""") - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -NWBFileStimulus.model_rebuild() -NWBFileGeneral.model_rebuild() -NWBFileGeneralSourceScript.model_rebuild() -NWBFileGeneralExtracellularEphys.model_rebuild() -NWBFileGeneralIntracellularEphys.model_rebuild() -NWBFileIntervals.model_rebuild() -SubjectAge.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_icephys.py b/nwb_linkml/models/core_nwb_icephys.py index 7f5bff8..e344c2d 100644 --- a/nwb_linkml/models/core_nwb_icephys.py +++ b/nwb_linkml/models/core_nwb_icephys.py @@ -12,38 +12,19 @@ else: from .core_nwb_base import ( - TimeSeries, - NWBContainer -) - -from .core_nwb_icephys_include import ( - VoltageClampSeriesCapacitanceSlow, - ExperimentalConditionsTableRepetitions, - VoltageClampStimulusSeriesData, - ExperimentalConditionsTableRepetitionsIndex, - VoltageClampSeriesResistanceCompPrediction, - VoltageClampSeriesWholeCellSeriesResistanceComp, - SequentialRecordingsTableSimultaneousRecordings, - VoltageClampSeriesCapacitanceFast, - RepetitionsTableSequentialRecordingsIndex, - IntracellularStimuliTableStimulus, - VoltageClampSeriesResistanceCompCorrection, - SequentialRecordingsTableSimultaneousRecordingsIndex, - SimultaneousRecordingsTableRecordings, - IntracellularResponsesTableResponse, - VoltageClampSeriesResistanceCompBandwidth, - CurrentClampSeriesData, - SimultaneousRecordingsTableRecordingsIndex, - VoltageClampSeriesData, - RepetitionsTableSequentialRecordings, - VoltageClampSeriesWholeCellCapacitanceComp, - CurrentClampStimulusSeriesData, - SweepTableSeriesIndex + TimeSeriesStartingTime, + NWBContainer, + TimeSeriesReferenceVectorData, + TimeSeriesSync, + TimeSeries ) from .hdmf_common_table import ( + AlignedDynamicTable, + VectorIndex, DynamicTable, - AlignedDynamicTable + VectorData, + DynamicTableRegion ) @@ -63,255 +44,517 @@ class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - name: str = Field(...) - stimulus_description: Optional[str] = Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - data: List[float] = Field(default_factory=list, description="""Recorded voltage or current.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + stimulus_description:Optional[str]= Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + data:List[float]= Field(default_factory=list, description="""Recorded voltage or current.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class CurrentClampSeries(PatchClampSeries): """ Voltage data from an intracellular current-clamp recording. A corresponding CurrentClampStimulusSeries (stored separately as a stimulus) is used to store the current injected. """ - name: str = Field(...) - data: CurrentClampSeriesData = Field(..., description="""Recorded voltage.""") - bias_current: Optional[float] = Field(None, description="""Bias current, in amps.""") - bridge_balance: Optional[float] = Field(None, description="""Bridge balance, in ohms.""") - capacitance_compensation: Optional[float] = Field(None, description="""Capacitance compensation, in farads.""") - stimulus_description: Optional[str] = Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:CurrentClampSeriesData= Field(..., description="""Recorded voltage.""") + bias_current:Optional[float]= Field(None, description="""Bias current, in amps.""") + bridge_balance:Optional[float]= Field(None, description="""Bridge balance, in ohms.""") + capacitance_compensation:Optional[float]= Field(None, description="""Capacitance compensation, in farads.""") + stimulus_description:Optional[str]= Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class CurrentClampSeriesData(ConfiguredBaseModel): + """ + Recorded voltage. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + value:Any= Field(...) class IZeroClampSeries(CurrentClampSeries): """ Voltage data from an intracellular recording when all current and amplifier settings are off (i.e., CurrentClampSeries fields will be zero). There is no CurrentClampStimulusSeries associated with an IZero series because the amplifier is disconnected and no stimulus can reach the cell. """ - name: str = Field(...) - stimulus_description: Optional[str] = Field(None, description="""An IZeroClampSeries has no stimulus, so this attribute is automatically set to \"N/A\"""") - bias_current: float = Field(..., description="""Bias current, in amps, fixed to 0.0.""") - bridge_balance: float = Field(..., description="""Bridge balance, in ohms, fixed to 0.0.""") - capacitance_compensation: float = Field(..., description="""Capacitance compensation, in farads, fixed to 0.0.""") - data: CurrentClampSeriesData = Field(..., description="""Recorded voltage.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + stimulus_description:Optional[str]= Field(None, description="""An IZeroClampSeries has no stimulus, so this attribute is automatically set to \"N/A\"""") + bias_current:float= Field(..., description="""Bias current, in amps, fixed to 0.0.""") + bridge_balance:float= Field(..., description="""Bridge balance, in ohms, fixed to 0.0.""") + capacitance_compensation:float= Field(..., description="""Capacitance compensation, in farads, fixed to 0.0.""") + data:CurrentClampSeriesData= Field(..., description="""Recorded voltage.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class CurrentClampStimulusSeries(PatchClampSeries): """ Stimulus current applied during current clamp recording. """ - name: str = Field(...) - data: CurrentClampStimulusSeriesData = Field(..., description="""Stimulus current applied.""") - stimulus_description: Optional[str] = Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:CurrentClampStimulusSeriesData= Field(..., description="""Stimulus current applied.""") + stimulus_description:Optional[str]= Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class CurrentClampStimulusSeriesData(ConfiguredBaseModel): + """ + Stimulus current applied. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + value:Any= Field(...) class VoltageClampSeries(PatchClampSeries): """ Current data from an intracellular voltage-clamp recording. A corresponding VoltageClampStimulusSeries (stored separately as a stimulus) is used to store the voltage injected. """ - name: str = Field(...) - data: VoltageClampSeriesData = Field(..., description="""Recorded current.""") - capacitance_fast: Optional[VoltageClampSeriesCapacitanceFast] = Field(None, description="""Fast capacitance, in farads.""") - capacitance_slow: Optional[VoltageClampSeriesCapacitanceSlow] = Field(None, description="""Slow capacitance, in farads.""") - resistance_comp_bandwidth: Optional[VoltageClampSeriesResistanceCompBandwidth] = Field(None, description="""Resistance compensation bandwidth, in hertz.""") - resistance_comp_correction: Optional[VoltageClampSeriesResistanceCompCorrection] = Field(None, description="""Resistance compensation correction, in percent.""") - resistance_comp_prediction: Optional[VoltageClampSeriesResistanceCompPrediction] = Field(None, description="""Resistance compensation prediction, in percent.""") - whole_cell_capacitance_comp: Optional[VoltageClampSeriesWholeCellCapacitanceComp] = Field(None, description="""Whole cell capacitance compensation, in farads.""") - whole_cell_series_resistance_comp: Optional[VoltageClampSeriesWholeCellSeriesResistanceComp] = Field(None, description="""Whole cell series resistance compensation, in ohms.""") - stimulus_description: Optional[str] = Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:VoltageClampSeriesData= Field(..., description="""Recorded current.""") + capacitance_fast:Optional[VoltageClampSeriesCapacitanceFast]= Field(None, description="""Fast capacitance, in farads.""") + capacitance_slow:Optional[VoltageClampSeriesCapacitanceSlow]= Field(None, description="""Slow capacitance, in farads.""") + resistance_comp_bandwidth:Optional[VoltageClampSeriesResistanceCompBandwidth]= Field(None, description="""Resistance compensation bandwidth, in hertz.""") + resistance_comp_correction:Optional[VoltageClampSeriesResistanceCompCorrection]= Field(None, description="""Resistance compensation correction, in percent.""") + resistance_comp_prediction:Optional[VoltageClampSeriesResistanceCompPrediction]= Field(None, description="""Resistance compensation prediction, in percent.""") + whole_cell_capacitance_comp:Optional[VoltageClampSeriesWholeCellCapacitanceComp]= Field(None, description="""Whole cell capacitance compensation, in farads.""") + whole_cell_series_resistance_comp:Optional[VoltageClampSeriesWholeCellSeriesResistanceComp]= Field(None, description="""Whole cell series resistance compensation, in ohms.""") + stimulus_description:Optional[str]= Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class VoltageClampSeriesData(ConfiguredBaseModel): + """ + Recorded current. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + value:Any= Field(...) + + +class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): + """ + Fast capacitance, in farads. + """ + name:Literal["capacitance_fast"]= Field("capacitance_fast") + unit:Optional[str]= Field(None, description="""Unit of measurement for capacitance_fast, which is fixed to 'farads'.""") + value:float= Field(...) + + +class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): + """ + Slow capacitance, in farads. + """ + name:Literal["capacitance_slow"]= Field("capacitance_slow") + unit:Optional[str]= Field(None, description="""Unit of measurement for capacitance_fast, which is fixed to 'farads'.""") + value:float= Field(...) + + +class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): + """ + Resistance compensation bandwidth, in hertz. + """ + name:Literal["resistance_comp_bandwidth"]= Field("resistance_comp_bandwidth") + unit:Optional[str]= Field(None, description="""Unit of measurement for resistance_comp_bandwidth, which is fixed to 'hertz'.""") + value:float= Field(...) + + +class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): + """ + Resistance compensation correction, in percent. + """ + name:Literal["resistance_comp_correction"]= Field("resistance_comp_correction") + unit:Optional[str]= Field(None, description="""Unit of measurement for resistance_comp_correction, which is fixed to 'percent'.""") + value:float= Field(...) + + +class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): + """ + Resistance compensation prediction, in percent. + """ + name:Literal["resistance_comp_prediction"]= Field("resistance_comp_prediction") + unit:Optional[str]= Field(None, description="""Unit of measurement for resistance_comp_prediction, which is fixed to 'percent'.""") + value:float= Field(...) + + +class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): + """ + Whole cell capacitance compensation, in farads. + """ + name:Literal["whole_cell_capacitance_comp"]= Field("whole_cell_capacitance_comp") + unit:Optional[str]= Field(None, description="""Unit of measurement for whole_cell_capacitance_comp, which is fixed to 'farads'.""") + value:float= Field(...) + + +class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): + """ + Whole cell series resistance compensation, in ohms. + """ + name:Literal["whole_cell_series_resistance_comp"]= Field("whole_cell_series_resistance_comp") + unit:Optional[str]= Field(None, description="""Unit of measurement for whole_cell_series_resistance_comp, which is fixed to 'ohms'.""") + value:float= Field(...) class VoltageClampStimulusSeries(PatchClampSeries): """ Stimulus voltage applied during a voltage clamp recording. """ - name: str = Field(...) - data: VoltageClampStimulusSeriesData = Field(..., description="""Stimulus voltage applied.""") - stimulus_description: Optional[str] = Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") - sweep_number: Optional[int] = Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") - gain: Optional[float] = Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:VoltageClampStimulusSeriesData= Field(..., description="""Stimulus voltage applied.""") + stimulus_description:Optional[str]= Field(None, description="""Protocol/stimulus name for this patch-clamp dataset.""") + sweep_number:Optional[int]= Field(None, description="""Sweep number, allows to group different PatchClampSeries together.""") + gain:Optional[float]= Field(None, description="""Gain of the recording, in units Volt/Amp (v-clamp) or Volt/Volt (c-clamp).""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class VoltageClampStimulusSeriesData(ConfiguredBaseModel): + """ + Stimulus voltage applied. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") + value:Any= Field(...) class IntracellularElectrode(NWBContainer): """ An intracellular electrode and its metadata. """ - name: str = Field(...) - cell_id: Optional[str] = Field(None, description="""unique ID of the cell""") - description: str = Field(..., description="""Description of electrode (e.g., whole-cell, sharp, etc.).""") - filtering: Optional[str] = Field(None, description="""Electrode specific filtering.""") - initial_access_resistance: Optional[str] = Field(None, description="""Initial access resistance.""") - location: Optional[str] = Field(None, description="""Location of the electrode. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") - resistance: Optional[str] = Field(None, description="""Electrode resistance, in ohms.""") - seal: Optional[str] = Field(None, description="""Information about seal used for recording.""") - slice: Optional[str] = Field(None, description="""Information about slice used for recording.""") + name:str= Field(...) + cell_id:Optional[str]= Field(None, description="""unique ID of the cell""") + description:str= Field(..., description="""Description of electrode (e.g., whole-cell, sharp, etc.).""") + filtering:Optional[str]= Field(None, description="""Electrode specific filtering.""") + initial_access_resistance:Optional[str]= Field(None, description="""Initial access resistance.""") + location:Optional[str]= Field(None, description="""Location of the electrode. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") + resistance:Optional[str]= Field(None, description="""Electrode resistance, in ohms.""") + seal:Optional[str]= Field(None, description="""Information about seal used for recording.""") + slice:Optional[str]= Field(None, description="""Information about slice used for recording.""") class SweepTable(DynamicTable): """ [DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata. """ - name: str = Field(...) - sweep_number: Optional[List[int]] = Field(default_factory=list, description="""Sweep number of the PatchClampSeries in that row.""") - series: Optional[List[PatchClampSeries]] = Field(default_factory=list, description="""The PatchClampSeries with the sweep number in that row.""") - series_index: SweepTableSeriesIndex = Field(..., description="""Index for series.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + sweep_number:Optional[List[int]]= Field(default_factory=list, description="""Sweep number of the PatchClampSeries in that row.""") + series:Optional[List[PatchClampSeries]]= Field(default_factory=list, description="""The PatchClampSeries with the sweep number in that row.""") + series_index:SweepTableSeriesIndex= Field(..., description="""Index for series.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class SweepTableSeriesIndex(VectorIndex): + """ + Index for series. + """ + name:Literal["series_index"]= Field("series_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class IntracellularElectrodesTable(DynamicTable): """ Table for storing intracellular electrode related metadata. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - electrode: Optional[List[IntracellularElectrode]] = Field(default_factory=list, description="""Column for storing the reference to the intracellular electrode.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + electrode:Optional[List[IntracellularElectrode]]= Field(default_factory=list, description="""Column for storing the reference to the intracellular electrode.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") class IntracellularStimuliTable(DynamicTable): """ Table for storing intracellular stimulus related metadata. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - stimulus: IntracellularStimuliTableStimulus = Field(..., description="""Column storing the reference to the recorded stimulus for the recording (rows).""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + stimulus:IntracellularStimuliTableStimulus= Field(..., description="""Column storing the reference to the recorded stimulus for the recording (rows).""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): + """ + Column storing the reference to the recorded stimulus for the recording (rows). + """ + name:Literal["stimulus"]= Field("stimulus") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class IntracellularResponsesTable(DynamicTable): """ Table for storing intracellular response related metadata. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - response: IntracellularResponsesTableResponse = Field(..., description="""Column storing the reference to the recorded response for the recording (rows)""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + response:IntracellularResponsesTableResponse= Field(..., description="""Column storing the reference to the recorded response for the recording (rows)""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): + """ + Column storing the reference to the recorded response for the recording (rows) + """ + name:Literal["response"]= Field("response") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class IntracellularRecordingsTable(AlignedDynamicTable): """ A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used. """ - name: str = Field("intracellular_recordings", const=True) - description: Optional[str] = Field(None, description="""Description of the contents of this table. Inherited from AlignedDynamicTable and overwritten here to fix the value of the attribute.""") - electrodes: IntracellularElectrodesTable = Field(..., description="""Table for storing intracellular electrode related metadata.""") - stimuli: IntracellularStimuliTable = Field(..., description="""Table for storing intracellular stimulus related metadata.""") - responses: IntracellularResponsesTable = Field(..., description="""Table for storing intracellular response related metadata.""") - categories: Optional[str] = Field(None, description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""") - dynamic_table: Optional[List[DynamicTable]] = Field(default_factory=list, description="""A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:Literal["intracellular_recordings"]= Field("intracellular_recordings") + description:Optional[str]= Field(None, description="""Description of the contents of this table. Inherited from AlignedDynamicTable and overwritten here to fix the value of the attribute.""") + electrodes:IntracellularElectrodesTable= Field(..., description="""Table for storing intracellular electrode related metadata.""") + stimuli:IntracellularStimuliTable= Field(..., description="""Table for storing intracellular stimulus related metadata.""") + responses:IntracellularResponsesTable= Field(..., description="""Table for storing intracellular response related metadata.""") + categories:Optional[str]= Field(None, description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""") + dynamic_table:Optional[List[DynamicTable]]= Field(default_factory=list, description="""A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") class SimultaneousRecordingsTable(DynamicTable): """ A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes. """ - name: str = Field("simultaneous_recordings", const=True) - recordings: SimultaneousRecordingsTableRecordings = Field(..., description="""A reference to one or more rows in the IntracellularRecordingsTable table.""") - recordings_index: SimultaneousRecordingsTableRecordingsIndex = Field(..., description="""Index dataset for the recordings column.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:Literal["simultaneous_recordings"]= Field("simultaneous_recordings") + recordings:SimultaneousRecordingsTableRecordings= Field(..., description="""A reference to one or more rows in the IntracellularRecordingsTable table.""") + recordings_index:SimultaneousRecordingsTableRecordingsIndex= Field(..., description="""Index dataset for the recordings column.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class SimultaneousRecordingsTableRecordings(DynamicTableRegion): + """ + A reference to one or more rows in the IntracellularRecordingsTable table. + """ + name:Literal["recordings"]= Field("recordings") + table:Optional[IntracellularRecordingsTable]= Field(None, description="""Reference to the IntracellularRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): + """ + Index dataset for the recordings column. + """ + name:Literal["recordings_index"]= Field("recordings_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class SequentialRecordingsTable(DynamicTable): """ A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence. """ - name: str = Field("sequential_recordings", const=True) - simultaneous_recordings: SequentialRecordingsTableSimultaneousRecordings = Field(..., description="""A reference to one or more rows in the SimultaneousRecordingsTable table.""") - simultaneous_recordings_index: SequentialRecordingsTableSimultaneousRecordingsIndex = Field(..., description="""Index dataset for the simultaneous_recordings column.""") - stimulus_type: Optional[List[str]] = Field(default_factory=list, description="""The type of stimulus used for the sequential recording.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:Literal["sequential_recordings"]= Field("sequential_recordings") + simultaneous_recordings:SequentialRecordingsTableSimultaneousRecordings= Field(..., description="""A reference to one or more rows in the SimultaneousRecordingsTable table.""") + simultaneous_recordings_index:SequentialRecordingsTableSimultaneousRecordingsIndex= Field(..., description="""Index dataset for the simultaneous_recordings column.""") + stimulus_type:Optional[List[str]]= Field(default_factory=list, description="""The type of stimulus used for the sequential recording.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): + """ + A reference to one or more rows in the SimultaneousRecordingsTable table. + """ + name:Literal["simultaneous_recordings"]= Field("simultaneous_recordings") + table:Optional[SimultaneousRecordingsTable]= Field(None, description="""Reference to the SimultaneousRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): + """ + Index dataset for the simultaneous_recordings column. + """ + name:Literal["simultaneous_recordings_index"]= Field("simultaneous_recordings_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class RepetitionsTable(DynamicTable): """ A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence. """ - name: str = Field("repetitions", const=True) - sequential_recordings: RepetitionsTableSequentialRecordings = Field(..., description="""A reference to one or more rows in the SequentialRecordingsTable table.""") - sequential_recordings_index: RepetitionsTableSequentialRecordingsIndex = Field(..., description="""Index dataset for the sequential_recordings column.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:Literal["repetitions"]= Field("repetitions") + sequential_recordings:RepetitionsTableSequentialRecordings= Field(..., description="""A reference to one or more rows in the SequentialRecordingsTable table.""") + sequential_recordings_index:RepetitionsTableSequentialRecordingsIndex= Field(..., description="""Index dataset for the sequential_recordings column.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class RepetitionsTableSequentialRecordings(DynamicTableRegion): + """ + A reference to one or more rows in the SequentialRecordingsTable table. + """ + name:Literal["sequential_recordings"]= Field("sequential_recordings") + table:Optional[SequentialRecordingsTable]= Field(None, description="""Reference to the SequentialRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class RepetitionsTableSequentialRecordingsIndex(VectorIndex): + """ + Index dataset for the sequential_recordings column. + """ + name:Literal["sequential_recordings_index"]= Field("sequential_recordings_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class ExperimentalConditionsTable(DynamicTable): """ A table for grouping different intracellular recording repetitions together that belong to the same experimental condition. """ - name: str = Field("experimental_conditions", const=True) - repetitions: ExperimentalConditionsTableRepetitions = Field(..., description="""A reference to one or more rows in the RepetitionsTable table.""") - repetitions_index: ExperimentalConditionsTableRepetitionsIndex = Field(..., description="""Index dataset for the repetitions column.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:Literal["experimental_conditions"]= Field("experimental_conditions") + repetitions:ExperimentalConditionsTableRepetitions= Field(..., description="""A reference to one or more rows in the RepetitionsTable table.""") + repetitions_index:ExperimentalConditionsTableRepetitionsIndex= Field(..., description="""Index dataset for the repetitions column.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class ExperimentalConditionsTableRepetitions(DynamicTableRegion): + """ + A reference to one or more rows in the RepetitionsTable table. + """ + name:Literal["repetitions"]= Field("repetitions") + table:Optional[RepetitionsTable]= Field(None, description="""Reference to the RepetitionsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): + """ + Index dataset for the repetitions column. + """ + name:Literal["repetitions_index"]= Field("repetitions_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) @@ -319,18 +562,40 @@ class ExperimentalConditionsTable(DynamicTable): # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model PatchClampSeries.model_rebuild() CurrentClampSeries.model_rebuild() +CurrentClampSeriesData.model_rebuild() IZeroClampSeries.model_rebuild() CurrentClampStimulusSeries.model_rebuild() +CurrentClampStimulusSeriesData.model_rebuild() VoltageClampSeries.model_rebuild() +VoltageClampSeriesData.model_rebuild() +VoltageClampSeriesCapacitanceFast.model_rebuild() +VoltageClampSeriesCapacitanceSlow.model_rebuild() +VoltageClampSeriesResistanceCompBandwidth.model_rebuild() +VoltageClampSeriesResistanceCompCorrection.model_rebuild() +VoltageClampSeriesResistanceCompPrediction.model_rebuild() +VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() +VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() VoltageClampStimulusSeries.model_rebuild() +VoltageClampStimulusSeriesData.model_rebuild() IntracellularElectrode.model_rebuild() SweepTable.model_rebuild() +SweepTableSeriesIndex.model_rebuild() IntracellularElectrodesTable.model_rebuild() IntracellularStimuliTable.model_rebuild() +IntracellularStimuliTableStimulus.model_rebuild() IntracellularResponsesTable.model_rebuild() +IntracellularResponsesTableResponse.model_rebuild() IntracellularRecordingsTable.model_rebuild() SimultaneousRecordingsTable.model_rebuild() +SimultaneousRecordingsTableRecordings.model_rebuild() +SimultaneousRecordingsTableRecordingsIndex.model_rebuild() SequentialRecordingsTable.model_rebuild() +SequentialRecordingsTableSimultaneousRecordings.model_rebuild() +SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() RepetitionsTable.model_rebuild() +RepetitionsTableSequentialRecordings.model_rebuild() +RepetitionsTableSequentialRecordingsIndex.model_rebuild() ExperimentalConditionsTable.model_rebuild() +ExperimentalConditionsTableRepetitions.model_rebuild() +ExperimentalConditionsTableRepetitionsIndex.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_icephys_include.py b/nwb_linkml/models/core_nwb_icephys_include.py deleted file mode 100644 index d6eedd3..0000000 --- a/nwb_linkml/models/core_nwb_icephys_include.py +++ /dev/null @@ -1,319 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .hdmf_common_table import ( - DynamicTableRegion, - VectorIndex -) - -from .core_nwb_icephys import ( - SequentialRecordingsTable, - RepetitionsTable, - SimultaneousRecordingsTable, - IntracellularRecordingsTable -) - -from .core_nwb_base import ( - TimeSeriesReferenceVectorData -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class CurrentClampSeriesData(ConfiguredBaseModel): - """ - Recorded voltage. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - - -class CurrentClampStimulusSeriesData(ConfiguredBaseModel): - """ - Stimulus current applied. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - - -class VoltageClampSeriesData(ConfiguredBaseModel): - """ - Recorded current. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'amperes'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - - -class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): - """ - Fast capacitance, in farads. - """ - name: str = Field("capacitance_fast", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for capacitance_fast, which is fixed to 'farads'.""") - - -class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): - """ - Slow capacitance, in farads. - """ - name: str = Field("capacitance_slow", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for capacitance_fast, which is fixed to 'farads'.""") - - -class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): - """ - Resistance compensation bandwidth, in hertz. - """ - name: str = Field("resistance_comp_bandwidth", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for resistance_comp_bandwidth, which is fixed to 'hertz'.""") - - -class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): - """ - Resistance compensation correction, in percent. - """ - name: str = Field("resistance_comp_correction", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for resistance_comp_correction, which is fixed to 'percent'.""") - - -class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): - """ - Resistance compensation prediction, in percent. - """ - name: str = Field("resistance_comp_prediction", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for resistance_comp_prediction, which is fixed to 'percent'.""") - - -class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): - """ - Whole cell capacitance compensation, in farads. - """ - name: str = Field("whole_cell_capacitance_comp", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for whole_cell_capacitance_comp, which is fixed to 'farads'.""") - - -class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): - """ - Whole cell series resistance compensation, in ohms. - """ - name: str = Field("whole_cell_series_resistance_comp", const=True) - unit: Optional[str] = Field(None, description="""Unit of measurement for whole_cell_series_resistance_comp, which is fixed to 'ohms'.""") - - -class VoltageClampStimulusSeriesData(ConfiguredBaseModel): - """ - Stimulus voltage applied. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. which is fixed to 'volts'. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion' and add 'offset'.""") - - -class SweepTableSeriesIndex(VectorIndex): - """ - Index for series. - """ - name: str = Field("series_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): - """ - Column storing the reference to the recorded stimulus for the recording (rows). - """ - name: str = Field("stimulus", const=True) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): - """ - Column storing the reference to the recorded response for the recording (rows) - """ - name: str = Field("response", const=True) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class SimultaneousRecordingsTableRecordings(DynamicTableRegion): - """ - A reference to one or more rows in the IntracellularRecordingsTable table. - """ - name: str = Field("recordings", const=True) - table: Optional[IntracellularRecordingsTable] = Field(None, description="""Reference to the IntracellularRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): - """ - Index dataset for the recordings column. - """ - name: str = Field("recordings_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): - """ - A reference to one or more rows in the SimultaneousRecordingsTable table. - """ - name: str = Field("simultaneous_recordings", const=True) - table: Optional[SimultaneousRecordingsTable] = Field(None, description="""Reference to the SimultaneousRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): - """ - Index dataset for the simultaneous_recordings column. - """ - name: str = Field("simultaneous_recordings_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class RepetitionsTableSequentialRecordings(DynamicTableRegion): - """ - A reference to one or more rows in the SequentialRecordingsTable table. - """ - name: str = Field("sequential_recordings", const=True) - table: Optional[SequentialRecordingsTable] = Field(None, description="""Reference to the SequentialRecordingsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class RepetitionsTableSequentialRecordingsIndex(VectorIndex): - """ - Index dataset for the sequential_recordings column. - """ - name: str = Field("sequential_recordings_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class ExperimentalConditionsTableRepetitions(DynamicTableRegion): - """ - A reference to one or more rows in the RepetitionsTable table. - """ - name: str = Field("repetitions", const=True) - table: Optional[RepetitionsTable] = Field(None, description="""Reference to the RepetitionsTable table that this table region applies to. This specializes the attribute inherited from DynamicTableRegion to fix the type of table that can be referenced here.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): - """ - Index dataset for the repetitions column. - """ - name: str = Field("repetitions_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CurrentClampSeriesData.model_rebuild() -CurrentClampStimulusSeriesData.model_rebuild() -VoltageClampSeriesData.model_rebuild() -VoltageClampSeriesCapacitanceFast.model_rebuild() -VoltageClampSeriesCapacitanceSlow.model_rebuild() -VoltageClampSeriesResistanceCompBandwidth.model_rebuild() -VoltageClampSeriesResistanceCompCorrection.model_rebuild() -VoltageClampSeriesResistanceCompPrediction.model_rebuild() -VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() -VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() -VoltageClampStimulusSeriesData.model_rebuild() -SweepTableSeriesIndex.model_rebuild() -IntracellularStimuliTableStimulus.model_rebuild() -IntracellularResponsesTableResponse.model_rebuild() -SimultaneousRecordingsTableRecordings.model_rebuild() -SimultaneousRecordingsTableRecordingsIndex.model_rebuild() -SequentialRecordingsTableSimultaneousRecordings.model_rebuild() -SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() -RepetitionsTableSequentialRecordings.model_rebuild() -RepetitionsTableSequentialRecordingsIndex.model_rebuild() -ExperimentalConditionsTableRepetitions.model_rebuild() -ExperimentalConditionsTableRepetitionsIndex.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_image.py b/nwb_linkml/models/core_nwb_image.py index c05d446..937e206 100644 --- a/nwb_linkml/models/core_nwb_image.py +++ b/nwb_linkml/models/core_nwb_image.py @@ -12,17 +12,10 @@ else: from .core_nwb_base import ( + TimeSeriesStartingTime, + Image, TimeSeries, - Image -) - -from .core_nwb_image_include import ( - ImageSeriesData, - RGBAImageArray, - GrayscaleImageArray, - RGBImageArray, - OpticalSeriesFieldOfView, - OpticalSeriesData + TimeSeriesSync ) @@ -42,102 +35,135 @@ class GrayscaleImage(Image): """ A grayscale image. """ - name: str = Field(...) - array: Optional[NDArray[Shape["* x, * y"], Number]] = Field(None) - resolution: Optional[float] = Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") - description: Optional[str] = Field(None, description="""Description of the image.""") + name:str= Field(...) + array:Optional[NDArray[Shape["* x, * y"], Number]]= Field(None) + resolution:Optional[float]= Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") + description:Optional[str]= Field(None, description="""Description of the image.""") class RGBImage(Image): """ A color image. """ - name: str = Field(...) - array: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], Number]] = Field(None) - resolution: Optional[float] = Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") - description: Optional[str] = Field(None, description="""Description of the image.""") + name:str= Field(...) + array:Optional[NDArray[Shape["* x, * y, 3 r_g_b"], Number]]= Field(None) + resolution:Optional[float]= Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") + description:Optional[str]= Field(None, description="""Description of the image.""") class RGBAImage(Image): """ A color image with transparency. """ - name: str = Field(...) - array: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], Number]] = Field(None) - resolution: Optional[float] = Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") - description: Optional[str] = Field(None, description="""Description of the image.""") + name:str= Field(...) + array:Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], Number]]= Field(None) + resolution:Optional[float]= Field(None, description="""Pixel resolution of the image, in pixels per centimeter.""") + description:Optional[str]= Field(None, description="""Description of the image.""") class ImageSeries(TimeSeries): """ General image data that is common between acquisition and stimulus time series. Sometimes the image data is stored in the file in a raw format while other times it will be stored as a series of external image files in the host file system. The data field will either be binary data, if the data is stored in the NWB file, or empty, if the data is stored in an external image stack. [frame][x][y] or [frame][x][y][z]. """ - name: str = Field(...) - data: ImageSeriesData = Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") - dimension: Optional[List[int]] = Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") - external_file: Optional[List[str]] = Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") - format: Optional[str] = Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:ImageSeriesData= Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") + dimension:Optional[List[int]]= Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") + external_file:Optional[List[str]]= Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") + format:Optional[str]= Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class ImageSeriesData(ConfiguredBaseModel): + """ + Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array. + """ + name:Literal["data"]= Field("data") + array:Optional[Union[ + NDArray[Shape["* frame, * x, * y"], Number], + NDArray[Shape["* frame, * x, * y, * z"], Number] + ]]= Field(None) class ImageMaskSeries(ImageSeries): """ An alpha mask that is applied to a presented visual stimulus. The 'data' array contains an array of mask values that are applied to the displayed image. Mask values are stored as RGBA. Mask can vary with time. The timestamps array indicates the starting time of a mask, and that mask pattern continues until it's explicitly changed. """ - name: str = Field(...) - data: ImageSeriesData = Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") - dimension: Optional[List[int]] = Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") - external_file: Optional[List[str]] = Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") - format: Optional[str] = Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:ImageSeriesData= Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") + dimension:Optional[List[int]]= Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") + external_file:Optional[List[str]]= Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") + format:Optional[str]= Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class OpticalSeries(ImageSeries): """ Image data that is presented or recorded. A stimulus template movie will be stored only as an image. When the image is presented as stimulus, additional data is required, such as field of view (e.g., how much of the visual field the image covers, or how what is the area of the target being imaged). If the OpticalSeries represents acquired imaging data, orientation is also important. """ - name: str = Field(...) - distance: Optional[float] = Field(None, description="""Distance from camera/monitor to target/eye.""") - field_of_view: Optional[OpticalSeriesFieldOfView] = Field(None, description="""Width, height and depth of image, or imaged area, in meters.""") - data: OpticalSeriesData = Field(..., description="""Images presented to subject, either grayscale or RGB""") - orientation: Optional[str] = Field(None, description="""Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.""") - dimension: Optional[List[int]] = Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") - external_file: Optional[List[str]] = Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") - format: Optional[str] = Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + distance:Optional[float]= Field(None, description="""Distance from camera/monitor to target/eye.""") + field_of_view:Optional[OpticalSeriesFieldOfView]= Field(None, description="""Width, height and depth of image, or imaged area, in meters.""") + data:OpticalSeriesData= Field(..., description="""Images presented to subject, either grayscale or RGB""") + orientation:Optional[str]= Field(None, description="""Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.""") + dimension:Optional[List[int]]= Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") + external_file:Optional[List[str]]= Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") + format:Optional[str]= Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class OpticalSeriesFieldOfView(ConfiguredBaseModel): + """ + Width, height and depth of image, or imaged area, in meters. + """ + name:Literal["field_of_view"]= Field("field_of_view") + array:Optional[Union[ + NDArray[Shape["2 width_height"], Float32], + NDArray[Shape["2 width_height, 3 width_height_depth"], Float32] + ]]= Field(None) + + +class OpticalSeriesData(ConfiguredBaseModel): + """ + Images presented to subject, either grayscale or RGB + """ + name:Literal["data"]= Field("data") + array:Optional[Union[ + NDArray[Shape["* frame, * x, * y"], Number], + NDArray[Shape["* frame, * x, * y, 3 r_g_b"], Number] + ]]= Field(None) class IndexSeries(TimeSeries): """ Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed. """ - name: str = Field(...) - data: List[int] = Field(default_factory=list, description="""Index of the image (using zero-indexing) in the linked Images object.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:List[int]= Field(default_factory=list, description="""Index of the image (using zero-indexing) in the linked Images object.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") @@ -147,7 +173,10 @@ GrayscaleImage.model_rebuild() RGBImage.model_rebuild() RGBAImage.model_rebuild() ImageSeries.model_rebuild() +ImageSeriesData.model_rebuild() ImageMaskSeries.model_rebuild() OpticalSeries.model_rebuild() +OpticalSeriesFieldOfView.model_rebuild() +OpticalSeriesData.model_rebuild() IndexSeries.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_image_include.py b/nwb_linkml/models/core_nwb_image_include.py deleted file mode 100644 index 2768709..0000000 --- a/nwb_linkml/models/core_nwb_image_include.py +++ /dev/null @@ -1,118 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class GrayscaleImageArray(Arraylike): - - x: float = Field(...) - y: float = Field(...) - - -class RGBImageArray(Arraylike): - - x: float = Field(...) - y: float = Field(...) - r_g_b: float = Field(...) - - -class RGBAImageArray(Arraylike): - - x: float = Field(...) - y: float = Field(...) - r_g_b_a: float = Field(...) - - -class ImageSeriesData(ConfiguredBaseModel): - """ - Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array. - """ - name: str = Field("data", const=True) - array: Optional[Union[ - NDArray[Shape["* frame, * x, * y"], Number], - NDArray[Shape["* frame, * x, * y, * z"], Number] - ]] = Field(None) - - -class ImageSeriesDataArray(Arraylike): - - frame: float = Field(...) - x: float = Field(...) - y: float = Field(...) - z: Optional[float] = Field(None) - - -class OpticalSeriesFieldOfView(ConfiguredBaseModel): - """ - Width, height and depth of image, or imaged area, in meters. - """ - name: str = Field("field_of_view", const=True) - array: Optional[Union[ - NDArray[Shape["2 width_height"], Float32], - NDArray[Shape["2 width_height, 3 width_height_depth"], Float32] - ]] = Field(None) - - -class OpticalSeriesFieldOfViewArray(Arraylike): - - width_height: Optional[float] = Field(None) - width_height_depth: Optional[float] = Field(None) - - -class OpticalSeriesData(ConfiguredBaseModel): - """ - Images presented to subject, either grayscale or RGB - """ - name: str = Field("data", const=True) - array: Optional[Union[ - NDArray[Shape["* frame, * x, * y"], Number], - NDArray[Shape["* frame, * x, * y, 3 r_g_b"], Number] - ]] = Field(None) - - -class OpticalSeriesDataArray(Arraylike): - - frame: float = Field(...) - x: float = Field(...) - y: float = Field(...) - r_g_b: Optional[float] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -GrayscaleImageArray.model_rebuild() -RGBImageArray.model_rebuild() -RGBAImageArray.model_rebuild() -ImageSeriesData.model_rebuild() -ImageSeriesDataArray.model_rebuild() -OpticalSeriesFieldOfView.model_rebuild() -OpticalSeriesFieldOfViewArray.model_rebuild() -OpticalSeriesData.model_rebuild() -OpticalSeriesDataArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_misc.py b/nwb_linkml/models/core_nwb_misc.py index be7b2f3..96414e6 100644 --- a/nwb_linkml/models/core_nwb_misc.py +++ b/nwb_linkml/models/core_nwb_misc.py @@ -11,28 +11,9 @@ else: from typing_extensions import Literal -from .hdmf_common_table import ( - DynamicTable -) - -from .core_nwb_misc_include import ( - UnitsElectrodes, - UnitsElectrodesIndex, - UnitsObsIntervalsIndex, - UnitsSpikeTimes, - UnitsSpikeTimesIndex, - UnitsWaveformSd, - UnitsWaveformMean, - UnitsWaveforms, - AbstractFeatureSeriesData, - UnitsWaveformsIndexIndex, - UnitsObsIntervals, - UnitsWaveformsIndex, - DecompositionSeriesData, - DecompositionSeriesSourceChannels -) - from .core_nwb_base import ( + TimeSeriesStartingTime, + TimeSeriesSync, TimeSeries ) @@ -40,6 +21,13 @@ from .core_nwb_ecephys import ( ElectrodeGroup ) +from .hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, + DynamicTableRegion +) + metamodel_version = "None" version = "None" @@ -57,96 +45,313 @@ class AbstractFeatureSeries(TimeSeries): """ Abstract features, such as quantitative descriptions of sensory stimuli. The TimeSeries::data field is a 2D array, storing those features (e.g., for visual grating stimulus this might be orientation, spatial frequency and contrast). Null stimuli (eg, uniform gray) can be marked as being an independent feature (eg, 1.0 for gray, 0.0 for actual stimulus) or by storing NaNs for feature values, or through use of the TimeSeries::control fields. A set of features is considered to persist until the next set of features is defined. The final set of features stored should be the null set. This is useful when storing the raw stimulus is impractical. """ - name: str = Field(...) - data: AbstractFeatureSeriesData = Field(..., description="""Values of each feature at each time.""") - feature_units: Optional[List[str]] = Field(default_factory=list, description="""Units of each feature.""") - features: List[str] = Field(default_factory=list, description="""Description of the features represented in TimeSeries::data.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:AbstractFeatureSeriesData= Field(..., description="""Values of each feature at each time.""") + feature_units:Optional[List[str]]= Field(default_factory=list, description="""Units of each feature.""") + features:List[str]= Field(default_factory=list, description="""Description of the features represented in TimeSeries::data.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class AbstractFeatureSeriesData(ConfiguredBaseModel): + """ + Values of each feature at each time. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Since there can be different units for different features, store the units in 'feature_units'. The default value for this attribute is \"see 'feature_units'\".""") + array:Optional[Union[ + NDArray[Shape["* num_times"], Number], + NDArray[Shape["* num_times, * num_features"], Number] + ]]= Field(None) class AnnotationSeries(TimeSeries): """ Stores user annotations made during an experiment. The data[] field stores a text array, and timestamps are stored for each annotation (ie, interval=1). This is largely an alias to a standard TimeSeries storing a text array but that is identifiable as storing annotations in a machine-readable way. """ - name: str = Field(...) - data: List[str] = Field(default_factory=list, description="""Annotations made during an experiment.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:List[str]= Field(default_factory=list, description="""Annotations made during an experiment.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class IntervalSeries(TimeSeries): """ Stores intervals of data. The timestamps field stores the beginning and end of intervals. The data field stores whether the interval just started (>0 value) or ended (<0 value). Different interval types can be represented in the same series by using multiple key values (eg, 1 for feature A, 2 for feature B, 3 for feature C, etc). The field data stores an 8-bit integer. This is largely an alias of a standard TimeSeries but that is identifiable as representing time intervals in a machine-readable way. """ - name: str = Field(...) - data: List[int] = Field(default_factory=list, description="""Use values >0 if interval started, <0 if interval ended.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:List[int]= Field(default_factory=list, description="""Use values >0 if interval started, <0 if interval ended.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class DecompositionSeries(TimeSeries): """ Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - name: str = Field(...) - data: DecompositionSeriesData = Field(..., description="""Data decomposed into frequency bands.""") - metric: str = Field(..., description="""The metric used, e.g. phase, amplitude, power.""") - source_channels: Optional[DecompositionSeriesSourceChannels] = Field(None, description="""DynamicTableRegion pointer to the channels that this decomposition series was generated from.""") - bands: DynamicTable = Field(..., description="""Table for describing the bands that this series was generated from. There should be one row in this table for each band.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:DecompositionSeriesData= Field(..., description="""Data decomposed into frequency bands.""") + metric:str= Field(..., description="""The metric used, e.g. phase, amplitude, power.""") + source_channels:Optional[DecompositionSeriesSourceChannels]= Field(None, description="""DynamicTableRegion pointer to the channels that this decomposition series was generated from.""") + bands:DynamicTable= Field(..., description="""Table for describing the bands that this series was generated from. There should be one row in this table for each band.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class DecompositionSeriesData(ConfiguredBaseModel): + """ + Data decomposed into frequency bands. + """ + name:Literal["data"]= Field("data") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""") + array:Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], Number]]= Field(None) + + +class DecompositionSeriesSourceChannels(DynamicTableRegion): + """ + DynamicTableRegion pointer to the channels that this decomposition series was generated from. + """ + name:Literal["source_channels"]= Field("source_channels") + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class Units(DynamicTable): """ Data about spiking units. Event times of observed units (e.g. cell, synapse, etc.) should be concatenated and stored in spike_times. """ - name: str = Field(...) - spike_times_index: Optional[UnitsSpikeTimesIndex] = Field(None, description="""Index into the spike_times dataset.""") - spike_times: Optional[UnitsSpikeTimes] = Field(None, description="""Spike times for each unit in seconds.""") - obs_intervals_index: Optional[UnitsObsIntervalsIndex] = Field(None, description="""Index into the obs_intervals dataset.""") - obs_intervals: Optional[UnitsObsIntervals] = Field(None, description="""Observation intervals for each unit.""") - electrodes_index: Optional[UnitsElectrodesIndex] = Field(None, description="""Index into electrodes.""") - electrodes: Optional[UnitsElectrodes] = Field(None, description="""Electrode that each spike unit came from, specified using a DynamicTableRegion.""") - electrode_group: Optional[List[ElectrodeGroup]] = Field(default_factory=list, description="""Electrode group that each spike unit came from.""") - waveform_mean: Optional[UnitsWaveformMean] = Field(None, description="""Spike waveform mean for each spike unit.""") - waveform_sd: Optional[UnitsWaveformSd] = Field(None, description="""Spike waveform standard deviation for each spike unit.""") - waveforms: Optional[UnitsWaveforms] = Field(None, description="""Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same.""") - waveforms_index: Optional[UnitsWaveformsIndex] = Field(None, description="""Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail.""") - waveforms_index_index: Optional[UnitsWaveformsIndexIndex] = Field(None, description="""Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + spike_times_index:Optional[UnitsSpikeTimesIndex]= Field(None, description="""Index into the spike_times dataset.""") + spike_times:Optional[UnitsSpikeTimes]= Field(None, description="""Spike times for each unit in seconds.""") + obs_intervals_index:Optional[UnitsObsIntervalsIndex]= Field(None, description="""Index into the obs_intervals dataset.""") + obs_intervals:Optional[UnitsObsIntervals]= Field(None, description="""Observation intervals for each unit.""") + electrodes_index:Optional[UnitsElectrodesIndex]= Field(None, description="""Index into electrodes.""") + electrodes:Optional[UnitsElectrodes]= Field(None, description="""Electrode that each spike unit came from, specified using a DynamicTableRegion.""") + electrode_group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Electrode group that each spike unit came from.""") + waveform_mean:Optional[UnitsWaveformMean]= Field(None, description="""Spike waveform mean for each spike unit.""") + waveform_sd:Optional[UnitsWaveformSd]= Field(None, description="""Spike waveform standard deviation for each spike unit.""") + waveforms:Optional[UnitsWaveforms]= Field(None, description="""Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same.""") + waveforms_index:Optional[UnitsWaveformsIndex]= Field(None, description="""Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail.""") + waveforms_index_index:Optional[UnitsWaveformsIndexIndex]= Field(None, description="""Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class UnitsSpikeTimesIndex(VectorIndex): + """ + Index into the spike_times dataset. + """ + name:Literal["spike_times_index"]= Field("spike_times_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsSpikeTimes(VectorData): + """ + Spike times for each unit in seconds. + """ + name:Literal["spike_times"]= Field("spike_times") + resolution:Optional[float]= Field(None, description="""The smallest possible difference between two spike times. Usually 1 divided by the acquisition sampling rate from which spike times were extracted, but could be larger if the acquisition time series was downsampled or smaller if the acquisition time series was smoothed/interpolated and it is possible for the spike time to be between samples.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsObsIntervalsIndex(VectorIndex): + """ + Index into the obs_intervals dataset. + """ + name:Literal["obs_intervals_index"]= Field("obs_intervals_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsObsIntervals(VectorData): + """ + Observation intervals for each unit. + """ + name:Literal["obs_intervals"]= Field("obs_intervals") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsElectrodesIndex(VectorIndex): + """ + Index into electrodes. + """ + name:Literal["electrodes_index"]= Field("electrodes_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsElectrodes(DynamicTableRegion): + """ + Electrode that each spike unit came from, specified using a DynamicTableRegion. + """ + name:Literal["electrodes"]= Field("electrodes") + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsWaveformMean(VectorData): + """ + Spike waveform mean for each spike unit. + """ + name:Literal["waveform_mean"]= Field("waveform_mean") + sampling_rate:Optional[float]= Field(None, description="""Sampling rate, in hertz.""") + unit:Optional[str]= Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsWaveformSd(VectorData): + """ + Spike waveform standard deviation for each spike unit. + """ + name:Literal["waveform_sd"]= Field("waveform_sd") + sampling_rate:Optional[float]= Field(None, description="""Sampling rate, in hertz.""") + unit:Optional[str]= Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsWaveforms(VectorData): + """ + Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same. + """ + name:Literal["waveforms"]= Field("waveforms") + sampling_rate:Optional[float]= Field(None, description="""Sampling rate, in hertz.""") + unit:Optional[str]= Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsWaveformsIndex(VectorIndex): + """ + Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. + """ + name:Literal["waveforms_index"]= Field("waveforms_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class UnitsWaveformsIndexIndex(VectorIndex): + """ + Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. + """ + name:Literal["waveforms_index_index"]= Field("waveforms_index_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) # Model rebuild # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model AbstractFeatureSeries.model_rebuild() +AbstractFeatureSeriesData.model_rebuild() AnnotationSeries.model_rebuild() IntervalSeries.model_rebuild() DecompositionSeries.model_rebuild() +DecompositionSeriesData.model_rebuild() +DecompositionSeriesSourceChannels.model_rebuild() Units.model_rebuild() +UnitsSpikeTimesIndex.model_rebuild() +UnitsSpikeTimes.model_rebuild() +UnitsObsIntervalsIndex.model_rebuild() +UnitsObsIntervals.model_rebuild() +UnitsElectrodesIndex.model_rebuild() +UnitsElectrodes.model_rebuild() +UnitsWaveformMean.model_rebuild() +UnitsWaveformSd.model_rebuild() +UnitsWaveforms.model_rebuild() +UnitsWaveformsIndex.model_rebuild() +UnitsWaveformsIndexIndex.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_misc_include.py b/nwb_linkml/models/core_nwb_misc_include.py deleted file mode 100644 index 1dca01f..0000000 --- a/nwb_linkml/models/core_nwb_misc_include.py +++ /dev/null @@ -1,272 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .hdmf_common_table import ( - DynamicTableRegion, - VectorData, - VectorIndex -) - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class AbstractFeatureSeriesData(ConfiguredBaseModel): - """ - Values of each feature at each time. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Since there can be different units for different features, store the units in 'feature_units'. The default value for this attribute is \"see 'feature_units'\".""") - array: Optional[Union[ - NDArray[Shape["* num_times"], Number], - NDArray[Shape["* num_times, * num_features"], Number] - ]] = Field(None) - - -class AbstractFeatureSeriesDataArray(Arraylike): - - num_times: float = Field(...) - num_features: Optional[float] = Field(None) - - -class DecompositionSeriesData(ConfiguredBaseModel): - """ - Data decomposed into frequency bands. - """ - name: str = Field("data", const=True) - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. Actual stored values are not necessarily stored in these units. To access the data in these units, multiply 'data' by 'conversion'.""") - array: Optional[NDArray[Shape["* num_times, * num_channels, * num_bands"], Number]] = Field(None) - - -class DecompositionSeriesDataArray(Arraylike): - - num_times: float = Field(...) - num_channels: float = Field(...) - num_bands: float = Field(...) - - -class DecompositionSeriesSourceChannels(DynamicTableRegion): - """ - DynamicTableRegion pointer to the channels that this decomposition series was generated from. - """ - name: str = Field("source_channels", const=True) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsSpikeTimesIndex(VectorIndex): - """ - Index into the spike_times dataset. - """ - name: str = Field("spike_times_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsSpikeTimes(VectorData): - """ - Spike times for each unit in seconds. - """ - name: str = Field("spike_times", const=True) - resolution: Optional[float] = Field(None, description="""The smallest possible difference between two spike times. Usually 1 divided by the acquisition sampling rate from which spike times were extracted, but could be larger if the acquisition time series was downsampled or smaller if the acquisition time series was smoothed/interpolated and it is possible for the spike time to be between samples.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsObsIntervalsIndex(VectorIndex): - """ - Index into the obs_intervals dataset. - """ - name: str = Field("obs_intervals_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsObsIntervals(VectorData): - """ - Observation intervals for each unit. - """ - name: str = Field("obs_intervals", const=True) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsElectrodesIndex(VectorIndex): - """ - Index into electrodes. - """ - name: str = Field("electrodes_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsElectrodes(DynamicTableRegion): - """ - Electrode that each spike unit came from, specified using a DynamicTableRegion. - """ - name: str = Field("electrodes", const=True) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsWaveformMean(VectorData): - """ - Spike waveform mean for each spike unit. - """ - name: str = Field("waveform_mean", const=True) - sampling_rate: Optional[float] = Field(None, description="""Sampling rate, in hertz.""") - unit: Optional[str] = Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsWaveformSd(VectorData): - """ - Spike waveform standard deviation for each spike unit. - """ - name: str = Field("waveform_sd", const=True) - sampling_rate: Optional[float] = Field(None, description="""Sampling rate, in hertz.""") - unit: Optional[str] = Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsWaveforms(VectorData): - """ - Individual waveforms for each spike on each electrode. This is a doubly indexed column. The 'waveforms_index' column indexes which waveforms in this column belong to the same spike event for a given unit, where each waveform was recorded from a different electrode. The 'waveforms_index_index' column indexes the 'waveforms_index' column to indicate which spike events belong to a given unit. For example, if the 'waveforms_index_index' column has values [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' column correspond to the 3 spike events of the second unit, and the next 1 element of the 'waveforms_index' column corresponds to the 1 spike event of the third unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then the first 3 elements of the 'waveforms' column contain the 3 spike waveforms that were recorded from 3 different electrodes for the first spike time of the first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays for a graphical representation of this example. When there is only one electrode for each unit (i.e., each spike time is associated with a single waveform), then the 'waveforms_index' column will have values 1, 2, ..., N, where N is the number of spike events. The number of electrodes for each spike event should be the same within a given unit. The 'electrodes' column should be used to indicate which electrodes are associated with each unit, and the order of the waveforms within a given unit x spike event should be in the same order as the electrodes referenced in the 'electrodes' column of this table. The number of samples for each waveform must be the same. - """ - name: str = Field("waveforms", const=True) - sampling_rate: Optional[float] = Field(None, description="""Sampling rate, in hertz.""") - unit: Optional[str] = Field(None, description="""Unit of measurement. This value is fixed to 'volts'.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsWaveformsIndex(VectorIndex): - """ - Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. - """ - name: str = Field("waveforms_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class UnitsWaveformsIndexIndex(VectorIndex): - """ - Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. - """ - name: str = Field("waveforms_index_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -AbstractFeatureSeriesData.model_rebuild() -AbstractFeatureSeriesDataArray.model_rebuild() -DecompositionSeriesData.model_rebuild() -DecompositionSeriesDataArray.model_rebuild() -DecompositionSeriesSourceChannels.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsObsIntervals.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformMean.model_rebuild() -UnitsWaveformSd.model_rebuild() -UnitsWaveforms.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_ogen.py b/nwb_linkml/models/core_nwb_ogen.py index 19bea43..03c82d3 100644 --- a/nwb_linkml/models/core_nwb_ogen.py +++ b/nwb_linkml/models/core_nwb_ogen.py @@ -12,8 +12,10 @@ else: from .core_nwb_base import ( - NWBContainer, - TimeSeries + TimeSeriesStartingTime, + TimeSeries, + TimeSeriesSync, + NWBContainer ) @@ -33,25 +35,25 @@ class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - name: str = Field(...) - data: List[float] = Field(default_factory=list, description="""Applied power for optogenetic stimulus, in watts.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:List[float]= Field(default_factory=list, description="""Applied power for optogenetic stimulus, in watts.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class OptogeneticStimulusSite(NWBContainer): """ A site of optogenetic stimulation. """ - name: str = Field(...) - description: str = Field(..., description="""Description of stimulation site.""") - excitation_lambda: float = Field(..., description="""Excitation wavelength, in nm.""") - location: str = Field(..., description="""Location of the stimulation site. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") + name:str= Field(...) + description:str= Field(..., description="""Description of stimulation site.""") + excitation_lambda:float= Field(..., description="""Excitation wavelength, in nm.""") + location:str= Field(..., description="""Location of the stimulation site. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") diff --git a/nwb_linkml/models/core_nwb_ogen_include.py b/nwb_linkml/models/core_nwb_ogen_include.py deleted file mode 100644 index 2918798..0000000 --- a/nwb_linkml/models/core_nwb_ogen_include.py +++ /dev/null @@ -1,39 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class OptogeneticSeriesData(ConfiguredBaseModel): - """ - Applied power for optogenetic stimulus, in watts. - """ - unit: Optional[str] = Field(None, description="""Unit of measurement for data, which is fixed to 'watts'.""") - data: List[float] = Field(default_factory=list, description="""Applied power for optogenetic stimulus, in watts.""") - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -OptogeneticSeriesData.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_ophys.py b/nwb_linkml/models/core_nwb_ophys.py index c833b85..bf0e1f5 100644 --- a/nwb_linkml/models/core_nwb_ophys.py +++ b/nwb_linkml/models/core_nwb_ophys.py @@ -12,29 +12,23 @@ else: from .core_nwb_base import ( + TimeSeriesStartingTime, + NWBContainer, + TimeSeriesSync, TimeSeries, - NWBDataInterface, - NWBContainer -) - -from .core_nwb_ophys_include import ( - RoiResponseSeriesRois, - TwoPhotonSeriesFieldOfView, - ImagingPlaneOriginCoords, - RoiResponseSeriesData, - PlaneSegmentationPixelMaskIndex, - PlaneSegmentationImageMask, - ImagingPlaneGridSpacing, - PlaneSegmentationVoxelMaskIndex, - ImagingPlaneManifold -) - -from .hdmf_common_table import ( - DynamicTable + NWBDataInterface ) from .core_nwb_image import ( - ImageSeries + ImageSeries, + ImageSeriesData +) + +from .hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, + DynamicTableRegion ) @@ -54,145 +48,263 @@ class OnePhotonSeries(ImageSeries): """ Image stack recorded over time from 1-photon microscope. """ - name: str = Field(...) - pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") - scan_line_rate: Optional[float] = Field(None, description="""Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.""") - exposure_time: Optional[float] = Field(None, description="""Exposure time of the sample; often the inverse of the frequency.""") - binning: Optional[int] = Field(None, description="""Amount of pixels combined into 'bins'; could be 1, 2, 4, 8, etc.""") - power: Optional[float] = Field(None, description="""Power of the excitation in mW, if known.""") - intensity: Optional[float] = Field(None, description="""Intensity of the excitation in mW/mm^2, if known.""") - data: ImageSeriesData = Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") - dimension: Optional[List[int]] = Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") - external_file: Optional[List[str]] = Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") - format: Optional[str] = Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + pmt_gain:Optional[float]= Field(None, description="""Photomultiplier gain.""") + scan_line_rate:Optional[float]= Field(None, description="""Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.""") + exposure_time:Optional[float]= Field(None, description="""Exposure time of the sample; often the inverse of the frequency.""") + binning:Optional[int]= Field(None, description="""Amount of pixels combined into 'bins'; could be 1, 2, 4, 8, etc.""") + power:Optional[float]= Field(None, description="""Power of the excitation in mW, if known.""") + intensity:Optional[float]= Field(None, description="""Intensity of the excitation in mW/mm^2, if known.""") + data:ImageSeriesData= Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") + dimension:Optional[List[int]]= Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") + external_file:Optional[List[str]]= Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") + format:Optional[str]= Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - name: str = Field(...) - pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") - scan_line_rate: Optional[float] = Field(None, description="""Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.""") - field_of_view: Optional[TwoPhotonSeriesFieldOfView] = Field(None, description="""Width, height and depth of image, or imaged area, in meters.""") - data: ImageSeriesData = Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") - dimension: Optional[List[int]] = Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") - external_file: Optional[List[str]] = Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") - format: Optional[str] = Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + pmt_gain:Optional[float]= Field(None, description="""Photomultiplier gain.""") + scan_line_rate:Optional[float]= Field(None, description="""Lines imaged per second. This is also stored in /general/optophysiology but is kept here as it is useful information for analysis, and so good to be stored w/ the actual data.""") + field_of_view:Optional[TwoPhotonSeriesFieldOfView]= Field(None, description="""Width, height and depth of image, or imaged area, in meters.""") + data:ImageSeriesData= Field(..., description="""Binary data representing images across frames. If data are stored in an external file, this should be an empty 3D array.""") + dimension:Optional[List[int]]= Field(default_factory=list, description="""Number of pixels on x, y, (and z) axes.""") + external_file:Optional[List[str]]= Field(default_factory=list, description="""Paths to one or more external file(s). The field is only present if format='external'. This is only relevant if the image series is stored in the file system as one or more image file(s). This field should NOT be used if the image is stored in another NWB file and that file is linked to this file.""") + format:Optional[str]= Field(None, description="""Format of image. If this is 'external', then the attribute 'external_file' contains the path information to the image files. If this is 'raw', then the raw (single-channel) binary data is stored in the 'data' dataset. If this attribute is not present, then the default format='raw' case is assumed.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class TwoPhotonSeriesFieldOfView(ConfiguredBaseModel): + """ + Width, height and depth of image, or imaged area, in meters. + """ + name:Literal["field_of_view"]= Field("field_of_view") + array:Optional[Union[ + NDArray[Shape["2 width_height"], Float32], + NDArray[Shape["2 width_height, 3 width_height_depth"], Float32] + ]]= Field(None) class RoiResponseSeries(TimeSeries): """ ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - name: str = Field(...) - data: RoiResponseSeriesData = Field(..., description="""Signals from ROIs.""") - rois: RoiResponseSeriesRois = Field(..., description="""DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries.""") - description: Optional[str] = Field(None, description="""Description of the time series.""") - comments: Optional[str] = Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") - starting_time: Optional[TimeSeriesStartingTime] = Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") - timestamps: Optional[List[float]] = Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") - control: Optional[List[int]] = Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") - control_description: Optional[List[str]] = Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") - sync: Optional[TimeSeriesSync] = Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + name:str= Field(...) + data:RoiResponseSeriesData= Field(..., description="""Signals from ROIs.""") + rois:RoiResponseSeriesRois= Field(..., description="""DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries.""") + description:Optional[str]= Field(None, description="""Description of the time series.""") + comments:Optional[str]= Field(None, description="""Human-readable comments about the TimeSeries. This second descriptive field can be used to store additional information, or descriptive information if the primary description field is populated with a computer-readable string.""") + starting_time:Optional[TimeSeriesStartingTime]= Field(None, description="""Timestamp of the first sample in seconds. When timestamps are uniformly spaced, the timestamp of the first sample can be specified and all subsequent ones calculated from the sampling rate attribute.""") + timestamps:Optional[List[float]]= Field(default_factory=list, description="""Timestamps for samples stored in data, in seconds, relative to the common experiment master-clock stored in NWBFile.timestamps_reference_time.""") + control:Optional[List[int]]= Field(default_factory=list, description="""Numerical labels that apply to each time point in data for the purpose of querying and slicing data by these values. If present, the length of this array should be the same size as the first dimension of data.""") + control_description:Optional[List[str]]= Field(default_factory=list, description="""Description of each control value. Must be present if control is present. If present, control_description[0] should describe time points where control == 0.""") + sync:Optional[TimeSeriesSync]= Field(None, description="""Lab-specific time and sync information as provided directly from hardware devices and that is necessary for aligning all acquired time information to a common timebase. The timestamp array stores time in the common timebase. This group will usually only be populated in TimeSeries that are stored external to the NWB file, in files storing raw data. Once timestamp data is calculated, the contents of 'sync' are mostly for archival purposes.""") + + +class RoiResponseSeriesData(ConfiguredBaseModel): + """ + Signals from ROIs. + """ + name:Literal["data"]= Field("data") + array:Optional[Union[ + NDArray[Shape["* num_times"], Number], + NDArray[Shape["* num_times, * num_ROIs"], Number] + ]]= Field(None) + + +class RoiResponseSeriesRois(DynamicTableRegion): + """ + DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. + """ + name:Literal["rois"]= Field("rois") + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class DfOverF(NWBDataInterface): """ dF/F information about a region of interest (ROI). Storage hierarchy of dF/F should be the same as for segmentation (i.e., same names for ROIs and for image planes). """ - name: str = Field(...) - roi_response_series: List[RoiResponseSeries] = Field(default_factory=list, description="""RoiResponseSeries object(s) containing dF/F for a ROI.""") + name:str= Field(...) + roi_response_series:List[RoiResponseSeries]= Field(default_factory=list, description="""RoiResponseSeries object(s) containing dF/F for a ROI.""") class Fluorescence(NWBDataInterface): """ Fluorescence information about a region of interest (ROI). Storage hierarchy of fluorescence should be the same as for segmentation (ie, same names for ROIs and for image planes). """ - name: str = Field(...) - roi_response_series: List[RoiResponseSeries] = Field(default_factory=list, description="""RoiResponseSeries object(s) containing fluorescence data for a ROI.""") + name:str= Field(...) + roi_response_series:List[RoiResponseSeries]= Field(default_factory=list, description="""RoiResponseSeries object(s) containing fluorescence data for a ROI.""") class ImageSegmentation(NWBDataInterface): """ Stores pixels in an image that represent different regions of interest (ROIs) or masks. All segmentation for a given imaging plane is stored together, with storage for multiple imaging planes (masks) supported. Each ROI is stored in its own subgroup, with the ROI group containing both a 2D mask and a list of pixels that make up this mask. Segments can also be used for masking neuropil. If segmentation is allowed to change with time, a new imaging plane (or module) is required and ROI names should remain consistent between them. """ - name: str = Field(...) - plane_segmentation: List[PlaneSegmentation] = Field(default_factory=list, description="""Results from image segmentation of a specific imaging plane.""") + name:str= Field(...) + plane_segmentation:List[PlaneSegmentation]= Field(default_factory=list, description="""Results from image segmentation of a specific imaging plane.""") class PlaneSegmentation(DynamicTable): """ Results from image segmentation of a specific imaging plane. """ - name: str = Field(...) - image_mask: Optional[PlaneSegmentationImageMask] = Field(None, description="""ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero.""") - pixel_mask_index: Optional[PlaneSegmentationPixelMaskIndex] = Field(None, description="""Index into pixel_mask.""") - pixel_mask: Optional[List[Any]] = Field(default_factory=list, description="""Pixel masks for each ROI: a list of indices and weights for the ROI. Pixel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation""") - voxel_mask_index: Optional[PlaneSegmentationVoxelMaskIndex] = Field(None, description="""Index into voxel_mask.""") - voxel_mask: Optional[List[Any]] = Field(default_factory=list, description="""Voxel masks for each ROI: a list of indices and weights for the ROI. Voxel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation""") - reference_images: Optional[List[ImageSeries]] = Field(default_factory=list, description="""Image stacks that the segmentation masks apply to.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + image_mask:Optional[PlaneSegmentationImageMask]= Field(None, description="""ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero.""") + pixel_mask_index:Optional[PlaneSegmentationPixelMaskIndex]= Field(None, description="""Index into pixel_mask.""") + pixel_mask:Optional[List[Any]]= Field(default_factory=list, description="""Pixel masks for each ROI: a list of indices and weights for the ROI. Pixel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation""") + voxel_mask_index:Optional[PlaneSegmentationVoxelMaskIndex]= Field(None, description="""Index into voxel_mask.""") + voxel_mask:Optional[List[Any]]= Field(default_factory=list, description="""Voxel masks for each ROI: a list of indices and weights for the ROI. Voxel masks are concatenated and parsing of this dataset is maintained by the PlaneSegmentation""") + reference_images:Optional[List[ImageSeries]]= Field(default_factory=list, description="""Image stacks that the segmentation masks apply to.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + + +class PlaneSegmentationImageMask(VectorData): + """ + ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero. + """ + name:Literal["image_mask"]= Field("image_mask") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class PlaneSegmentationPixelMaskIndex(VectorIndex): + """ + Index into pixel_mask. + """ + name:Literal["pixel_mask_index"]= Field("pixel_mask_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) + + +class PlaneSegmentationVoxelMaskIndex(VectorIndex): + """ + Index into voxel_mask. + """ + name:Literal["voxel_mask_index"]= Field("voxel_mask_index") + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ + NDArray[Shape["* dim0"], Any], + NDArray[Shape["* dim0, * dim1"], Any], + NDArray[Shape["* dim0, * dim1, * dim2"], Any], + NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] + ]]= Field(None) class ImagingPlane(NWBContainer): """ An imaging plane and its metadata. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of the imaging plane.""") - excitation_lambda: float = Field(..., description="""Excitation wavelength, in nm.""") - imaging_rate: Optional[float] = Field(None, description="""Rate that images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be stored there instead.""") - indicator: str = Field(..., description="""Calcium indicator.""") - location: str = Field(..., description="""Location of the imaging plane. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") - manifold: Optional[ImagingPlaneManifold] = Field(None, description="""DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing.""") - origin_coords: Optional[ImagingPlaneOriginCoords] = Field(None, description="""Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma).""") - grid_spacing: Optional[ImagingPlaneGridSpacing] = Field(None, description="""Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid.""") - reference_frame: Optional[str] = Field(None, description="""Describes reference frame of origin_coords and grid_spacing. For example, this can be a text description of the anatomical location and orientation of the grid defined by origin_coords and grid_spacing or the vectors needed to transform or rotate the grid to a common anatomical axis (e.g., AP/DV/ML). This field is necessary to interpret origin_coords and grid_spacing. If origin_coords and grid_spacing are not present, then this field is not required. For example, if the microscope takes 10 x 10 x 2 images, where the first value of the data matrix (index (0, 0, 0)) corresponds to (-1.2, -0.6, -2) mm relative to bregma, the spacing between pixels is 0.2 mm in x, 0.2 mm in y and 0.5 mm in z, and larger numbers in x means more anterior, larger numbers in y means more rightward, and larger numbers in z means more ventral, then enter the following -- origin_coords = (-1.2, -0.6, -2) grid_spacing = (0.2, 0.2, 0.5) reference_frame = \"Origin coordinates are relative to bregma. First dimension corresponds to anterior-posterior axis (larger index = more anterior). Second dimension corresponds to medial-lateral axis (larger index = more rightward). Third dimension corresponds to dorsal-ventral axis (larger index = more ventral).\"""") - optical_channel: List[OpticalChannel] = Field(default_factory=list, description="""An optical channel used to record from an imaging plane.""") + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of the imaging plane.""") + excitation_lambda:float= Field(..., description="""Excitation wavelength, in nm.""") + imaging_rate:Optional[float]= Field(None, description="""Rate that images are acquired, in Hz. If the corresponding TimeSeries is present, the rate should be stored there instead.""") + indicator:str= Field(..., description="""Calcium indicator.""") + location:str= Field(..., description="""Location of the imaging plane. Specify the area, layer, comments on estimation of area/layer, stereotaxic coordinates if in vivo, etc. Use standard atlas names for anatomical regions when possible.""") + manifold:Optional[ImagingPlaneManifold]= Field(None, description="""DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing.""") + origin_coords:Optional[ImagingPlaneOriginCoords]= Field(None, description="""Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma).""") + grid_spacing:Optional[ImagingPlaneGridSpacing]= Field(None, description="""Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid.""") + reference_frame:Optional[str]= Field(None, description="""Describes reference frame of origin_coords and grid_spacing. For example, this can be a text description of the anatomical location and orientation of the grid defined by origin_coords and grid_spacing or the vectors needed to transform or rotate the grid to a common anatomical axis (e.g., AP/DV/ML). This field is necessary to interpret origin_coords and grid_spacing. If origin_coords and grid_spacing are not present, then this field is not required. For example, if the microscope takes 10 x 10 x 2 images, where the first value of the data matrix (index (0, 0, 0)) corresponds to (-1.2, -0.6, -2) mm relative to bregma, the spacing between pixels is 0.2 mm in x, 0.2 mm in y and 0.5 mm in z, and larger numbers in x means more anterior, larger numbers in y means more rightward, and larger numbers in z means more ventral, then enter the following -- origin_coords = (-1.2, -0.6, -2) grid_spacing = (0.2, 0.2, 0.5) reference_frame = \"Origin coordinates are relative to bregma. First dimension corresponds to anterior-posterior axis (larger index = more anterior). Second dimension corresponds to medial-lateral axis (larger index = more rightward). Third dimension corresponds to dorsal-ventral axis (larger index = more ventral).\"""") + optical_channel:List[OpticalChannel]= Field(default_factory=list, description="""An optical channel used to record from an imaging plane.""") + + +class ImagingPlaneManifold(ConfiguredBaseModel): + """ + DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing. + """ + name:Literal["manifold"]= Field("manifold") + conversion:Optional[float]= Field(None, description="""Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as pixels from x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then the 'conversion' multiplier to get from raw data acquisition pixel units to meters is 2/1000.""") + unit:Optional[str]= Field(None, description="""Base unit of measurement for working with the data. The default value is 'meters'.""") + array:Optional[Union[ + NDArray[Shape["* height, * width, 3 x_y_z"], Float32], + NDArray[Shape["* height, * width, 3 x_y_z, * depth"], Float32] + ]]= Field(None) + + +class ImagingPlaneOriginCoords(ConfiguredBaseModel): + """ + Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma). + """ + name:Literal["origin_coords"]= Field("origin_coords") + unit:Optional[str]= Field(None, description="""Measurement units for origin_coords. The default value is 'meters'.""") + array:Optional[Union[ + NDArray[Shape["2 x_y"], Float32], + NDArray[Shape["2 x_y, 3 x_y_z"], Float32] + ]]= Field(None) + + +class ImagingPlaneGridSpacing(ConfiguredBaseModel): + """ + Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid. + """ + name:Literal["grid_spacing"]= Field("grid_spacing") + unit:Optional[str]= Field(None, description="""Measurement units for grid_spacing. The default value is 'meters'.""") + array:Optional[Union[ + NDArray[Shape["2 x_y"], Float32], + NDArray[Shape["2 x_y, 3 x_y_z"], Float32] + ]]= Field(None) class OpticalChannel(NWBContainer): """ An optical channel used to record from an imaging plane. """ - name: str = Field(...) - description: str = Field(..., description="""Description or other notes about the channel.""") - emission_lambda: float = Field(..., description="""Emission wavelength for channel, in nm.""") + name:str= Field(...) + description:str= Field(..., description="""Description or other notes about the channel.""") + emission_lambda:float= Field(..., description="""Emission wavelength for channel, in nm.""") class MotionCorrection(NWBDataInterface): """ An image stack where all frames are shifted (registered) to a common coordinate system, to account for movement and drift between frames. Note: each frame at each point in time is assumed to be 2-D (has only x & y dimensions). """ - name: str = Field(...) - corrected_image_stack: List[CorrectedImageStack] = Field(default_factory=list, description="""Reuslts from motion correction of an image stack.""") + name:str= Field(...) + corrected_image_stack:List[CorrectedImageStack]= Field(default_factory=list, description="""Reuslts from motion correction of an image stack.""") class CorrectedImageStack(NWBDataInterface): """ Reuslts from motion correction of an image stack. """ - name: str = Field(...) - corrected: ImageSeries = Field(..., description="""Image stack with frames shifted to the common coordinates.""") - xy_translation: TimeSeries = Field(..., description="""Stores the x,y delta necessary to align each frame to the common coordinates, for example, to align each frame to a reference image.""") + name:str= Field(...) + corrected:ImageSeries= Field(..., description="""Image stack with frames shifted to the common coordinates.""") + xy_translation:TimeSeries= Field(..., description="""Stores the x,y delta necessary to align each frame to the common coordinates, for example, to align each frame to a reference image.""") @@ -200,12 +312,21 @@ class CorrectedImageStack(NWBDataInterface): # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model OnePhotonSeries.model_rebuild() TwoPhotonSeries.model_rebuild() +TwoPhotonSeriesFieldOfView.model_rebuild() RoiResponseSeries.model_rebuild() +RoiResponseSeriesData.model_rebuild() +RoiResponseSeriesRois.model_rebuild() DfOverF.model_rebuild() Fluorescence.model_rebuild() ImageSegmentation.model_rebuild() PlaneSegmentation.model_rebuild() +PlaneSegmentationImageMask.model_rebuild() +PlaneSegmentationPixelMaskIndex.model_rebuild() +PlaneSegmentationVoxelMaskIndex.model_rebuild() ImagingPlane.model_rebuild() +ImagingPlaneManifold.model_rebuild() +ImagingPlaneOriginCoords.model_rebuild() +ImagingPlaneGridSpacing.model_rebuild() OpticalChannel.model_rebuild() MotionCorrection.model_rebuild() CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/models/core_nwb_ophys_include.py b/nwb_linkml/models/core_nwb_ophys_include.py deleted file mode 100644 index 3747ce7..0000000 --- a/nwb_linkml/models/core_nwb_ophys_include.py +++ /dev/null @@ -1,204 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .hdmf_common_table import ( - DynamicTableRegion, - VectorData, - VectorIndex -) - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class TwoPhotonSeriesFieldOfView(ConfiguredBaseModel): - """ - Width, height and depth of image, or imaged area, in meters. - """ - name: str = Field("field_of_view", const=True) - array: Optional[Union[ - NDArray[Shape["2 width|height"], Float32], - NDArray[Shape["2 width|height, 3 width|height|depth"], Float32] - ]] = Field(None) - - -class TwoPhotonSeriesFieldOfViewArray(Arraylike): - - width|height: Optional[float] = Field(None) - width|height|depth: Optional[float] = Field(None) - - -class RoiResponseSeriesData(ConfiguredBaseModel): - """ - Signals from ROIs. - """ - name: str = Field("data", const=True) - array: Optional[Union[ - NDArray[Shape["* num_times"], Number], - NDArray[Shape["* num_times, * num_ROIs"], Number] - ]] = Field(None) - - -class RoiResponseSeriesDataArray(Arraylike): - - num_times: float = Field(...) - num_ROIs: Optional[float] = Field(None) - - -class RoiResponseSeriesRois(DynamicTableRegion): - """ - DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. - """ - name: str = Field("rois", const=True) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class PlaneSegmentationImageMask(VectorData): - """ - ROI masks for each ROI. Each image mask is the size of the original imaging plane (or volume) and members of the ROI are finite non-zero. - """ - name: str = Field("image_mask", const=True) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class PlaneSegmentationPixelMaskIndex(VectorIndex): - """ - Index into pixel_mask. - """ - name: str = Field("pixel_mask_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class PlaneSegmentationVoxelMaskIndex(VectorIndex): - """ - Index into voxel_mask. - """ - name: str = Field("voxel_mask_index", const=True) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ - NDArray[Shape["* dim0"], Any], - NDArray[Shape["* dim0, * dim1"], Any], - NDArray[Shape["* dim0, * dim1, * dim2"], Any], - NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) - - -class ImagingPlaneManifold(ConfiguredBaseModel): - """ - DEPRECATED Physical position of each pixel. 'xyz' represents the position of the pixel relative to the defined coordinate space. Deprecated in favor of origin_coords and grid_spacing. - """ - name: str = Field("manifold", const=True) - conversion: Optional[float] = Field(None, description="""Scalar to multiply each element in data to convert it to the specified 'unit'. If the data are stored in acquisition system units or other units that require a conversion to be interpretable, multiply the data by 'conversion' to convert the data to the specified 'unit'. e.g. if the data acquisition system stores values in this object as pixels from x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then the 'conversion' multiplier to get from raw data acquisition pixel units to meters is 2/1000.""") - unit: Optional[str] = Field(None, description="""Base unit of measurement for working with the data. The default value is 'meters'.""") - array: Optional[Union[ - NDArray[Shape["* height, * width, 3 x_y_z"], Float32], - NDArray[Shape["* height, * width, 3 x_y_z, * depth"], Float32] - ]] = Field(None) - - -class ImagingPlaneManifoldArray(Arraylike): - - height: float = Field(...) - width: float = Field(...) - x_y_z: float = Field(...) - depth: Optional[float] = Field(None) - - -class ImagingPlaneOriginCoords(ConfiguredBaseModel): - """ - Physical location of the first element of the imaging plane (0, 0) for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the physical location is relative to (e.g., bregma). - """ - name: str = Field("origin_coords", const=True) - unit: Optional[str] = Field(None, description="""Measurement units for origin_coords. The default value is 'meters'.""") - array: Optional[Union[ - NDArray[Shape["2 x_y"], Float32], - NDArray[Shape["2 x_y, 3 x_y_z"], Float32] - ]] = Field(None) - - -class ImagingPlaneOriginCoordsArray(Arraylike): - - x_y: Optional[float] = Field(None) - x_y_z: Optional[float] = Field(None) - - -class ImagingPlaneGridSpacing(ConfiguredBaseModel): - """ - Space between pixels in (x, y) or voxels in (x, y, z) directions, in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame to interpret the grid. - """ - name: str = Field("grid_spacing", const=True) - unit: Optional[str] = Field(None, description="""Measurement units for grid_spacing. The default value is 'meters'.""") - array: Optional[Union[ - NDArray[Shape["2 x_y"], Float32], - NDArray[Shape["2 x_y, 3 x_y_z"], Float32] - ]] = Field(None) - - -class ImagingPlaneGridSpacingArray(Arraylike): - - x_y: Optional[float] = Field(None) - x_y_z: Optional[float] = Field(None) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TwoPhotonSeriesFieldOfView.model_rebuild() -TwoPhotonSeriesFieldOfViewArray.model_rebuild() -RoiResponseSeriesData.model_rebuild() -RoiResponseSeriesDataArray.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -PlaneSegmentationImageMask.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -ImagingPlaneManifold.model_rebuild() -ImagingPlaneManifoldArray.model_rebuild() -ImagingPlaneOriginCoords.model_rebuild() -ImagingPlaneOriginCoordsArray.model_rebuild() -ImagingPlaneGridSpacing.model_rebuild() -ImagingPlaneGridSpacingArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_retinotopy.py b/nwb_linkml/models/core_nwb_retinotopy.py index 7d6fc4b..dc2e2e4 100644 --- a/nwb_linkml/models/core_nwb_retinotopy.py +++ b/nwb_linkml/models/core_nwb_retinotopy.py @@ -11,16 +11,6 @@ else: from typing_extensions import Literal -from .core_nwb_retinotopy_include import ( - ImagingRetinotopyAxis1PowerMap, - ImagingRetinotopyAxis1PhaseMap, - ImagingRetinotopyVasculatureImage, - ImagingRetinotopySignMap, - ImagingRetinotopyAxis2PowerMap, - ImagingRetinotopyAxis2PhaseMap, - ImagingRetinotopyFocalDepthImage -) - from .core_nwb_base import ( NWBDataInterface ) @@ -42,19 +32,105 @@ class ImagingRetinotopy(NWBDataInterface): """ Intrinsic signal optical imaging or widefield imaging for measuring retinotopy. Stores orthogonal maps (e.g., altitude/azimuth; radius/theta) of responses to specific stimuli and a combined polarity map from which to identify visual areas. This group does not store the raw responses imaged during retinotopic mapping or the stimuli presented, but rather the resulting phase and power maps after applying a Fourier transform on the averaged responses. Note: for data consistency, all images and arrays are stored in the format [row][column] and [row, col], which equates to [y][x]. Field of view and dimension arrays may appear backward (i.e., y before x). """ - name: str = Field(...) - axis_1_phase_map: ImagingRetinotopyAxis1PhaseMap = Field(..., description="""Phase response to stimulus on the first measured axis.""") - axis_1_power_map: Optional[ImagingRetinotopyAxis1PowerMap] = Field(None, description="""Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.""") - axis_2_phase_map: ImagingRetinotopyAxis2PhaseMap = Field(..., description="""Phase response to stimulus on the second measured axis.""") - axis_2_power_map: Optional[ImagingRetinotopyAxis2PowerMap] = Field(None, description="""Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.""") - axis_descriptions: List[str] = Field(default_factory=list, description="""Two-element array describing the contents of the two response axis fields. Description should be something like ['altitude', 'azimuth'] or '['radius', 'theta'].""") - focal_depth_image: Optional[ImagingRetinotopyFocalDepthImage] = Field(None, description="""Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].""") - sign_map: Optional[ImagingRetinotopySignMap] = Field(None, description="""Sine of the angle between the direction of the gradient in axis_1 and axis_2.""") - vasculature_image: ImagingRetinotopyVasculatureImage = Field(..., description="""Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]""") + name:str= Field(...) + axis_1_phase_map:ImagingRetinotopyAxis1PhaseMap= Field(..., description="""Phase response to stimulus on the first measured axis.""") + axis_1_power_map:Optional[ImagingRetinotopyAxis1PowerMap]= Field(None, description="""Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.""") + axis_2_phase_map:ImagingRetinotopyAxis2PhaseMap= Field(..., description="""Phase response to stimulus on the second measured axis.""") + axis_2_power_map:Optional[ImagingRetinotopyAxis2PowerMap]= Field(None, description="""Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power.""") + axis_descriptions:List[str]= Field(default_factory=list, description="""Two-element array describing the contents of the two response axis fields. Description should be something like ['altitude', 'azimuth'] or '['radius', 'theta'].""") + focal_depth_image:Optional[ImagingRetinotopyFocalDepthImage]= Field(None, description="""Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].""") + sign_map:Optional[ImagingRetinotopySignMap]= Field(None, description="""Sine of the angle between the direction of the gradient in axis_1 and axis_2.""") + vasculature_image:ImagingRetinotopyVasculatureImage= Field(..., description="""Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]""") + + +class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): + """ + Phase response to stimulus on the first measured axis. + """ + name:Literal["axis_1_phase_map"]= Field("axis_1_phase_map") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + unit:Optional[str]= Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]]= Field(None) + + +class ImagingRetinotopyAxis1PowerMap(ConfiguredBaseModel): + """ + Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power. + """ + name:Literal["axis_1_power_map"]= Field("axis_1_power_map") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + unit:Optional[str]= Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]]= Field(None) + + +class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): + """ + Phase response to stimulus on the second measured axis. + """ + name:Literal["axis_2_phase_map"]= Field("axis_2_phase_map") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + unit:Optional[str]= Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]]= Field(None) + + +class ImagingRetinotopyAxis2PowerMap(ConfiguredBaseModel): + """ + Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power. + """ + name:Literal["axis_2_power_map"]= Field("axis_2_power_map") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + unit:Optional[str]= Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]]= Field(None) + + +class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): + """ + Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. + """ + name:Literal["focal_depth_image"]= Field("focal_depth_image") + bits_per_pixel:Optional[int]= Field(None, description="""Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value.""") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + focal_depth:Optional[float]= Field(None, description="""Focal depth offset, in meters.""") + format:Optional[str]= Field(None, description="""Format of image. Right now only 'raw' is supported.""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], UInt16]]= Field(None) + + +class ImagingRetinotopySignMap(ConfiguredBaseModel): + """ + Sine of the angle between the direction of the gradient in axis_1 and axis_2. + """ + name:Literal["sign_map"]= Field("sign_map") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]]= Field(None) + + +class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): + """ + Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] + """ + name:Literal["vasculature_image"]= Field("vasculature_image") + bits_per_pixel:Optional[int]= Field(None, description="""Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value""") + dimension:Optional[int]= Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") + field_of_view:Optional[float]= Field(None, description="""Size of viewing area, in meters.""") + format:Optional[str]= Field(None, description="""Format of image. Right now only 'raw' is supported.""") + array:Optional[NDArray[Shape["* num_rows, * num_cols"], UInt16]]= Field(None) # Model rebuild # see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model ImagingRetinotopy.model_rebuild() +ImagingRetinotopyAxis1PhaseMap.model_rebuild() +ImagingRetinotopyAxis1PowerMap.model_rebuild() +ImagingRetinotopyAxis2PhaseMap.model_rebuild() +ImagingRetinotopyAxis2PowerMap.model_rebuild() +ImagingRetinotopyFocalDepthImage.model_rebuild() +ImagingRetinotopySignMap.model_rebuild() +ImagingRetinotopyVasculatureImage.model_rebuild() \ No newline at end of file diff --git a/nwb_linkml/models/core_nwb_retinotopy_include.py b/nwb_linkml/models/core_nwb_retinotopy_include.py deleted file mode 100644 index 1f79d76..0000000 --- a/nwb_linkml/models/core_nwb_retinotopy_include.py +++ /dev/null @@ -1,169 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): - """ - Phase response to stimulus on the first measured axis. - """ - name: str = Field("axis_1_phase_map", const=True) - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - unit: Optional[str] = Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]] = Field(None) - - -class ImagingRetinotopyAxis1PhaseMapArray(Arraylike): - - num_rows: float = Field(...) - num_cols: float = Field(...) - - -class ImagingRetinotopyAxis1PowerMap(ConfiguredBaseModel): - """ - Power response on the first measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power. - """ - name: str = Field("axis_1_power_map", const=True) - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - unit: Optional[str] = Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]] = Field(None) - - -class ImagingRetinotopyAxis1PowerMapArray(Arraylike): - - num_rows: float = Field(...) - num_cols: float = Field(...) - - -class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): - """ - Phase response to stimulus on the second measured axis. - """ - name: str = Field("axis_2_phase_map", const=True) - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - unit: Optional[str] = Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]] = Field(None) - - -class ImagingRetinotopyAxis2PhaseMapArray(Arraylike): - - num_rows: float = Field(...) - num_cols: float = Field(...) - - -class ImagingRetinotopyAxis2PowerMap(ConfiguredBaseModel): - """ - Power response on the second measured axis. Response is scaled so 0.0 is no power in the response and 1.0 is maximum relative power. - """ - name: str = Field("axis_2_power_map", const=True) - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - unit: Optional[str] = Field(None, description="""Unit that axis data is stored in (e.g., degrees).""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]] = Field(None) - - -class ImagingRetinotopyAxis2PowerMapArray(Arraylike): - - num_rows: float = Field(...) - num_cols: float = Field(...) - - -class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): - """ - Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. - """ - name: str = Field("focal_depth_image", const=True) - bits_per_pixel: Optional[int] = Field(None, description="""Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value.""") - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - focal_depth: Optional[float] = Field(None, description="""Focal depth offset, in meters.""") - format: Optional[str] = Field(None, description="""Format of image. Right now only 'raw' is supported.""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], UInt16]] = Field(None) - - -class ImagingRetinotopyFocalDepthImageArray(Arraylike): - - num_rows: int = Field(...) - num_cols: int = Field(...) - - -class ImagingRetinotopySignMap(ConfiguredBaseModel): - """ - Sine of the angle between the direction of the gradient in axis_1 and axis_2. - """ - name: str = Field("sign_map", const=True) - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], Float32]] = Field(None) - - -class ImagingRetinotopySignMapArray(Arraylike): - - num_rows: float = Field(...) - num_cols: float = Field(...) - - -class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): - """ - Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] - """ - name: str = Field("vasculature_image", const=True) - bits_per_pixel: Optional[int] = Field(None, description="""Number of bits used to represent each value. This is necessary to determine maximum (white) pixel value""") - dimension: Optional[int] = Field(None, description="""Number of rows and columns in the image. NOTE: row, column representation is equivalent to height, width.""") - field_of_view: Optional[float] = Field(None, description="""Size of viewing area, in meters.""") - format: Optional[str] = Field(None, description="""Format of image. Right now only 'raw' is supported.""") - array: Optional[NDArray[Shape["* num_rows, * num_cols"], UInt16]] = Field(None) - - -class ImagingRetinotopyVasculatureImageArray(Arraylike): - - num_rows: int = Field(...) - num_cols: int = Field(...) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -ImagingRetinotopyAxis1PhaseMap.model_rebuild() -ImagingRetinotopyAxis1PhaseMapArray.model_rebuild() -ImagingRetinotopyAxis1PowerMap.model_rebuild() -ImagingRetinotopyAxis1PowerMapArray.model_rebuild() -ImagingRetinotopyAxis2PhaseMap.model_rebuild() -ImagingRetinotopyAxis2PhaseMapArray.model_rebuild() -ImagingRetinotopyAxis2PowerMap.model_rebuild() -ImagingRetinotopyAxis2PowerMapArray.model_rebuild() -ImagingRetinotopyFocalDepthImage.model_rebuild() -ImagingRetinotopyFocalDepthImageArray.model_rebuild() -ImagingRetinotopySignMap.model_rebuild() -ImagingRetinotopySignMapArray.model_rebuild() -ImagingRetinotopyVasculatureImage.model_rebuild() -ImagingRetinotopyVasculatureImageArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/hdmf_common.py b/nwb_linkml/models/hdmf_common.py index 807ea7c..3be86ff 100644 --- a/nwb_linkml/models/hdmf_common.py +++ b/nwb_linkml/models/hdmf_common.py @@ -11,6 +11,25 @@ else: from typing_extensions import Literal +from .hdmf_common_sparse import ( + CSRMatrix +) + +from .hdmf_common_base import ( + Data, + Container, + SimpleMultiContainer +) + +from .hdmf_common_table import ( + VectorData, + VectorIndex, + ElementIdentifiers, + DynamicTableRegion, + DynamicTable, + AlignedDynamicTable +) + metamodel_version = "None" version = "1.8.0" diff --git a/nwb_linkml/models/hdmf_common_base.py b/nwb_linkml/models/hdmf_common_base.py index 459b407..feb3cd7 100644 --- a/nwb_linkml/models/hdmf_common_base.py +++ b/nwb_linkml/models/hdmf_common_base.py @@ -28,23 +28,23 @@ class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - name: str = Field(...) + name:str= Field(...) class Container(ConfiguredBaseModel): """ An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers. """ - name: str = Field(...) + name:str= Field(...) class SimpleMultiContainer(Container): """ A simple Container for holding onto multiple containers. """ - name: str = Field(...) - Data: Optional[List[Data]] = Field(default_factory=list, description="""Data objects held within this SimpleMultiContainer.""") - container: Optional[List[Container]] = Field(default_factory=list, description="""Container objects held within this SimpleMultiContainer.""") + name:str= Field(...) + data:Optional[List[Data]]= Field(default_factory=list, description="""Data objects held within this SimpleMultiContainer.""") + container:Optional[List[Container]]= Field(default_factory=list, description="""Container objects held within this SimpleMultiContainer.""") diff --git a/nwb_linkml/models/hdmf_common_sparse.py b/nwb_linkml/models/hdmf_common_sparse.py index e75e3b4..64773f2 100644 --- a/nwb_linkml/models/hdmf_common_sparse.py +++ b/nwb_linkml/models/hdmf_common_sparse.py @@ -32,11 +32,11 @@ class CSRMatrix(Container): """ A compressed sparse row matrix. Data are stored in the standard CSR format, where column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]]. """ - name: str = Field(...) - shape: Optional[int] = Field(None, description="""The shape (number of rows, number of columns) of this sparse matrix.""") - indices: List[int] = Field(default_factory=list, description="""The column indices.""") - indptr: List[int] = Field(default_factory=list, description="""The row index pointer.""") - data: List[Any] = Field(default_factory=list, description="""The non-zero values in the matrix.""") + name:str= Field(...) + shape:Optional[int]= Field(None, description="""The shape (number of rows, number of columns) of this sparse matrix.""") + indices:List[int]= Field(default_factory=list, description="""The column indices.""") + indptr:List[int]= Field(default_factory=list, description="""The row index pointer.""") + data:List[Any]= Field(default_factory=list, description="""The non-zero values in the matrix.""") diff --git a/nwb_linkml/models/hdmf_common_table.py b/nwb_linkml/models/hdmf_common_table.py index f144e4f..23aa37f 100644 --- a/nwb_linkml/models/hdmf_common_table.py +++ b/nwb_linkml/models/hdmf_common_table.py @@ -12,13 +12,8 @@ else: from .hdmf_common_base import ( - Data, - Container -) - -from .hdmf_common_table_include import ( - VectorDataArray, - ElementIdentifiersArray + Container, + Data ) @@ -38,76 +33,76 @@ class VectorData(Data): """ An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]], and so on. """ - name: str = Field(...) - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ + name:str= Field(...) + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ NDArray[Shape["* dim0"], Any], NDArray[Shape["* dim0, * dim1"], Any], NDArray[Shape["* dim0, * dim1, * dim2"], Any], NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) + ]]= Field(None) class VectorIndex(VectorData): """ Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. The name of the VectorIndex is expected to be the name of the target VectorData object followed by \"_index\". """ - name: str = Field(...) - target: Optional[VectorData] = Field(None, description="""Reference to the target dataset that this index applies to.""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ + name:str= Field(...) + target:Optional[VectorData]= Field(None, description="""Reference to the target dataset that this index applies to.""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ NDArray[Shape["* dim0"], Any], NDArray[Shape["* dim0, * dim1"], Any], NDArray[Shape["* dim0, * dim1, * dim2"], Any], NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) + ]]= Field(None) class ElementIdentifiers(Data): """ A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - name: str = Field(...) - array: Optional[NDArray[Shape["* num_elements"], Int]] = Field(None) + name:str= Field(...) + array:Optional[NDArray[Shape["* num_elements"], Int]]= Field(None) class DynamicTableRegion(VectorData): """ DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - name: str = Field(...) - table: Optional[DynamicTable] = Field(None, description="""Reference to the DynamicTable object that this region applies to.""") - description: Optional[str] = Field(None, description="""Description of what this table region points to.""") - array: Optional[Union[ + name:str= Field(...) + table:Optional[DynamicTable]= Field(None, description="""Reference to the DynamicTable object that this region applies to.""") + description:Optional[str]= Field(None, description="""Description of what this table region points to.""") + array:Optional[Union[ NDArray[Shape["* dim0"], Any], NDArray[Shape["* dim0, * dim1"], Any], NDArray[Shape["* dim0, * dim1, * dim2"], Any], NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) + ]]= Field(None) class DynamicTable(Container): """ A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). These datasets represent different columns in the table. Apart from a column that contains unique identifiers for each row, there are no other required datasets. Users are free to add any number of custom VectorData objects (columns) here. DynamicTable also supports ragged array columns, where each element can be of a different size. To add a ragged array column, use a VectorIndex type to index the corresponding VectorData type. See documentation for VectorData and VectorIndex for more details. Unlike a compound data type, which is analogous to storing an array-of-structs, a DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. """ - name: str = Field(...) - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") class AlignedDynamicTable(DynamicTable): """ DynamicTable container that supports storing a collection of sub-tables. Each sub-table is a DynamicTable itself that is aligned with the main table by row index. I.e., all DynamicTables stored in this group MUST have the same number of rows. This type effectively defines a 2-level table in which the main data is stored in the main table implemented by this type and additional columns of the table are grouped into categories, with each category being represented by a separate DynamicTable stored within the group. """ - name: str = Field(...) - categories: Optional[str] = Field(None, description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""") - dynamic_table: Optional[List[DynamicTable]] = Field(default_factory=list, description="""A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.""") - colnames: Optional[str] = Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") - description: Optional[str] = Field(None, description="""Description of what is in this dynamic table.""") - id: List[int] = Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") - VectorData: Optional[List[VectorData]] = Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") + name:str= Field(...) + categories:Optional[str]= Field(None, description="""The names of the categories in this AlignedDynamicTable. Each category is represented by one DynamicTable stored in the parent group. This attribute should be used to specify an order of categories and the category names must match the names of the corresponding DynamicTable in the group.""") + dynamic_table:Optional[List[DynamicTable]]= Field(default_factory=list, description="""A DynamicTable representing a particular category for columns in the AlignedDynamicTable parent container. The table MUST be aligned with (i.e., have the same number of rows) as all other DynamicTables stored in the AlignedDynamicTable parent container. The name of the category is given by the name of the DynamicTable and its description by the description attribute of the DynamicTable.""") + colnames:Optional[str]= Field(None, description="""The names of the columns in this table. This should be used to specify an order to the columns.""") + description:Optional[str]= Field(None, description="""Description of what is in this dynamic table.""") + id:List[int]= Field(default_factory=list, description="""Array of unique identifiers for the rows of this dynamic table.""") + vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""") diff --git a/nwb_linkml/models/hdmf_common_table_include.py b/nwb_linkml/models/hdmf_common_table_include.py deleted file mode 100644 index 38950d4..0000000 --- a/nwb_linkml/models/hdmf_common_table_include.py +++ /dev/null @@ -1,49 +0,0 @@ -from __future__ import annotations -from datetime import datetime, date -from enum import Enum -from typing import List, Dict, Optional, Any, Union -from pydantic import BaseModel as BaseModel, Field -from nptyping import NDArray, Shape, Float, Float32, Double, Float64, LongLong, Int64, Int, Int32, Int16, Short, Int8, UInt, UInt32, UInt16, UInt8, UInt64, Number, String, Unicode, Unicode, Unicode, String, Bool, Datetime64 -import sys -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal - - -from .nwb_language import ( - Arraylike -) - - -metamodel_version = "None" -version = "None" - -class ConfiguredBaseModel(BaseModel, - validate_assignment = True, - validate_default = True, - extra = 'forbid', - arbitrary_types_allowed = True, - use_enum_values = True): - pass - - -class VectorDataArray(Arraylike): - - dim0: Any = Field(...) - dim1: Optional[Any] = Field(None) - dim2: Optional[Any] = Field(None) - dim3: Optional[Any] = Field(None) - - -class ElementIdentifiersArray(Arraylike): - - num_elements: int = Field(...) - - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -VectorDataArray.model_rebuild() -ElementIdentifiersArray.model_rebuild() - \ No newline at end of file diff --git a/nwb_linkml/models/hdmf_experimental.py b/nwb_linkml/models/hdmf_experimental.py index 353ade5..1d0c97e 100644 --- a/nwb_linkml/models/hdmf_experimental.py +++ b/nwb_linkml/models/hdmf_experimental.py @@ -11,6 +11,29 @@ else: from typing_extensions import Literal +from .hdmf_experimental_resources import ( + HERD +) + +from .hdmf_common_base import ( + Data, + Container, + SimpleMultiContainer +) + +from .hdmf_experimental_experimental import ( + EnumData +) + +from .hdmf_common_table import ( + VectorData, + VectorIndex, + ElementIdentifiers, + DynamicTableRegion, + DynamicTable, + AlignedDynamicTable +) + metamodel_version = "None" version = "0.5.0" diff --git a/nwb_linkml/models/hdmf_experimental_experimental.py b/nwb_linkml/models/hdmf_experimental_experimental.py index faa9c91..67e5d03 100644 --- a/nwb_linkml/models/hdmf_experimental_experimental.py +++ b/nwb_linkml/models/hdmf_experimental_experimental.py @@ -32,15 +32,15 @@ class EnumData(VectorData): """ Data that come from a fixed set of values. A data value of i corresponds to the i-th value in the VectorData referenced by the 'elements' attribute. """ - name: str = Field(...) - elements: Optional[VectorData] = Field(None, description="""Reference to the VectorData object that contains the enumerable elements""") - description: Optional[str] = Field(None, description="""Description of what these vectors represent.""") - array: Optional[Union[ + name:str= Field(...) + elements:Optional[VectorData]= Field(None, description="""Reference to the VectorData object that contains the enumerable elements""") + description:Optional[str]= Field(None, description="""Description of what these vectors represent.""") + array:Optional[Union[ NDArray[Shape["* dim0"], Any], NDArray[Shape["* dim0, * dim1"], Any], NDArray[Shape["* dim0, * dim1, * dim2"], Any], NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any] - ]] = Field(None) + ]]= Field(None) diff --git a/nwb_linkml/models/hdmf_experimental_resources.py b/nwb_linkml/models/hdmf_experimental_resources.py index 16bf15c..24ebd40 100644 --- a/nwb_linkml/models/hdmf_experimental_resources.py +++ b/nwb_linkml/models/hdmf_experimental_resources.py @@ -32,13 +32,13 @@ class HERD(Container): """ HDMF External Resources Data Structure. A set of six tables for tracking external resource references in a file or across multiple files. """ - name: str = Field(...) - keys: List[Any] = Field(default_factory=list, description="""A table for storing user terms that are used to refer to external resources.""") - files: List[Any] = Field(default_factory=list, description="""A table for storing object ids of files used in external resources.""") - entities: List[Any] = Field(default_factory=list, description="""A table for mapping user terms (i.e., keys) to resource entities.""") - objects: List[Any] = Field(default_factory=list, description="""A table for identifying which objects in a file contain references to external resources.""") - object_keys: List[Any] = Field(default_factory=list, description="""A table for identifying which objects use which keys.""") - entity_keys: List[Any] = Field(default_factory=list, description="""A table for identifying which keys use which entity.""") + name:str= Field(...) + keys:List[Any]= Field(default_factory=list, description="""A table for storing user terms that are used to refer to external resources.""") + files:List[Any]= Field(default_factory=list, description="""A table for storing object ids of files used in external resources.""") + entities:List[Any]= Field(default_factory=list, description="""A table for mapping user terms (i.e., keys) to resource entities.""") + objects:List[Any]= Field(default_factory=list, description="""A table for identifying which objects in a file contain references to external resources.""") + object_keys:List[Any]= Field(default_factory=list, description="""A table for identifying which objects use which keys.""") + entity_keys:List[Any]= Field(default_factory=list, description="""A table for identifying which keys use which entity.""") diff --git a/nwb_linkml/schema/core.nwb.base.include.yaml b/nwb_linkml/schema/core.nwb.base.include.yaml deleted file mode 100644 index 5a2c7d6..0000000 --- a/nwb_linkml/schema/core.nwb.base.include.yaml +++ /dev/null @@ -1,170 +0,0 @@ -name: core.nwb.base.include -id: core.nwb.base.include -imports: -- hdmf-common.base -- hdmf-common.table -- nwb.language -- core.nwb.base.include -- core.nwb.base -default_prefix: core.nwb.base.include/ -classes: - Image__Array: - name: Image__Array - is_a: Arraylike - attributes: - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - r, g, b: - name: r, g, b - range: numeric - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 - r, g, b, a: - name: r, g, b, a - range: numeric - required: false - minimum_cardinality: 4 - maximum_cardinality: 4 - ImageReferences__Array: - name: ImageReferences__Array - is_a: Arraylike - attributes: - num_images: - name: num_images - range: Image - required: true - TimeSeries__data: - name: TimeSeries__data - description: Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension - should always represent time. This can also be used to store binary data (e.g., - image frames). This can also be a link to data stored in an external file. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - conversion: - name: conversion - description: Scalar to multiply each element in data to convert it to the - specified 'unit'. If the data are stored in acquisition system units or - other units that require a conversion to be interpretable, multiply the - data by 'conversion' to convert the data to the specified 'unit'. e.g. if - the data acquisition system stores values in this object as signed 16-bit - integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V - to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' - multiplier to get from raw data acquisition values to recorded volts is - 2.5/32768/8000 = 9.5367e-9. - range: float32 - offset: - name: offset - description: Scalar to add to the data after scaling by 'conversion' to finalize - its coercion to the specified 'unit'. Two common examples of this include - (a) data stored in an unsigned type that requires a shift after scaling - to re-center the data, and (b) specialized recording devices that naturally - cause a scalar offset with respect to the true units. - range: float32 - resolution: - name: resolution - description: Smallest meaningful difference between values in data, stored - in the specified by unit, e.g., the change in value of the least significant - bit, or a larger number if signal noise is known to be present. If unknown, - use -1.0. - range: float32 - unit: - name: unit - description: Base unit of measurement for working with the data. Actual stored - values are not necessarily stored in these units. To access the data in - these units, multiply 'data' by 'conversion' and add 'offset'. - range: text - continuity: - name: continuity - description: Optionally describe the continuity of the data. Can be "continuous", - "instantaneous", or "step". For example, a voltage trace would be "continuous", - because samples are recorded from a continuous process. An array of lick - times would be "instantaneous", because the data represents distinct moments - in time. Times of image presentations would be "step" because the picture - remains the same until the next timepoint. This field is optional, but is - useful in providing information about the underlying data. It may inform - the way this data is interpreted, the way it is visualized, and what analysis - methods are applicable. - range: text - array: - name: array - range: TimeSeries__data__Array - TimeSeries__data__Array: - name: TimeSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: AnyType - required: true - num_DIM2: - name: num_DIM2 - range: AnyType - required: false - num_DIM3: - name: num_DIM3 - range: AnyType - required: false - num_DIM4: - name: num_DIM4 - range: AnyType - required: false - TimeSeries__starting_time: - name: TimeSeries__starting_time - description: Timestamp of the first sample in seconds. When timestamps are uniformly - spaced, the timestamp of the first sample can be specified and all subsequent - ones calculated from the sampling rate attribute. - attributes: - name: - name: name - ifabsent: string(starting_time) - range: string - required: true - equals_string: starting_time - rate: - name: rate - description: Sampling rate, in Hz. - range: float32 - unit: - name: unit - description: Unit of measurement for time, which is fixed to 'seconds'. - range: text - TimeSeries__sync: - name: TimeSeries__sync - description: Lab-specific time and sync information as provided directly from - hardware devices and that is necessary for aligning all acquired time information - to a common timebase. The timestamp array stores time in the common timebase. - This group will usually only be populated in TimeSeries that are stored external - to the NWB file, in files storing raw data. Once timestamp data is calculated, - the contents of 'sync' are mostly for archival purposes. - attributes: - name: - name: name - ifabsent: string(sync) - range: string - required: true - equals_string: sync - Images__order_of_images: - name: Images__order_of_images - description: Ordered dataset of references to Image objects stored in the parent - group. Each Image object in the Images group should be stored once and only - once, so the dataset should have the same length as the number of images. - is_a: ImageReferences - attributes: - name: - name: name - ifabsent: string(order_of_images) - range: string - required: true - equals_string: order_of_images diff --git a/nwb_linkml/schema/core.nwb.base.yaml b/nwb_linkml/schema/core.nwb.base.yaml index b870da6..7282098 100644 --- a/nwb_linkml/schema/core.nwb.base.yaml +++ b/nwb_linkml/schema/core.nwb.base.yaml @@ -4,8 +4,6 @@ imports: - hdmf-common.base - hdmf-common.table - nwb.language -- core.nwb.base.include -- core.nwb.base default_prefix: core.nwb.base/ classes: NWBData: @@ -53,6 +51,30 @@ classes: name: array range: Image__Array tree_root: true + Image__Array: + name: Image__Array + is_a: Arraylike + attributes: + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true + r, g, b: + name: r, g, b + range: numeric + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 + r, g, b, a: + name: r, g, b, a + range: numeric + required: false + minimum_cardinality: 4 + maximum_cardinality: 4 ImageReferences: name: ImageReferences description: Ordered dataset of references to Image objects. @@ -66,6 +88,14 @@ classes: name: array range: ImageReferences__Array tree_root: true + ImageReferences__Array: + name: ImageReferences__Array + is_a: Arraylike + attributes: + num_images: + name: num_images + range: Image + required: true NWBContainer: name: NWBContainer description: An abstract data type for a generic container storing collections @@ -159,6 +189,125 @@ classes: range: TimeSeries__sync required: false tree_root: true + TimeSeries__data: + name: TimeSeries__data + description: Data values. Data can be in 1-D, 2-D, 3-D, or 4-D. The first dimension + should always represent time. This can also be used to store binary data (e.g., + image frames). This can also be a link to data stored in an external file. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + conversion: + name: conversion + description: Scalar to multiply each element in data to convert it to the + specified 'unit'. If the data are stored in acquisition system units or + other units that require a conversion to be interpretable, multiply the + data by 'conversion' to convert the data to the specified 'unit'. e.g. if + the data acquisition system stores values in this object as signed 16-bit + integers (int16 range -32,768 to 32,767) that correspond to a 5V range (-2.5V + to 2.5V), and the data acquisition system gain is 8000X, then the 'conversion' + multiplier to get from raw data acquisition values to recorded volts is + 2.5/32768/8000 = 9.5367e-9. + range: float32 + offset: + name: offset + description: Scalar to add to the data after scaling by 'conversion' to finalize + its coercion to the specified 'unit'. Two common examples of this include + (a) data stored in an unsigned type that requires a shift after scaling + to re-center the data, and (b) specialized recording devices that naturally + cause a scalar offset with respect to the true units. + range: float32 + resolution: + name: resolution + description: Smallest meaningful difference between values in data, stored + in the specified by unit, e.g., the change in value of the least significant + bit, or a larger number if signal noise is known to be present. If unknown, + use -1.0. + range: float32 + unit: + name: unit + description: Base unit of measurement for working with the data. Actual stored + values are not necessarily stored in these units. To access the data in + these units, multiply 'data' by 'conversion' and add 'offset'. + range: text + continuity: + name: continuity + description: Optionally describe the continuity of the data. Can be "continuous", + "instantaneous", or "step". For example, a voltage trace would be "continuous", + because samples are recorded from a continuous process. An array of lick + times would be "instantaneous", because the data represents distinct moments + in time. Times of image presentations would be "step" because the picture + remains the same until the next timepoint. This field is optional, but is + useful in providing information about the underlying data. It may inform + the way this data is interpreted, the way it is visualized, and what analysis + methods are applicable. + range: text + array: + name: array + range: TimeSeries__data__Array + TimeSeries__data__Array: + name: TimeSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: AnyType + required: true + num_DIM2: + name: num_DIM2 + range: AnyType + required: false + num_DIM3: + name: num_DIM3 + range: AnyType + required: false + num_DIM4: + name: num_DIM4 + range: AnyType + required: false + TimeSeries__starting_time: + name: TimeSeries__starting_time + description: Timestamp of the first sample in seconds. When timestamps are uniformly + spaced, the timestamp of the first sample can be specified and all subsequent + ones calculated from the sampling rate attribute. + attributes: + name: + name: name + ifabsent: string(starting_time) + range: string + required: true + equals_string: starting_time + rate: + name: rate + description: Sampling rate, in Hz. + range: float32 + unit: + name: unit + description: Unit of measurement for time, which is fixed to 'seconds'. + range: text + value: + name: value + range: float64 + required: true + TimeSeries__sync: + name: TimeSeries__sync + description: Lab-specific time and sync information as provided directly from + hardware devices and that is necessary for aligning all acquired time information + to a common timebase. The timestamp array stores time in the common timebase. + This group will usually only be populated in TimeSeries that are stored external + to the NWB file, in files storing raw data. Once timestamp data is calculated, + the contents of 'sync' are mostly for archival purposes. + attributes: + name: + name: name + ifabsent: string(sync) + range: string + required: true + equals_string: sync ProcessingModule: name: ProcessingModule description: A collection of processed data. @@ -216,3 +365,16 @@ classes: range: Images__order_of_images required: false tree_root: true + Images__order_of_images: + name: Images__order_of_images + description: Ordered dataset of references to Image objects stored in the parent + group. Each Image object in the Images group should be stored once and only + once, so the dataset should have the same length as the number of images. + is_a: ImageReferences + attributes: + name: + name: name + ifabsent: string(order_of_images) + range: string + required: true + equals_string: order_of_images diff --git a/nwb_linkml/schema/core.nwb.behavior.include.yaml b/nwb_linkml/schema/core.nwb.behavior.include.yaml deleted file mode 100644 index 007abf0..0000000 --- a/nwb_linkml/schema/core.nwb.behavior.include.yaml +++ /dev/null @@ -1,57 +0,0 @@ -name: core.nwb.behavior.include -id: core.nwb.behavior.include -imports: -- core.nwb.base -- core.nwb.misc -- nwb.language -- core.nwb.behavior.include -- core.nwb.behavior -default_prefix: core.nwb.behavior.include/ -classes: - SpatialSeries__data: - name: SpatialSeries__data - description: 1-D or 2-D array storing position or direction relative to some reference - frame. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. The default - value is 'meters'. Actual stored values are not necessarily stored in these - units. To access the data in these units, multiply 'data' by 'conversion' - and add 'offset'. - range: text - array: - name: array - range: SpatialSeries__data__Array - SpatialSeries__data__Array: - name: SpatialSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: numeric - required: true - x: - name: x - range: numeric - required: false - minimum_cardinality: 1 - maximum_cardinality: 1 - x,y: - name: x,y - range: numeric - required: false - minimum_cardinality: 2 - maximum_cardinality: 2 - x,y,z: - name: x,y,z - range: numeric - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 diff --git a/nwb_linkml/schema/core.nwb.behavior.yaml b/nwb_linkml/schema/core.nwb.behavior.yaml index acba134..b7987c5 100644 --- a/nwb_linkml/schema/core.nwb.behavior.yaml +++ b/nwb_linkml/schema/core.nwb.behavior.yaml @@ -4,8 +4,6 @@ imports: - core.nwb.base - core.nwb.misc - nwb.language -- core.nwb.behavior.include -- core.nwb.behavior default_prefix: core.nwb.behavior/ classes: SpatialSeries: @@ -39,6 +37,53 @@ classes: range: text required: false tree_root: true + SpatialSeries__data: + name: SpatialSeries__data + description: 1-D or 2-D array storing position or direction relative to some reference + frame. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. The default + value is 'meters'. Actual stored values are not necessarily stored in these + units. To access the data in these units, multiply 'data' by 'conversion' + and add 'offset'. + range: text + array: + name: array + range: SpatialSeries__data__Array + SpatialSeries__data__Array: + name: SpatialSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: numeric + required: true + x: + name: x + range: numeric + required: false + minimum_cardinality: 1 + maximum_cardinality: 1 + x,y: + name: x,y + range: numeric + required: false + minimum_cardinality: 2 + maximum_cardinality: 2 + x,y,z: + name: x,y,z + range: numeric + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 BehavioralEpochs: name: BehavioralEpochs description: TimeSeries for storing behavioral epochs. The objective of this diff --git a/nwb_linkml/schema/core.nwb.device.yaml b/nwb_linkml/schema/core.nwb.device.yaml index 6914cdf..9a2af16 100644 --- a/nwb_linkml/schema/core.nwb.device.yaml +++ b/nwb_linkml/schema/core.nwb.device.yaml @@ -3,7 +3,6 @@ id: core.nwb.device imports: - core.nwb.base - nwb.language -- core.nwb.device default_prefix: core.nwb.device/ classes: Device: diff --git a/nwb_linkml/schema/core.nwb.ecephys.include.yaml b/nwb_linkml/schema/core.nwb.ecephys.include.yaml deleted file mode 100644 index 0a58bbb..0000000 --- a/nwb_linkml/schema/core.nwb.ecephys.include.yaml +++ /dev/null @@ -1,187 +0,0 @@ -name: core.nwb.ecephys.include -id: core.nwb.ecephys.include -imports: -- core.nwb.base -- hdmf-common.table -- core.nwb.device -- nwb.language -- core.nwb.ecephys.include -- core.nwb.ecephys -default_prefix: core.nwb.ecephys.include/ -classes: - ElectricalSeries__data: - name: ElectricalSeries__data - description: Recorded voltage data. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. This value - is fixed to 'volts'. Actual stored values are not necessarily stored in - these units. To access the data in these units, multiply 'data' by 'conversion', - followed by 'channel_conversion' (if present), and then add 'offset'. - range: text - array: - name: array - range: ElectricalSeries__data__Array - ElectricalSeries__data__Array: - name: ElectricalSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: numeric - required: true - num_channels: - name: num_channels - range: numeric - required: false - num_samples: - name: num_samples - range: numeric - required: false - ElectricalSeries__electrodes: - name: ElectricalSeries__electrodes - description: DynamicTableRegion pointer to the electrodes that this time series - was generated from. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(electrodes) - range: string - required: true - equals_string: electrodes - SpikeEventSeries__data: - name: SpikeEventSeries__data - description: Spike waveforms. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Unit of measurement for waveforms, which is fixed to 'volts'. - range: text - array: - name: array - range: SpikeEventSeries__data__Array - SpikeEventSeries__data__Array: - name: SpikeEventSeries__data__Array - is_a: Arraylike - attributes: - num_events: - name: num_events - range: numeric - required: true - num_samples: - name: num_samples - range: numeric - required: true - num_channels: - name: num_channels - range: numeric - required: false - FeatureExtraction__features: - name: FeatureExtraction__features - description: Multi-dimensional array of features extracted from each event. - attributes: - name: - name: name - ifabsent: string(features) - range: string - required: true - equals_string: features - array: - name: array - range: FeatureExtraction__features__Array - FeatureExtraction__features__Array: - name: FeatureExtraction__features__Array - is_a: Arraylike - attributes: - num_events: - name: num_events - range: float32 - required: true - num_channels: - name: num_channels - range: float32 - required: true - num_features: - name: num_features - range: float32 - required: true - FeatureExtraction__electrodes: - name: FeatureExtraction__electrodes - description: DynamicTableRegion pointer to the electrodes that this time series - was generated from. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(electrodes) - range: string - required: true - equals_string: electrodes - ClusterWaveforms__waveform_mean: - name: ClusterWaveforms__waveform_mean - description: The mean waveform for each cluster, using the same indices for each - wave as cluster numbers in the associated Clustering module (i.e, cluster 3 - is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should - be empty (e.g., zero- filled) - attributes: - name: - name: name - ifabsent: string(waveform_mean) - range: string - required: true - equals_string: waveform_mean - array: - name: array - range: ClusterWaveforms__waveform_mean__Array - ClusterWaveforms__waveform_mean__Array: - name: ClusterWaveforms__waveform_mean__Array - is_a: Arraylike - attributes: - num_clusters: - name: num_clusters - range: float32 - required: true - num_samples: - name: num_samples - range: float32 - required: true - ClusterWaveforms__waveform_sd: - name: ClusterWaveforms__waveform_sd - description: Stdev of waveforms for each cluster, using the same indices as in - mean - attributes: - name: - name: name - ifabsent: string(waveform_sd) - range: string - required: true - equals_string: waveform_sd - array: - name: array - range: ClusterWaveforms__waveform_sd__Array - ClusterWaveforms__waveform_sd__Array: - name: ClusterWaveforms__waveform_sd__Array - is_a: Arraylike - attributes: - num_clusters: - name: num_clusters - range: float32 - required: true - num_samples: - name: num_samples - range: float32 - required: true diff --git a/nwb_linkml/schema/core.nwb.ecephys.yaml b/nwb_linkml/schema/core.nwb.ecephys.yaml index 326b7d6..8d92a10 100644 --- a/nwb_linkml/schema/core.nwb.ecephys.yaml +++ b/nwb_linkml/schema/core.nwb.ecephys.yaml @@ -5,8 +5,6 @@ imports: - hdmf-common.table - core.nwb.device - nwb.language -- core.nwb.ecephys.include -- core.nwb.ecephys default_prefix: core.nwb.ecephys/ classes: ElectricalSeries: @@ -59,6 +57,54 @@ classes: range: float32 required: false tree_root: true + ElectricalSeries__data: + name: ElectricalSeries__data + description: Recorded voltage data. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. This value + is fixed to 'volts'. Actual stored values are not necessarily stored in + these units. To access the data in these units, multiply 'data' by 'conversion', + followed by 'channel_conversion' (if present), and then add 'offset'. + range: text + array: + name: array + range: ElectricalSeries__data__Array + ElectricalSeries__data__Array: + name: ElectricalSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: numeric + required: true + num_channels: + name: num_channels + range: numeric + required: false + num_samples: + name: num_samples + range: numeric + required: false + ElectricalSeries__electrodes: + name: ElectricalSeries__electrodes + description: DynamicTableRegion pointer to the electrodes that this time series + was generated from. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(electrodes) + range: string + required: true + equals_string: electrodes SpikeEventSeries: name: SpikeEventSeries description: 'Stores snapshots/snippets of recorded spike events (i.e., threshold @@ -91,6 +137,39 @@ classes: range: float64 required: true tree_root: true + SpikeEventSeries__data: + name: SpikeEventSeries__data + description: Spike waveforms. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Unit of measurement for waveforms, which is fixed to 'volts'. + range: text + array: + name: array + range: SpikeEventSeries__data__Array + SpikeEventSeries__data__Array: + name: SpikeEventSeries__data__Array + is_a: Arraylike + attributes: + num_events: + name: num_events + range: numeric + required: true + num_samples: + name: num_samples + range: numeric + required: true + num_channels: + name: num_channels + range: numeric + required: false FeatureExtraction: name: FeatureExtraction description: Features, such as PC1 and PC2, that are extracted from signals stored @@ -128,6 +207,47 @@ classes: range: FeatureExtraction__electrodes required: true tree_root: true + FeatureExtraction__features: + name: FeatureExtraction__features + description: Multi-dimensional array of features extracted from each event. + attributes: + name: + name: name + ifabsent: string(features) + range: string + required: true + equals_string: features + array: + name: array + range: FeatureExtraction__features__Array + FeatureExtraction__features__Array: + name: FeatureExtraction__features__Array + is_a: Arraylike + attributes: + num_events: + name: num_events + range: float32 + required: true + num_channels: + name: num_channels + range: float32 + required: true + num_features: + name: num_features + range: float32 + required: true + FeatureExtraction__electrodes: + name: FeatureExtraction__electrodes + description: DynamicTableRegion pointer to the electrodes that this time series + was generated from. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(electrodes) + range: string + required: true + equals_string: electrodes EventDetection: name: EventDetection description: Detected spike events from voltage trace(s). @@ -287,6 +407,60 @@ classes: range: ClusterWaveforms__waveform_sd required: true tree_root: true + ClusterWaveforms__waveform_mean: + name: ClusterWaveforms__waveform_mean + description: The mean waveform for each cluster, using the same indices for each + wave as cluster numbers in the associated Clustering module (i.e, cluster 3 + is in array slot [3]). Waveforms corresponding to gaps in cluster sequence should + be empty (e.g., zero- filled) + attributes: + name: + name: name + ifabsent: string(waveform_mean) + range: string + required: true + equals_string: waveform_mean + array: + name: array + range: ClusterWaveforms__waveform_mean__Array + ClusterWaveforms__waveform_mean__Array: + name: ClusterWaveforms__waveform_mean__Array + is_a: Arraylike + attributes: + num_clusters: + name: num_clusters + range: float32 + required: true + num_samples: + name: num_samples + range: float32 + required: true + ClusterWaveforms__waveform_sd: + name: ClusterWaveforms__waveform_sd + description: Stdev of waveforms for each cluster, using the same indices as in + mean + attributes: + name: + name: name + ifabsent: string(waveform_sd) + range: string + required: true + equals_string: waveform_sd + array: + name: array + range: ClusterWaveforms__waveform_sd__Array + ClusterWaveforms__waveform_sd__Array: + name: ClusterWaveforms__waveform_sd__Array + is_a: Arraylike + attributes: + num_clusters: + name: num_clusters + range: float32 + required: true + num_samples: + name: num_samples + range: float32 + required: true Clustering: name: Clustering description: DEPRECATED Clustered spike data, whether from automatic clustering diff --git a/nwb_linkml/schema/core.nwb.epoch.include.yaml b/nwb_linkml/schema/core.nwb.epoch.include.yaml deleted file mode 100644 index 0fb19ac..0000000 --- a/nwb_linkml/schema/core.nwb.epoch.include.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: core.nwb.epoch.include -id: core.nwb.epoch.include -imports: -- hdmf-common.table -- core.nwb.base -- nwb.language -- core.nwb.epoch.include -- core.nwb.epoch -default_prefix: core.nwb.epoch.include/ -classes: - TimeIntervals__tags_index: - name: TimeIntervals__tags_index - description: Index for tags. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(tags_index) - range: string - required: true - equals_string: tags_index - TimeIntervals__timeseries: - name: TimeIntervals__timeseries - description: An index into a TimeSeries object. - is_a: TimeSeriesReferenceVectorData - attributes: - name: - name: name - ifabsent: string(timeseries) - range: string - required: true - equals_string: timeseries - TimeIntervals__timeseries_index: - name: TimeIntervals__timeseries_index - description: Index for timeseries. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(timeseries_index) - range: string - required: true - equals_string: timeseries_index diff --git a/nwb_linkml/schema/core.nwb.epoch.yaml b/nwb_linkml/schema/core.nwb.epoch.yaml index 211c2bc..5ed8973 100644 --- a/nwb_linkml/schema/core.nwb.epoch.yaml +++ b/nwb_linkml/schema/core.nwb.epoch.yaml @@ -4,8 +4,6 @@ imports: - hdmf-common.table - core.nwb.base - nwb.language -- core.nwb.epoch.include -- core.nwb.epoch default_prefix: core.nwb.epoch/ classes: TimeIntervals: @@ -52,3 +50,36 @@ classes: range: TimeIntervals__timeseries_index required: false tree_root: true + TimeIntervals__tags_index: + name: TimeIntervals__tags_index + description: Index for tags. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(tags_index) + range: string + required: true + equals_string: tags_index + TimeIntervals__timeseries: + name: TimeIntervals__timeseries + description: An index into a TimeSeries object. + is_a: TimeSeriesReferenceVectorData + attributes: + name: + name: name + ifabsent: string(timeseries) + range: string + required: true + equals_string: timeseries + TimeIntervals__timeseries_index: + name: TimeIntervals__timeseries_index + description: Index for timeseries. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(timeseries_index) + range: string + required: true + equals_string: timeseries_index diff --git a/nwb_linkml/schema/core.nwb.file.include.yaml b/nwb_linkml/schema/core.nwb.file.include.yaml deleted file mode 100644 index 1889d2f..0000000 --- a/nwb_linkml/schema/core.nwb.file.include.yaml +++ /dev/null @@ -1,399 +0,0 @@ -name: core.nwb.file.include -id: core.nwb.file.include -imports: -- core.nwb.base -- hdmf-common.table -- core.nwb.device -- core.nwb.ecephys -- core.nwb.icephys -- core.nwb.ogen -- core.nwb.ophys -- core.nwb.epoch -- core.nwb.misc -- nwb.language -- core.nwb.file.include -- core.nwb.file -default_prefix: core.nwb.file.include/ -classes: - NWBFile__stimulus: - name: NWBFile__stimulus - description: Data pushed into the system (eg, video stimulus, sound, voltage, - etc) and secondary representations of that data (eg, measurements of something - used as a stimulus). This group should be made read-only after experiment complete - and timestamps are corrected to common timebase. Stores both presented stimuli - and stimulus templates, the latter in case the same stimulus is presented multiple - times, or is pulled from an external stimulus library. Stimuli are here defined - as any signal that is pushed into the system as part of the experiment (eg, - sound, video, voltage, etc). Many different experiments can use the same stimuli, - and stimuli can be re-used during an experiment. The stimulus group is organized - so that one version of template stimuli can be stored and these be used multiple - times. These templates can exist in the present file or can be linked to a remote - library file. - attributes: - name: - name: name - ifabsent: string(stimulus) - range: string - required: true - equals_string: stimulus - presentation: - name: presentation - description: Stimuli presented during the experiment. - multivalued: true - any_of: - - range: TimeSeries - templates: - name: templates - description: Template stimuli. Timestamps in templates are based on stimulus - design and are relative to the beginning of the stimulus. When templates - are used, the stimulus instances must convert presentation times to the - experiment`s time reference frame. - multivalued: true - any_of: - - range: TimeSeries - - range: Images - NWBFile__general: - name: NWBFile__general - description: Experimental metadata, including protocol, notes and description - of hardware device(s). The metadata stored in this section should be used to - describe the experiment. Metadata necessary for interpreting the data is stored - with the data. General experimental metadata, including animal strain, experimental - protocols, experimenter, devices, etc, are stored under 'general'. Core metadata - (e.g., that required to interpret data fields) is stored with the data itself, - and implicitly defined by the file specification (e.g., time is in seconds). - The strategy used here for storing non-core metadata is to use free-form text - fields, such as would appear in sentences or paragraphs from a Methods section. - Metadata fields are text to enable them to be more general, for example to represent - ranges instead of numerical values. Machine-readable metadata is stored as attributes - to these free-form datasets. All entries in the below table are to be included - when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology - experiment) should not be created unless there is data to store within them. - attributes: - name: - name: name - ifabsent: string(general) - range: string - required: true - equals_string: general - data_collection: - name: data_collection - description: Notes about data collection and analysis. - multivalued: false - range: text - required: false - experiment_description: - name: experiment_description - description: General description of the experiment. - multivalued: false - range: text - required: false - experimenter: - name: experimenter - description: Name of person(s) who performed the experiment. Can also specify - roles of different people involved. - multivalued: true - range: text - required: false - institution: - name: institution - description: Institution(s) where experiment was performed. - multivalued: false - range: text - required: false - keywords: - name: keywords - description: Terms to search over. - multivalued: true - range: text - required: false - lab: - name: lab - description: Laboratory where experiment was performed. - multivalued: false - range: text - required: false - notes: - name: notes - description: Notes about the experiment. - multivalued: false - range: text - required: false - pharmacology: - name: pharmacology - description: Description of drugs used, including how and when they were administered. - Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc. - multivalued: false - range: text - required: false - protocol: - name: protocol - description: Experimental protocol, if applicable. e.g., include IACUC protocol - number. - multivalued: false - range: text - required: false - related_publications: - name: related_publications - description: Publication information. PMID, DOI, URL, etc. - multivalued: true - range: text - required: false - session_id: - name: session_id - description: Lab-specific ID for the session. - multivalued: false - range: text - required: false - slices: - name: slices - description: Description of slices, including information about preparation - thickness, orientation, temperature, and bath solution. - multivalued: false - range: text - required: false - source_script: - name: source_script - description: Script file or link to public source code used to create this - NWB file. - multivalued: false - range: NWBFile__general__source_script - required: false - stimulus: - name: stimulus - description: Notes about stimuli, such as how and where they were presented. - multivalued: false - range: text - required: false - surgery: - name: surgery - description: Narrative description about surgery/surgeries, including date(s) - and who performed surgery. - multivalued: false - range: text - required: false - virus: - name: virus - description: Information about virus(es) used in experiments, including virus - ID, source, date made, injection location, volume, etc. - multivalued: false - range: text - required: false - lab_meta_data: - name: lab_meta_data - description: Place-holder than can be extended so that lab-specific meta-data - can be placed in /general. - multivalued: true - range: LabMetaData - required: false - devices: - name: devices - description: Description of hardware devices used during experiment, e.g., - monitors, ADC boards, microscopes, etc. - multivalued: true - any_of: - - range: Device - subject: - name: subject - description: Information about the animal or person from which the data was - measured. - multivalued: false - range: Subject - required: false - extracellular_ephys: - name: extracellular_ephys - description: Metadata related to extracellular electrophysiology. - multivalued: false - range: NWBFile__general__extracellular_ephys - required: false - intracellular_ephys: - name: intracellular_ephys - description: Metadata related to intracellular electrophysiology. - multivalued: false - range: NWBFile__general__intracellular_ephys - required: false - optogenetics: - name: optogenetics - description: Metadata describing optogenetic stimuluation. - multivalued: true - any_of: - - range: OptogeneticStimulusSite - optophysiology: - name: optophysiology - description: Metadata related to optophysiology. - multivalued: true - any_of: - - range: ImagingPlane - NWBFile__general__source_script: - name: NWBFile__general__source_script - description: Script file or link to public source code used to create this NWB - file. - attributes: - name: - name: name - ifabsent: string(source_script) - range: string - required: true - equals_string: source_script - file_name: - name: file_name - description: Name of script file. - range: text - NWBFile__general__extracellular_ephys: - name: NWBFile__general__extracellular_ephys - description: Metadata related to extracellular electrophysiology. - attributes: - name: - name: name - ifabsent: string(extracellular_ephys) - range: string - required: true - equals_string: extracellular_ephys - electrode_group: - name: electrode_group - description: Physical group of electrodes. - multivalued: true - range: ElectrodeGroup - required: false - electrodes: - name: electrodes - description: A table of all electrodes (i.e. channels) used for recording. - multivalued: false - range: DynamicTable - required: false - NWBFile__general__intracellular_ephys: - name: NWBFile__general__intracellular_ephys - description: Metadata related to intracellular electrophysiology. - attributes: - name: - name: name - ifabsent: string(intracellular_ephys) - range: string - required: true - equals_string: intracellular_ephys - filtering: - name: filtering - description: '[DEPRECATED] Use IntracellularElectrode.filtering instead. Description - of filtering used. Includes filtering type and parameters, frequency fall-off, - etc. If this changes between TimeSeries, filter description should be stored - as a text attribute for each TimeSeries.' - multivalued: false - range: text - required: false - intracellular_electrode: - name: intracellular_electrode - description: An intracellular electrode. - multivalued: true - range: IntracellularElectrode - required: false - sweep_table: - name: sweep_table - description: '[DEPRECATED] Table used to group different PatchClampSeries. - SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable - tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions - tables provide enhanced support for experiment metadata.' - multivalued: false - range: SweepTable - required: false - intracellular_recordings: - name: intracellular_recordings - description: A table to group together a stimulus and response from a single - electrode and a single simultaneous recording. Each row in the table represents - a single recording consisting typically of a stimulus and a corresponding - response. In some cases, however, only a stimulus or a response are recorded - as as part of an experiment. In this case both, the stimulus and response - will point to the same TimeSeries while the idx_start and count of the invalid - column will be set to -1, thus, indicating that no values have been recorded - for the stimulus or response, respectively. Note, a recording MUST contain - at least a stimulus or a response. Typically the stimulus and response are - PatchClampSeries. However, the use of AD/DA channels that are not associated - to an electrode is also common in intracellular electrophysiology, in which - case other TimeSeries may be used. - multivalued: false - range: IntracellularRecordingsTable - required: false - simultaneous_recordings: - name: simultaneous_recordings - description: A table for grouping different intracellular recordings from - the IntracellularRecordingsTable table together that were recorded simultaneously - from different electrodes - multivalued: false - range: SimultaneousRecordingsTable - required: false - sequential_recordings: - name: sequential_recordings - description: A table for grouping different sequential recordings from the - SimultaneousRecordingsTable table together. This is typically used to group - together sequential recordings where the a sequence of stimuli of the same - type with varying parameters have been presented in a sequence. - multivalued: false - range: SequentialRecordingsTable - required: false - repetitions: - name: repetitions - description: A table for grouping different sequential intracellular recordings - together. With each SequentialRecording typically representing a particular - type of stimulus, the RepetitionsTable table is typically used to group - sets of stimuli applied in sequence. - multivalued: false - range: RepetitionsTable - required: false - experimental_conditions: - name: experimental_conditions - description: A table for grouping different intracellular recording repetitions - together that belong to the same experimental experimental_conditions. - multivalued: false - range: ExperimentalConditionsTable - required: false - NWBFile__intervals: - name: NWBFile__intervals - description: Experimental intervals, whether that be logically distinct sub-experiments - having a particular scientific goal, trials (see trials subgroup) during an - experiment, or epochs (see epochs subgroup) deriving from analysis of data. - attributes: - name: - name: name - ifabsent: string(intervals) - range: string - required: true - equals_string: intervals - epochs: - name: epochs - description: Divisions in time marking experimental stages or sub-divisions - of a single recording session. - multivalued: false - range: TimeIntervals - required: false - trials: - name: trials - description: Repeated experimental events that have a logical grouping. - multivalued: false - range: TimeIntervals - required: false - invalid_times: - name: invalid_times - description: Time intervals that should be removed from analysis. - multivalued: false - range: TimeIntervals - required: false - time_intervals: - name: time_intervals - description: Optional additional table(s) for describing other experimental - time intervals. - multivalued: true - range: TimeIntervals - required: false - Subject__age: - name: Subject__age - description: Age of subject. Can be supplied instead of 'date_of_birth'. - attributes: - name: - name: name - ifabsent: string(age) - range: string - required: true - equals_string: age - reference: - name: reference - description: Age is with reference to this event. Can be 'birth' or 'gestational'. - If reference is omitted, 'birth' is implied. - range: text diff --git a/nwb_linkml/schema/core.nwb.file.yaml b/nwb_linkml/schema/core.nwb.file.yaml index ef4a16f..e7c4967 100644 --- a/nwb_linkml/schema/core.nwb.file.yaml +++ b/nwb_linkml/schema/core.nwb.file.yaml @@ -11,8 +11,6 @@ imports: - core.nwb.epoch - core.nwb.misc - nwb.language -- core.nwb.file.include -- core.nwb.file default_prefix: core.nwb.file/ classes: ScratchData: @@ -199,6 +197,377 @@ classes: range: Units required: false tree_root: true + NWBFile__stimulus: + name: NWBFile__stimulus + description: Data pushed into the system (eg, video stimulus, sound, voltage, + etc) and secondary representations of that data (eg, measurements of something + used as a stimulus). This group should be made read-only after experiment complete + and timestamps are corrected to common timebase. Stores both presented stimuli + and stimulus templates, the latter in case the same stimulus is presented multiple + times, or is pulled from an external stimulus library. Stimuli are here defined + as any signal that is pushed into the system as part of the experiment (eg, + sound, video, voltage, etc). Many different experiments can use the same stimuli, + and stimuli can be re-used during an experiment. The stimulus group is organized + so that one version of template stimuli can be stored and these be used multiple + times. These templates can exist in the present file or can be linked to a remote + library file. + attributes: + name: + name: name + ifabsent: string(stimulus) + range: string + required: true + equals_string: stimulus + presentation: + name: presentation + description: Stimuli presented during the experiment. + multivalued: true + any_of: + - range: TimeSeries + templates: + name: templates + description: Template stimuli. Timestamps in templates are based on stimulus + design and are relative to the beginning of the stimulus. When templates + are used, the stimulus instances must convert presentation times to the + experiment`s time reference frame. + multivalued: true + any_of: + - range: TimeSeries + - range: Images + NWBFile__general: + name: NWBFile__general + description: Experimental metadata, including protocol, notes and description + of hardware device(s). The metadata stored in this section should be used to + describe the experiment. Metadata necessary for interpreting the data is stored + with the data. General experimental metadata, including animal strain, experimental + protocols, experimenter, devices, etc, are stored under 'general'. Core metadata + (e.g., that required to interpret data fields) is stored with the data itself, + and implicitly defined by the file specification (e.g., time is in seconds). + The strategy used here for storing non-core metadata is to use free-form text + fields, such as would appear in sentences or paragraphs from a Methods section. + Metadata fields are text to enable them to be more general, for example to represent + ranges instead of numerical values. Machine-readable metadata is stored as attributes + to these free-form datasets. All entries in the below table are to be included + when data is present. Unused groups (e.g., intracellular_ephys in an optophysiology + experiment) should not be created unless there is data to store within them. + attributes: + name: + name: name + ifabsent: string(general) + range: string + required: true + equals_string: general + data_collection: + name: data_collection + description: Notes about data collection and analysis. + multivalued: false + range: text + required: false + experiment_description: + name: experiment_description + description: General description of the experiment. + multivalued: false + range: text + required: false + experimenter: + name: experimenter + description: Name of person(s) who performed the experiment. Can also specify + roles of different people involved. + multivalued: true + range: text + required: false + institution: + name: institution + description: Institution(s) where experiment was performed. + multivalued: false + range: text + required: false + keywords: + name: keywords + description: Terms to search over. + multivalued: true + range: text + required: false + lab: + name: lab + description: Laboratory where experiment was performed. + multivalued: false + range: text + required: false + notes: + name: notes + description: Notes about the experiment. + multivalued: false + range: text + required: false + pharmacology: + name: pharmacology + description: Description of drugs used, including how and when they were administered. + Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc. + multivalued: false + range: text + required: false + protocol: + name: protocol + description: Experimental protocol, if applicable. e.g., include IACUC protocol + number. + multivalued: false + range: text + required: false + related_publications: + name: related_publications + description: Publication information. PMID, DOI, URL, etc. + multivalued: true + range: text + required: false + session_id: + name: session_id + description: Lab-specific ID for the session. + multivalued: false + range: text + required: false + slices: + name: slices + description: Description of slices, including information about preparation + thickness, orientation, temperature, and bath solution. + multivalued: false + range: text + required: false + source_script: + name: source_script + description: Script file or link to public source code used to create this + NWB file. + multivalued: false + range: NWBFile__general__source_script + required: false + stimulus: + name: stimulus + description: Notes about stimuli, such as how and where they were presented. + multivalued: false + range: text + required: false + surgery: + name: surgery + description: Narrative description about surgery/surgeries, including date(s) + and who performed surgery. + multivalued: false + range: text + required: false + virus: + name: virus + description: Information about virus(es) used in experiments, including virus + ID, source, date made, injection location, volume, etc. + multivalued: false + range: text + required: false + lab_meta_data: + name: lab_meta_data + description: Place-holder than can be extended so that lab-specific meta-data + can be placed in /general. + multivalued: true + range: LabMetaData + required: false + devices: + name: devices + description: Description of hardware devices used during experiment, e.g., + monitors, ADC boards, microscopes, etc. + multivalued: true + any_of: + - range: Device + subject: + name: subject + description: Information about the animal or person from which the data was + measured. + multivalued: false + range: Subject + required: false + extracellular_ephys: + name: extracellular_ephys + description: Metadata related to extracellular electrophysiology. + multivalued: false + range: NWBFile__general__extracellular_ephys + required: false + intracellular_ephys: + name: intracellular_ephys + description: Metadata related to intracellular electrophysiology. + multivalued: false + range: NWBFile__general__intracellular_ephys + required: false + optogenetics: + name: optogenetics + description: Metadata describing optogenetic stimuluation. + multivalued: true + any_of: + - range: OptogeneticStimulusSite + optophysiology: + name: optophysiology + description: Metadata related to optophysiology. + multivalued: true + any_of: + - range: ImagingPlane + NWBFile__general__source_script: + name: NWBFile__general__source_script + description: Script file or link to public source code used to create this NWB + file. + attributes: + name: + name: name + ifabsent: string(source_script) + range: string + required: true + equals_string: source_script + file_name: + name: file_name + description: Name of script file. + range: text + value: + name: value + range: text + required: true + NWBFile__general__extracellular_ephys: + name: NWBFile__general__extracellular_ephys + description: Metadata related to extracellular electrophysiology. + attributes: + name: + name: name + ifabsent: string(extracellular_ephys) + range: string + required: true + equals_string: extracellular_ephys + electrode_group: + name: electrode_group + description: Physical group of electrodes. + multivalued: true + range: ElectrodeGroup + required: false + electrodes: + name: electrodes + description: A table of all electrodes (i.e. channels) used for recording. + multivalued: false + range: DynamicTable + required: false + NWBFile__general__intracellular_ephys: + name: NWBFile__general__intracellular_ephys + description: Metadata related to intracellular electrophysiology. + attributes: + name: + name: name + ifabsent: string(intracellular_ephys) + range: string + required: true + equals_string: intracellular_ephys + filtering: + name: filtering + description: '[DEPRECATED] Use IntracellularElectrode.filtering instead. Description + of filtering used. Includes filtering type and parameters, frequency fall-off, + etc. If this changes between TimeSeries, filter description should be stored + as a text attribute for each TimeSeries.' + multivalued: false + range: text + required: false + intracellular_electrode: + name: intracellular_electrode + description: An intracellular electrode. + multivalued: true + range: IntracellularElectrode + required: false + sweep_table: + name: sweep_table + description: '[DEPRECATED] Table used to group different PatchClampSeries. + SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable + tables. Additional SequentialRecordingsTable, RepetitionsTable and ExperimentalConditions + tables provide enhanced support for experiment metadata.' + multivalued: false + range: SweepTable + required: false + intracellular_recordings: + name: intracellular_recordings + description: A table to group together a stimulus and response from a single + electrode and a single simultaneous recording. Each row in the table represents + a single recording consisting typically of a stimulus and a corresponding + response. In some cases, however, only a stimulus or a response are recorded + as as part of an experiment. In this case both, the stimulus and response + will point to the same TimeSeries while the idx_start and count of the invalid + column will be set to -1, thus, indicating that no values have been recorded + for the stimulus or response, respectively. Note, a recording MUST contain + at least a stimulus or a response. Typically the stimulus and response are + PatchClampSeries. However, the use of AD/DA channels that are not associated + to an electrode is also common in intracellular electrophysiology, in which + case other TimeSeries may be used. + multivalued: false + range: IntracellularRecordingsTable + required: false + simultaneous_recordings: + name: simultaneous_recordings + description: A table for grouping different intracellular recordings from + the IntracellularRecordingsTable table together that were recorded simultaneously + from different electrodes + multivalued: false + range: SimultaneousRecordingsTable + required: false + sequential_recordings: + name: sequential_recordings + description: A table for grouping different sequential recordings from the + SimultaneousRecordingsTable table together. This is typically used to group + together sequential recordings where the a sequence of stimuli of the same + type with varying parameters have been presented in a sequence. + multivalued: false + range: SequentialRecordingsTable + required: false + repetitions: + name: repetitions + description: A table for grouping different sequential intracellular recordings + together. With each SequentialRecording typically representing a particular + type of stimulus, the RepetitionsTable table is typically used to group + sets of stimuli applied in sequence. + multivalued: false + range: RepetitionsTable + required: false + experimental_conditions: + name: experimental_conditions + description: A table for grouping different intracellular recording repetitions + together that belong to the same experimental experimental_conditions. + multivalued: false + range: ExperimentalConditionsTable + required: false + NWBFile__intervals: + name: NWBFile__intervals + description: Experimental intervals, whether that be logically distinct sub-experiments + having a particular scientific goal, trials (see trials subgroup) during an + experiment, or epochs (see epochs subgroup) deriving from analysis of data. + attributes: + name: + name: name + ifabsent: string(intervals) + range: string + required: true + equals_string: intervals + epochs: + name: epochs + description: Divisions in time marking experimental stages or sub-divisions + of a single recording session. + multivalued: false + range: TimeIntervals + required: false + trials: + name: trials + description: Repeated experimental events that have a logical grouping. + multivalued: false + range: TimeIntervals + required: false + invalid_times: + name: invalid_times + description: Time intervals that should be removed from analysis. + multivalued: false + range: TimeIntervals + required: false + time_intervals: + name: time_intervals + description: Optional additional table(s) for describing other experimental + time intervals. + multivalued: true + range: TimeIntervals + required: false LabMetaData: name: LabMetaData description: Lab-specific meta-data. @@ -275,3 +644,22 @@ classes: range: text required: false tree_root: true + Subject__age: + name: Subject__age + description: Age of subject. Can be supplied instead of 'date_of_birth'. + attributes: + name: + name: name + ifabsent: string(age) + range: string + required: true + equals_string: age + reference: + name: reference + description: Age is with reference to this event. Can be 'birth' or 'gestational'. + If reference is omitted, 'birth' is implied. + range: text + value: + name: value + range: text + required: true diff --git a/nwb_linkml/schema/core.nwb.icephys.include.yaml b/nwb_linkml/schema/core.nwb.icephys.include.yaml deleted file mode 100644 index d9c0cc2..0000000 --- a/nwb_linkml/schema/core.nwb.icephys.include.yaml +++ /dev/null @@ -1,332 +0,0 @@ -name: core.nwb.icephys.include -id: core.nwb.icephys.include -imports: -- core.nwb.base -- core.nwb.device -- hdmf-common.table -- nwb.language -- core.nwb.icephys.include -- core.nwb.icephys -default_prefix: core.nwb.icephys.include/ -classes: - CurrentClampSeries__data: - name: CurrentClampSeries__data - description: Recorded voltage. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. which is - fixed to 'volts'. Actual stored values are not necessarily stored in these - units. To access the data in these units, multiply 'data' by 'conversion' - and add 'offset'. - range: text - CurrentClampStimulusSeries__data: - name: CurrentClampStimulusSeries__data - description: Stimulus current applied. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. which is - fixed to 'amperes'. Actual stored values are not necessarily stored in these - units. To access the data in these units, multiply 'data' by 'conversion' - and add 'offset'. - range: text - VoltageClampSeries__data: - name: VoltageClampSeries__data - description: Recorded current. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. which is - fixed to 'amperes'. Actual stored values are not necessarily stored in these - units. To access the data in these units, multiply 'data' by 'conversion' - and add 'offset'. - range: text - VoltageClampSeries__capacitance_fast: - name: VoltageClampSeries__capacitance_fast - description: Fast capacitance, in farads. - attributes: - name: - name: name - ifabsent: string(capacitance_fast) - range: string - required: true - equals_string: capacitance_fast - unit: - name: unit - description: Unit of measurement for capacitance_fast, which is fixed to 'farads'. - range: text - VoltageClampSeries__capacitance_slow: - name: VoltageClampSeries__capacitance_slow - description: Slow capacitance, in farads. - attributes: - name: - name: name - ifabsent: string(capacitance_slow) - range: string - required: true - equals_string: capacitance_slow - unit: - name: unit - description: Unit of measurement for capacitance_fast, which is fixed to 'farads'. - range: text - VoltageClampSeries__resistance_comp_bandwidth: - name: VoltageClampSeries__resistance_comp_bandwidth - description: Resistance compensation bandwidth, in hertz. - attributes: - name: - name: name - ifabsent: string(resistance_comp_bandwidth) - range: string - required: true - equals_string: resistance_comp_bandwidth - unit: - name: unit - description: Unit of measurement for resistance_comp_bandwidth, which is fixed - to 'hertz'. - range: text - VoltageClampSeries__resistance_comp_correction: - name: VoltageClampSeries__resistance_comp_correction - description: Resistance compensation correction, in percent. - attributes: - name: - name: name - ifabsent: string(resistance_comp_correction) - range: string - required: true - equals_string: resistance_comp_correction - unit: - name: unit - description: Unit of measurement for resistance_comp_correction, which is - fixed to 'percent'. - range: text - VoltageClampSeries__resistance_comp_prediction: - name: VoltageClampSeries__resistance_comp_prediction - description: Resistance compensation prediction, in percent. - attributes: - name: - name: name - ifabsent: string(resistance_comp_prediction) - range: string - required: true - equals_string: resistance_comp_prediction - unit: - name: unit - description: Unit of measurement for resistance_comp_prediction, which is - fixed to 'percent'. - range: text - VoltageClampSeries__whole_cell_capacitance_comp: - name: VoltageClampSeries__whole_cell_capacitance_comp - description: Whole cell capacitance compensation, in farads. - attributes: - name: - name: name - ifabsent: string(whole_cell_capacitance_comp) - range: string - required: true - equals_string: whole_cell_capacitance_comp - unit: - name: unit - description: Unit of measurement for whole_cell_capacitance_comp, which is - fixed to 'farads'. - range: text - VoltageClampSeries__whole_cell_series_resistance_comp: - name: VoltageClampSeries__whole_cell_series_resistance_comp - description: Whole cell series resistance compensation, in ohms. - attributes: - name: - name: name - ifabsent: string(whole_cell_series_resistance_comp) - range: string - required: true - equals_string: whole_cell_series_resistance_comp - unit: - name: unit - description: Unit of measurement for whole_cell_series_resistance_comp, which - is fixed to 'ohms'. - range: text - VoltageClampStimulusSeries__data: - name: VoltageClampStimulusSeries__data - description: Stimulus voltage applied. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. which is - fixed to 'volts'. Actual stored values are not necessarily stored in these - units. To access the data in these units, multiply 'data' by 'conversion' - and add 'offset'. - range: text - SweepTable__series_index: - name: SweepTable__series_index - description: Index for series. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(series_index) - range: string - required: true - equals_string: series_index - IntracellularStimuliTable__stimulus: - name: IntracellularStimuliTable__stimulus - description: Column storing the reference to the recorded stimulus for the recording - (rows). - is_a: TimeSeriesReferenceVectorData - attributes: - name: - name: name - ifabsent: string(stimulus) - range: string - required: true - equals_string: stimulus - IntracellularResponsesTable__response: - name: IntracellularResponsesTable__response - description: Column storing the reference to the recorded response for the recording - (rows) - is_a: TimeSeriesReferenceVectorData - attributes: - name: - name: name - ifabsent: string(response) - range: string - required: true - equals_string: response - SimultaneousRecordingsTable__recordings: - name: SimultaneousRecordingsTable__recordings - description: A reference to one or more rows in the IntracellularRecordingsTable - table. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(recordings) - range: string - required: true - equals_string: recordings - table: - name: table - description: Reference to the IntracellularRecordingsTable table that this - table region applies to. This specializes the attribute inherited from DynamicTableRegion - to fix the type of table that can be referenced here. - range: IntracellularRecordingsTable - SimultaneousRecordingsTable__recordings_index: - name: SimultaneousRecordingsTable__recordings_index - description: Index dataset for the recordings column. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(recordings_index) - range: string - required: true - equals_string: recordings_index - SequentialRecordingsTable__simultaneous_recordings: - name: SequentialRecordingsTable__simultaneous_recordings - description: A reference to one or more rows in the SimultaneousRecordingsTable - table. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(simultaneous_recordings) - range: string - required: true - equals_string: simultaneous_recordings - table: - name: table - description: Reference to the SimultaneousRecordingsTable table that this - table region applies to. This specializes the attribute inherited from DynamicTableRegion - to fix the type of table that can be referenced here. - range: SimultaneousRecordingsTable - SequentialRecordingsTable__simultaneous_recordings_index: - name: SequentialRecordingsTable__simultaneous_recordings_index - description: Index dataset for the simultaneous_recordings column. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(simultaneous_recordings_index) - range: string - required: true - equals_string: simultaneous_recordings_index - RepetitionsTable__sequential_recordings: - name: RepetitionsTable__sequential_recordings - description: A reference to one or more rows in the SequentialRecordingsTable - table. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(sequential_recordings) - range: string - required: true - equals_string: sequential_recordings - table: - name: table - description: Reference to the SequentialRecordingsTable table that this table - region applies to. This specializes the attribute inherited from DynamicTableRegion - to fix the type of table that can be referenced here. - range: SequentialRecordingsTable - RepetitionsTable__sequential_recordings_index: - name: RepetitionsTable__sequential_recordings_index - description: Index dataset for the sequential_recordings column. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(sequential_recordings_index) - range: string - required: true - equals_string: sequential_recordings_index - ExperimentalConditionsTable__repetitions: - name: ExperimentalConditionsTable__repetitions - description: A reference to one or more rows in the RepetitionsTable table. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(repetitions) - range: string - required: true - equals_string: repetitions - table: - name: table - description: Reference to the RepetitionsTable table that this table region - applies to. This specializes the attribute inherited from DynamicTableRegion - to fix the type of table that can be referenced here. - range: RepetitionsTable - ExperimentalConditionsTable__repetitions_index: - name: ExperimentalConditionsTable__repetitions_index - description: Index dataset for the repetitions column. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(repetitions_index) - range: string - required: true - equals_string: repetitions_index diff --git a/nwb_linkml/schema/core.nwb.icephys.yaml b/nwb_linkml/schema/core.nwb.icephys.yaml index 078a9f1..a8a467d 100644 --- a/nwb_linkml/schema/core.nwb.icephys.yaml +++ b/nwb_linkml/schema/core.nwb.icephys.yaml @@ -5,8 +5,6 @@ imports: - core.nwb.device - hdmf-common.table - nwb.language -- core.nwb.icephys.include -- core.nwb.icephys default_prefix: core.nwb.icephys/ classes: PatchClampSeries: @@ -77,6 +75,27 @@ classes: range: float32 required: false tree_root: true + CurrentClampSeries__data: + name: CurrentClampSeries__data + description: Recorded voltage. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. which is + fixed to 'volts'. Actual stored values are not necessarily stored in these + units. To access the data in these units, multiply 'data' by 'conversion' + and add 'offset'. + range: text + value: + name: value + range: AnyType + required: true IZeroClampSeries: name: IZeroClampSeries description: Voltage data from an intracellular recording when all current and @@ -129,6 +148,27 @@ classes: range: CurrentClampStimulusSeries__data required: true tree_root: true + CurrentClampStimulusSeries__data: + name: CurrentClampStimulusSeries__data + description: Stimulus current applied. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. which is + fixed to 'amperes'. Actual stored values are not necessarily stored in these + units. To access the data in these units, multiply 'data' by 'conversion' + and add 'offset'. + range: text + value: + name: value + range: AnyType + required: true VoltageClampSeries: name: VoltageClampSeries description: Current data from an intracellular voltage-clamp recording. A corresponding @@ -189,6 +229,158 @@ classes: range: VoltageClampSeries__whole_cell_series_resistance_comp required: false tree_root: true + VoltageClampSeries__data: + name: VoltageClampSeries__data + description: Recorded current. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. which is + fixed to 'amperes'. Actual stored values are not necessarily stored in these + units. To access the data in these units, multiply 'data' by 'conversion' + and add 'offset'. + range: text + value: + name: value + range: AnyType + required: true + VoltageClampSeries__capacitance_fast: + name: VoltageClampSeries__capacitance_fast + description: Fast capacitance, in farads. + attributes: + name: + name: name + ifabsent: string(capacitance_fast) + range: string + required: true + equals_string: capacitance_fast + unit: + name: unit + description: Unit of measurement for capacitance_fast, which is fixed to 'farads'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__capacitance_slow: + name: VoltageClampSeries__capacitance_slow + description: Slow capacitance, in farads. + attributes: + name: + name: name + ifabsent: string(capacitance_slow) + range: string + required: true + equals_string: capacitance_slow + unit: + name: unit + description: Unit of measurement for capacitance_fast, which is fixed to 'farads'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__resistance_comp_bandwidth: + name: VoltageClampSeries__resistance_comp_bandwidth + description: Resistance compensation bandwidth, in hertz. + attributes: + name: + name: name + ifabsent: string(resistance_comp_bandwidth) + range: string + required: true + equals_string: resistance_comp_bandwidth + unit: + name: unit + description: Unit of measurement for resistance_comp_bandwidth, which is fixed + to 'hertz'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__resistance_comp_correction: + name: VoltageClampSeries__resistance_comp_correction + description: Resistance compensation correction, in percent. + attributes: + name: + name: name + ifabsent: string(resistance_comp_correction) + range: string + required: true + equals_string: resistance_comp_correction + unit: + name: unit + description: Unit of measurement for resistance_comp_correction, which is + fixed to 'percent'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__resistance_comp_prediction: + name: VoltageClampSeries__resistance_comp_prediction + description: Resistance compensation prediction, in percent. + attributes: + name: + name: name + ifabsent: string(resistance_comp_prediction) + range: string + required: true + equals_string: resistance_comp_prediction + unit: + name: unit + description: Unit of measurement for resistance_comp_prediction, which is + fixed to 'percent'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__whole_cell_capacitance_comp: + name: VoltageClampSeries__whole_cell_capacitance_comp + description: Whole cell capacitance compensation, in farads. + attributes: + name: + name: name + ifabsent: string(whole_cell_capacitance_comp) + range: string + required: true + equals_string: whole_cell_capacitance_comp + unit: + name: unit + description: Unit of measurement for whole_cell_capacitance_comp, which is + fixed to 'farads'. + range: text + value: + name: value + range: float32 + required: true + VoltageClampSeries__whole_cell_series_resistance_comp: + name: VoltageClampSeries__whole_cell_series_resistance_comp + description: Whole cell series resistance compensation, in ohms. + attributes: + name: + name: name + ifabsent: string(whole_cell_series_resistance_comp) + range: string + required: true + equals_string: whole_cell_series_resistance_comp + unit: + name: unit + description: Unit of measurement for whole_cell_series_resistance_comp, which + is fixed to 'ohms'. + range: text + value: + name: value + range: float32 + required: true VoltageClampStimulusSeries: name: VoltageClampStimulusSeries description: Stimulus voltage applied during a voltage clamp recording. @@ -205,6 +397,27 @@ classes: range: VoltageClampStimulusSeries__data required: true tree_root: true + VoltageClampStimulusSeries__data: + name: VoltageClampStimulusSeries__data + description: Stimulus voltage applied. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. which is + fixed to 'volts'. Actual stored values are not necessarily stored in these + units. To access the data in these units, multiply 'data' by 'conversion' + and add 'offset'. + range: text + value: + name: value + range: AnyType + required: true IntracellularElectrode: name: IntracellularElectrode description: An intracellular electrode and its metadata. @@ -294,6 +507,17 @@ classes: range: SweepTable__series_index required: true tree_root: true + SweepTable__series_index: + name: SweepTable__series_index + description: Index for series. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(series_index) + range: string + required: true + equals_string: series_index IntracellularElectrodesTable: name: IntracellularElectrodesTable description: Table for storing intracellular electrode related metadata. @@ -334,6 +558,18 @@ classes: range: IntracellularStimuliTable__stimulus required: true tree_root: true + IntracellularStimuliTable__stimulus: + name: IntracellularStimuliTable__stimulus + description: Column storing the reference to the recorded stimulus for the recording + (rows). + is_a: TimeSeriesReferenceVectorData + attributes: + name: + name: name + ifabsent: string(stimulus) + range: string + required: true + equals_string: stimulus IntracellularResponsesTable: name: IntracellularResponsesTable description: Table for storing intracellular response related metadata. @@ -355,6 +591,18 @@ classes: range: IntracellularResponsesTable__response required: true tree_root: true + IntracellularResponsesTable__response: + name: IntracellularResponsesTable__response + description: Column storing the reference to the recorded response for the recording + (rows) + is_a: TimeSeriesReferenceVectorData + attributes: + name: + name: name + ifabsent: string(response) + range: string + required: true + equals_string: response IntracellularRecordingsTable: name: IntracellularRecordingsTable description: A table to group together a stimulus and response from a single electrode @@ -427,6 +675,35 @@ classes: range: SimultaneousRecordingsTable__recordings_index required: true tree_root: true + SimultaneousRecordingsTable__recordings: + name: SimultaneousRecordingsTable__recordings + description: A reference to one or more rows in the IntracellularRecordingsTable + table. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(recordings) + range: string + required: true + equals_string: recordings + table: + name: table + description: Reference to the IntracellularRecordingsTable table that this + table region applies to. This specializes the attribute inherited from DynamicTableRegion + to fix the type of table that can be referenced here. + range: IntracellularRecordingsTable + SimultaneousRecordingsTable__recordings_index: + name: SimultaneousRecordingsTable__recordings_index + description: Index dataset for the recordings column. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(recordings_index) + range: string + required: true + equals_string: recordings_index SequentialRecordingsTable: name: SequentialRecordingsTable description: A table for grouping different sequential recordings from the SimultaneousRecordingsTable @@ -460,6 +737,35 @@ classes: multivalued: true range: text tree_root: true + SequentialRecordingsTable__simultaneous_recordings: + name: SequentialRecordingsTable__simultaneous_recordings + description: A reference to one or more rows in the SimultaneousRecordingsTable + table. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(simultaneous_recordings) + range: string + required: true + equals_string: simultaneous_recordings + table: + name: table + description: Reference to the SimultaneousRecordingsTable table that this + table region applies to. This specializes the attribute inherited from DynamicTableRegion + to fix the type of table that can be referenced here. + range: SimultaneousRecordingsTable + SequentialRecordingsTable__simultaneous_recordings_index: + name: SequentialRecordingsTable__simultaneous_recordings_index + description: Index dataset for the simultaneous_recordings column. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(simultaneous_recordings_index) + range: string + required: true + equals_string: simultaneous_recordings_index RepetitionsTable: name: RepetitionsTable description: A table for grouping different sequential intracellular recordings @@ -488,6 +794,35 @@ classes: range: RepetitionsTable__sequential_recordings_index required: true tree_root: true + RepetitionsTable__sequential_recordings: + name: RepetitionsTable__sequential_recordings + description: A reference to one or more rows in the SequentialRecordingsTable + table. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(sequential_recordings) + range: string + required: true + equals_string: sequential_recordings + table: + name: table + description: Reference to the SequentialRecordingsTable table that this table + region applies to. This specializes the attribute inherited from DynamicTableRegion + to fix the type of table that can be referenced here. + range: SequentialRecordingsTable + RepetitionsTable__sequential_recordings_index: + name: RepetitionsTable__sequential_recordings_index + description: Index dataset for the sequential_recordings column. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(sequential_recordings_index) + range: string + required: true + equals_string: sequential_recordings_index ExperimentalConditionsTable: name: ExperimentalConditionsTable description: A table for grouping different intracellular recording repetitions @@ -513,3 +848,31 @@ classes: range: ExperimentalConditionsTable__repetitions_index required: true tree_root: true + ExperimentalConditionsTable__repetitions: + name: ExperimentalConditionsTable__repetitions + description: A reference to one or more rows in the RepetitionsTable table. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(repetitions) + range: string + required: true + equals_string: repetitions + table: + name: table + description: Reference to the RepetitionsTable table that this table region + applies to. This specializes the attribute inherited from DynamicTableRegion + to fix the type of table that can be referenced here. + range: RepetitionsTable + ExperimentalConditionsTable__repetitions_index: + name: ExperimentalConditionsTable__repetitions_index + description: Index dataset for the repetitions column. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(repetitions_index) + range: string + required: true + equals_string: repetitions_index diff --git a/nwb_linkml/schema/core.nwb.image.include.yaml b/nwb_linkml/schema/core.nwb.image.include.yaml deleted file mode 100644 index 8eec5ca..0000000 --- a/nwb_linkml/schema/core.nwb.image.include.yaml +++ /dev/null @@ -1,156 +0,0 @@ -name: core.nwb.image.include -id: core.nwb.image.include -imports: -- core.nwb.base -- core.nwb.device -- nwb.language -- core.nwb.image.include -- core.nwb.image -default_prefix: core.nwb.image.include/ -classes: - GrayscaleImage__Array: - name: GrayscaleImage__Array - is_a: Arraylike - attributes: - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - RGBImage__Array: - name: RGBImage__Array - is_a: Arraylike - attributes: - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - r, g, b: - name: r, g, b - range: numeric - required: true - minimum_cardinality: 3 - maximum_cardinality: 3 - RGBAImage__Array: - name: RGBAImage__Array - is_a: Arraylike - attributes: - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - r, g, b, a: - name: r, g, b, a - range: numeric - required: true - minimum_cardinality: 4 - maximum_cardinality: 4 - ImageSeries__data: - name: ImageSeries__data - description: Binary data representing images across frames. If data are stored - in an external file, this should be an empty 3D array. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - array: - name: array - range: ImageSeries__data__Array - ImageSeries__data__Array: - name: ImageSeries__data__Array - is_a: Arraylike - attributes: - frame: - name: frame - range: numeric - required: true - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - z: - name: z - range: numeric - required: false - OpticalSeries__field_of_view: - name: OpticalSeries__field_of_view - description: Width, height and depth of image, or imaged area, in meters. - attributes: - name: - name: name - ifabsent: string(field_of_view) - range: string - required: true - equals_string: field_of_view - array: - name: array - range: OpticalSeries__field_of_view__Array - OpticalSeries__field_of_view__Array: - name: OpticalSeries__field_of_view__Array - is_a: Arraylike - attributes: - width, height: - name: width, height - range: float32 - required: false - minimum_cardinality: 2 - maximum_cardinality: 2 - width, height, depth: - name: width, height, depth - range: float32 - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 - OpticalSeries__data: - name: OpticalSeries__data - description: Images presented to subject, either grayscale or RGB - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - array: - name: array - range: OpticalSeries__data__Array - OpticalSeries__data__Array: - name: OpticalSeries__data__Array - is_a: Arraylike - attributes: - frame: - name: frame - range: numeric - required: true - x: - name: x - range: numeric - required: true - y: - name: y - range: numeric - required: true - r, g, b: - name: r, g, b - range: numeric - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 diff --git a/nwb_linkml/schema/core.nwb.image.yaml b/nwb_linkml/schema/core.nwb.image.yaml index 9a4e11a..7fced1d 100644 --- a/nwb_linkml/schema/core.nwb.image.yaml +++ b/nwb_linkml/schema/core.nwb.image.yaml @@ -4,8 +4,6 @@ imports: - core.nwb.base - core.nwb.device - nwb.language -- core.nwb.image.include -- core.nwb.image default_prefix: core.nwb.image/ classes: GrayscaleImage: @@ -21,6 +19,18 @@ classes: name: array range: GrayscaleImage__Array tree_root: true + GrayscaleImage__Array: + name: GrayscaleImage__Array + is_a: Arraylike + attributes: + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true RGBImage: name: RGBImage description: A color image. @@ -34,6 +44,24 @@ classes: name: array range: RGBImage__Array tree_root: true + RGBImage__Array: + name: RGBImage__Array + is_a: Arraylike + attributes: + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true + r, g, b: + name: r, g, b + range: numeric + required: true + minimum_cardinality: 3 + maximum_cardinality: 3 RGBAImage: name: RGBAImage description: A color image with transparency. @@ -47,6 +75,24 @@ classes: name: array range: RGBAImage__Array tree_root: true + RGBAImage__Array: + name: RGBAImage__Array + is_a: Arraylike + attributes: + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true + r, g, b, a: + name: r, g, b, a + range: numeric + required: true + minimum_cardinality: 4 + maximum_cardinality: 4 ImageSeries: name: ImageSeries description: General image data that is common between acquisition and stimulus @@ -94,6 +140,40 @@ classes: range: text required: false tree_root: true + ImageSeries__data: + name: ImageSeries__data + description: Binary data representing images across frames. If data are stored + in an external file, this should be an empty 3D array. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + array: + name: array + range: ImageSeries__data__Array + ImageSeries__data__Array: + name: ImageSeries__data__Array + is_a: Arraylike + attributes: + frame: + name: frame + range: numeric + required: true + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true + z: + name: z + range: numeric + required: false ImageMaskSeries: name: ImageMaskSeries description: An alpha mask that is applied to a presented visual stimulus. The @@ -147,6 +227,70 @@ classes: range: text required: false tree_root: true + OpticalSeries__field_of_view: + name: OpticalSeries__field_of_view + description: Width, height and depth of image, or imaged area, in meters. + attributes: + name: + name: name + ifabsent: string(field_of_view) + range: string + required: true + equals_string: field_of_view + array: + name: array + range: OpticalSeries__field_of_view__Array + OpticalSeries__field_of_view__Array: + name: OpticalSeries__field_of_view__Array + is_a: Arraylike + attributes: + width, height: + name: width, height + range: float32 + required: false + minimum_cardinality: 2 + maximum_cardinality: 2 + width, height, depth: + name: width, height, depth + range: float32 + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 + OpticalSeries__data: + name: OpticalSeries__data + description: Images presented to subject, either grayscale or RGB + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + array: + name: array + range: OpticalSeries__data__Array + OpticalSeries__data__Array: + name: OpticalSeries__data__Array + is_a: Arraylike + attributes: + frame: + name: frame + range: numeric + required: true + x: + name: x + range: numeric + required: true + y: + name: y + range: numeric + required: true + r, g, b: + name: r, g, b + range: numeric + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 IndexSeries: name: IndexSeries description: Stores indices to image frames stored in an ImageSeries. The purpose diff --git a/nwb_linkml/schema/core.nwb.misc.include.yaml b/nwb_linkml/schema/core.nwb.misc.include.yaml deleted file mode 100644 index b0c0319..0000000 --- a/nwb_linkml/schema/core.nwb.misc.include.yaml +++ /dev/null @@ -1,266 +0,0 @@ -name: core.nwb.misc.include -id: core.nwb.misc.include -imports: -- core.nwb.base -- hdmf-common.table -- core.nwb.ecephys -- nwb.language -- core.nwb.misc.include -- core.nwb.misc -default_prefix: core.nwb.misc.include/ -classes: - AbstractFeatureSeries__data: - name: AbstractFeatureSeries__data - description: Values of each feature at each time. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Since there can be different units for different features, store - the units in 'feature_units'. The default value for this attribute is "see - 'feature_units'". - range: text - array: - name: array - range: AbstractFeatureSeries__data__Array - AbstractFeatureSeries__data__Array: - name: AbstractFeatureSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: numeric - required: true - num_features: - name: num_features - range: numeric - required: false - DecompositionSeries__data: - name: DecompositionSeries__data - description: Data decomposed into frequency bands. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - unit: - name: unit - description: Base unit of measurement for working with the data. Actual stored - values are not necessarily stored in these units. To access the data in - these units, multiply 'data' by 'conversion'. - range: text - array: - name: array - range: DecompositionSeries__data__Array - DecompositionSeries__data__Array: - name: DecompositionSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: numeric - required: true - num_channels: - name: num_channels - range: numeric - required: true - num_bands: - name: num_bands - range: numeric - required: true - DecompositionSeries__source_channels: - name: DecompositionSeries__source_channels - description: DynamicTableRegion pointer to the channels that this decomposition - series was generated from. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(source_channels) - range: string - required: true - equals_string: source_channels - Units__spike_times_index: - name: Units__spike_times_index - description: Index into the spike_times dataset. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(spike_times_index) - range: string - required: true - equals_string: spike_times_index - Units__spike_times: - name: Units__spike_times - description: Spike times for each unit in seconds. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(spike_times) - range: string - required: true - equals_string: spike_times - resolution: - name: resolution - description: The smallest possible difference between two spike times. Usually - 1 divided by the acquisition sampling rate from which spike times were extracted, - but could be larger if the acquisition time series was downsampled or smaller - if the acquisition time series was smoothed/interpolated and it is possible - for the spike time to be between samples. - range: float64 - Units__obs_intervals_index: - name: Units__obs_intervals_index - description: Index into the obs_intervals dataset. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(obs_intervals_index) - range: string - required: true - equals_string: obs_intervals_index - Units__obs_intervals: - name: Units__obs_intervals - description: Observation intervals for each unit. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(obs_intervals) - range: string - required: true - equals_string: obs_intervals - Units__electrodes_index: - name: Units__electrodes_index - description: Index into electrodes. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(electrodes_index) - range: string - required: true - equals_string: electrodes_index - Units__electrodes: - name: Units__electrodes - description: Electrode that each spike unit came from, specified using a DynamicTableRegion. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(electrodes) - range: string - required: true - equals_string: electrodes - Units__waveform_mean: - name: Units__waveform_mean - description: Spike waveform mean for each spike unit. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(waveform_mean) - range: string - required: true - equals_string: waveform_mean - sampling_rate: - name: sampling_rate - description: Sampling rate, in hertz. - range: float32 - unit: - name: unit - description: Unit of measurement. This value is fixed to 'volts'. - range: text - Units__waveform_sd: - name: Units__waveform_sd - description: Spike waveform standard deviation for each spike unit. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(waveform_sd) - range: string - required: true - equals_string: waveform_sd - sampling_rate: - name: sampling_rate - description: Sampling rate, in hertz. - range: float32 - unit: - name: unit - description: Unit of measurement. This value is fixed to 'volts'. - range: text - Units__waveforms: - name: Units__waveforms - description: Individual waveforms for each spike on each electrode. This is a - doubly indexed column. The 'waveforms_index' column indexes which waveforms - in this column belong to the same spike event for a given unit, where each waveform - was recorded from a different electrode. The 'waveforms_index_index' column - indexes the 'waveforms_index' column to indicate which spike events belong to - a given unit. For example, if the 'waveforms_index_index' column has values - [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond - to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' - column correspond to the 3 spike events of the second unit, and the next 1 element - of the 'waveforms_index' column corresponds to the 1 spike event of the third - unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then - the first 3 elements of the 'waveforms' column contain the 3 spike waveforms - that were recorded from 3 different electrodes for the first spike time of the - first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays - for a graphical representation of this example. When there is only one electrode - for each unit (i.e., each spike time is associated with a single waveform), - then the 'waveforms_index' column will have values 1, 2, ..., N, where N is - the number of spike events. The number of electrodes for each spike event should - be the same within a given unit. The 'electrodes' column should be used to indicate - which electrodes are associated with each unit, and the order of the waveforms - within a given unit x spike event should be in the same order as the electrodes - referenced in the 'electrodes' column of this table. The number of samples for - each waveform must be the same. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(waveforms) - range: string - required: true - equals_string: waveforms - sampling_rate: - name: sampling_rate - description: Sampling rate, in hertz. - range: float32 - unit: - name: unit - description: Unit of measurement. This value is fixed to 'volts'. - range: text - Units__waveforms_index: - name: Units__waveforms_index - description: Index into the waveforms dataset. One value for every spike event. - See 'waveforms' for more detail. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(waveforms_index) - range: string - required: true - equals_string: waveforms_index - Units__waveforms_index_index: - name: Units__waveforms_index_index - description: Index into the waveforms_index dataset. One value for every unit - (row in the table). See 'waveforms' for more detail. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(waveforms_index_index) - range: string - required: true - equals_string: waveforms_index_index diff --git a/nwb_linkml/schema/core.nwb.misc.yaml b/nwb_linkml/schema/core.nwb.misc.yaml index bea0419..49fced7 100644 --- a/nwb_linkml/schema/core.nwb.misc.yaml +++ b/nwb_linkml/schema/core.nwb.misc.yaml @@ -5,8 +5,6 @@ imports: - hdmf-common.table - core.nwb.ecephys - nwb.language -- core.nwb.misc.include -- core.nwb.misc default_prefix: core.nwb.misc/ classes: AbstractFeatureSeries: @@ -45,6 +43,37 @@ classes: range: text required: true tree_root: true + AbstractFeatureSeries__data: + name: AbstractFeatureSeries__data + description: Values of each feature at each time. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Since there can be different units for different features, store + the units in 'feature_units'. The default value for this attribute is "see + 'feature_units'". + range: text + array: + name: array + range: AbstractFeatureSeries__data__Array + AbstractFeatureSeries__data__Array: + name: AbstractFeatureSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: numeric + required: true + num_features: + name: num_features + range: numeric + required: false AnnotationSeries: name: AnnotationSeries description: Stores user annotations made during an experiment. The data[] field @@ -122,6 +151,53 @@ classes: range: DynamicTable required: true tree_root: true + DecompositionSeries__data: + name: DecompositionSeries__data + description: Data decomposed into frequency bands. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + unit: + name: unit + description: Base unit of measurement for working with the data. Actual stored + values are not necessarily stored in these units. To access the data in + these units, multiply 'data' by 'conversion'. + range: text + array: + name: array + range: DecompositionSeries__data__Array + DecompositionSeries__data__Array: + name: DecompositionSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: numeric + required: true + num_channels: + name: num_channels + range: numeric + required: true + num_bands: + name: num_bands + range: numeric + required: true + DecompositionSeries__source_channels: + name: DecompositionSeries__source_channels + description: DynamicTableRegion pointer to the channels that this decomposition + series was generated from. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(source_channels) + range: string + required: true + equals_string: source_channels Units: name: Units description: Data about spiking units. Event times of observed units (e.g. cell, @@ -228,3 +304,180 @@ classes: range: Units__waveforms_index_index required: false tree_root: true + Units__spike_times_index: + name: Units__spike_times_index + description: Index into the spike_times dataset. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(spike_times_index) + range: string + required: true + equals_string: spike_times_index + Units__spike_times: + name: Units__spike_times + description: Spike times for each unit in seconds. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(spike_times) + range: string + required: true + equals_string: spike_times + resolution: + name: resolution + description: The smallest possible difference between two spike times. Usually + 1 divided by the acquisition sampling rate from which spike times were extracted, + but could be larger if the acquisition time series was downsampled or smaller + if the acquisition time series was smoothed/interpolated and it is possible + for the spike time to be between samples. + range: float64 + Units__obs_intervals_index: + name: Units__obs_intervals_index + description: Index into the obs_intervals dataset. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(obs_intervals_index) + range: string + required: true + equals_string: obs_intervals_index + Units__obs_intervals: + name: Units__obs_intervals + description: Observation intervals for each unit. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(obs_intervals) + range: string + required: true + equals_string: obs_intervals + Units__electrodes_index: + name: Units__electrodes_index + description: Index into electrodes. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(electrodes_index) + range: string + required: true + equals_string: electrodes_index + Units__electrodes: + name: Units__electrodes + description: Electrode that each spike unit came from, specified using a DynamicTableRegion. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(electrodes) + range: string + required: true + equals_string: electrodes + Units__waveform_mean: + name: Units__waveform_mean + description: Spike waveform mean for each spike unit. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(waveform_mean) + range: string + required: true + equals_string: waveform_mean + sampling_rate: + name: sampling_rate + description: Sampling rate, in hertz. + range: float32 + unit: + name: unit + description: Unit of measurement. This value is fixed to 'volts'. + range: text + Units__waveform_sd: + name: Units__waveform_sd + description: Spike waveform standard deviation for each spike unit. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(waveform_sd) + range: string + required: true + equals_string: waveform_sd + sampling_rate: + name: sampling_rate + description: Sampling rate, in hertz. + range: float32 + unit: + name: unit + description: Unit of measurement. This value is fixed to 'volts'. + range: text + Units__waveforms: + name: Units__waveforms + description: Individual waveforms for each spike on each electrode. This is a + doubly indexed column. The 'waveforms_index' column indexes which waveforms + in this column belong to the same spike event for a given unit, where each waveform + was recorded from a different electrode. The 'waveforms_index_index' column + indexes the 'waveforms_index' column to indicate which spike events belong to + a given unit. For example, if the 'waveforms_index_index' column has values + [2, 5, 6], then the first 2 elements of the 'waveforms_index' column correspond + to the 2 spike events of the first unit, the next 3 elements of the 'waveforms_index' + column correspond to the 3 spike events of the second unit, and the next 1 element + of the 'waveforms_index' column corresponds to the 1 spike event of the third + unit. If the 'waveforms_index' column has values [3, 6, 8, 10, 12, 13], then + the first 3 elements of the 'waveforms' column contain the 3 spike waveforms + that were recorded from 3 different electrodes for the first spike time of the + first unit. See https://nwb-schema.readthedocs.io/en/stable/format_description.html#doubly-ragged-arrays + for a graphical representation of this example. When there is only one electrode + for each unit (i.e., each spike time is associated with a single waveform), + then the 'waveforms_index' column will have values 1, 2, ..., N, where N is + the number of spike events. The number of electrodes for each spike event should + be the same within a given unit. The 'electrodes' column should be used to indicate + which electrodes are associated with each unit, and the order of the waveforms + within a given unit x spike event should be in the same order as the electrodes + referenced in the 'electrodes' column of this table. The number of samples for + each waveform must be the same. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(waveforms) + range: string + required: true + equals_string: waveforms + sampling_rate: + name: sampling_rate + description: Sampling rate, in hertz. + range: float32 + unit: + name: unit + description: Unit of measurement. This value is fixed to 'volts'. + range: text + Units__waveforms_index: + name: Units__waveforms_index + description: Index into the waveforms dataset. One value for every spike event. + See 'waveforms' for more detail. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(waveforms_index) + range: string + required: true + equals_string: waveforms_index + Units__waveforms_index_index: + name: Units__waveforms_index_index + description: Index into the waveforms_index dataset. One value for every unit + (row in the table). See 'waveforms' for more detail. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(waveforms_index_index) + range: string + required: true + equals_string: waveforms_index_index diff --git a/nwb_linkml/schema/core.nwb.ogen.yaml b/nwb_linkml/schema/core.nwb.ogen.yaml index aa0ef82..116c91e 100644 --- a/nwb_linkml/schema/core.nwb.ogen.yaml +++ b/nwb_linkml/schema/core.nwb.ogen.yaml @@ -4,7 +4,6 @@ imports: - core.nwb.base - core.nwb.device - nwb.language -- core.nwb.ogen default_prefix: core.nwb.ogen/ classes: OptogeneticSeries: diff --git a/nwb_linkml/schema/core.nwb.ophys.include.yaml b/nwb_linkml/schema/core.nwb.ophys.include.yaml deleted file mode 100644 index a870f55..0000000 --- a/nwb_linkml/schema/core.nwb.ophys.include.yaml +++ /dev/null @@ -1,235 +0,0 @@ -name: core.nwb.ophys.include -id: core.nwb.ophys.include -imports: -- core.nwb.image -- core.nwb.base -- hdmf-common.table -- core.nwb.device -- nwb.language -- core.nwb.ophys.include -- core.nwb.ophys -default_prefix: core.nwb.ophys.include/ -classes: - TwoPhotonSeries__field_of_view: - name: TwoPhotonSeries__field_of_view - description: Width, height and depth of image, or imaged area, in meters. - attributes: - name: - name: name - ifabsent: string(field_of_view) - range: string - required: true - equals_string: field_of_view - array: - name: array - range: TwoPhotonSeries__field_of_view__Array - TwoPhotonSeries__field_of_view__Array: - name: TwoPhotonSeries__field_of_view__Array - is_a: Arraylike - attributes: - width|height: - name: width|height - range: float32 - required: false - minimum_cardinality: 2 - maximum_cardinality: 2 - width|height|depth: - name: width|height|depth - range: float32 - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 - RoiResponseSeries__data: - name: RoiResponseSeries__data - description: Signals from ROIs. - attributes: - name: - name: name - ifabsent: string(data) - range: string - required: true - equals_string: data - array: - name: array - range: RoiResponseSeries__data__Array - RoiResponseSeries__data__Array: - name: RoiResponseSeries__data__Array - is_a: Arraylike - attributes: - num_times: - name: num_times - range: numeric - required: true - num_ROIs: - name: num_ROIs - range: numeric - required: false - RoiResponseSeries__rois: - name: RoiResponseSeries__rois - description: DynamicTableRegion referencing into an ROITable containing information - on the ROIs stored in this timeseries. - is_a: DynamicTableRegion - attributes: - name: - name: name - ifabsent: string(rois) - range: string - required: true - equals_string: rois - PlaneSegmentation__image_mask: - name: PlaneSegmentation__image_mask - description: ROI masks for each ROI. Each image mask is the size of the original - imaging plane (or volume) and members of the ROI are finite non-zero. - is_a: VectorData - attributes: - name: - name: name - ifabsent: string(image_mask) - range: string - required: true - equals_string: image_mask - PlaneSegmentation__pixel_mask_index: - name: PlaneSegmentation__pixel_mask_index - description: Index into pixel_mask. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(pixel_mask_index) - range: string - required: true - equals_string: pixel_mask_index - PlaneSegmentation__voxel_mask_index: - name: PlaneSegmentation__voxel_mask_index - description: Index into voxel_mask. - is_a: VectorIndex - attributes: - name: - name: name - ifabsent: string(voxel_mask_index) - range: string - required: true - equals_string: voxel_mask_index - ImagingPlane__manifold: - name: ImagingPlane__manifold - description: DEPRECATED Physical position of each pixel. 'xyz' represents the - position of the pixel relative to the defined coordinate space. Deprecated in - favor of origin_coords and grid_spacing. - attributes: - name: - name: name - ifabsent: string(manifold) - range: string - required: true - equals_string: manifold - conversion: - name: conversion - description: Scalar to multiply each element in data to convert it to the - specified 'unit'. If the data are stored in acquisition system units or - other units that require a conversion to be interpretable, multiply the - data by 'conversion' to convert the data to the specified 'unit'. e.g. if - the data acquisition system stores values in this object as pixels from - x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then - the 'conversion' multiplier to get from raw data acquisition pixel units - to meters is 2/1000. - range: float32 - unit: - name: unit - description: Base unit of measurement for working with the data. The default - value is 'meters'. - range: text - array: - name: array - range: ImagingPlane__manifold__Array - ImagingPlane__manifold__Array: - name: ImagingPlane__manifold__Array - is_a: Arraylike - attributes: - height: - name: height - range: float32 - required: true - width: - name: width - range: float32 - required: true - x, y, z: - name: x, y, z - range: float32 - required: true - minimum_cardinality: 3 - maximum_cardinality: 3 - depth: - name: depth - range: float32 - required: false - ImagingPlane__origin_coords: - name: ImagingPlane__origin_coords - description: Physical location of the first element of the imaging plane (0, 0) - for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the - physical location is relative to (e.g., bregma). - attributes: - name: - name: name - ifabsent: string(origin_coords) - range: string - required: true - equals_string: origin_coords - unit: - name: unit - description: Measurement units for origin_coords. The default value is 'meters'. - range: text - array: - name: array - range: ImagingPlane__origin_coords__Array - ImagingPlane__origin_coords__Array: - name: ImagingPlane__origin_coords__Array - is_a: Arraylike - attributes: - x, y: - name: x, y - range: float32 - required: false - minimum_cardinality: 2 - maximum_cardinality: 2 - x, y, z: - name: x, y, z - range: float32 - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 - ImagingPlane__grid_spacing: - name: ImagingPlane__grid_spacing - description: Space between pixels in (x, y) or voxels in (x, y, z) directions, - in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame - to interpret the grid. - attributes: - name: - name: name - ifabsent: string(grid_spacing) - range: string - required: true - equals_string: grid_spacing - unit: - name: unit - description: Measurement units for grid_spacing. The default value is 'meters'. - range: text - array: - name: array - range: ImagingPlane__grid_spacing__Array - ImagingPlane__grid_spacing__Array: - name: ImagingPlane__grid_spacing__Array - is_a: Arraylike - attributes: - x, y: - name: x, y - range: float32 - required: false - minimum_cardinality: 2 - maximum_cardinality: 2 - x, y, z: - name: x, y, z - range: float32 - required: false - minimum_cardinality: 3 - maximum_cardinality: 3 diff --git a/nwb_linkml/schema/core.nwb.ophys.yaml b/nwb_linkml/schema/core.nwb.ophys.yaml index ea43fcc..b9a597a 100644 --- a/nwb_linkml/schema/core.nwb.ophys.yaml +++ b/nwb_linkml/schema/core.nwb.ophys.yaml @@ -6,8 +6,6 @@ imports: - hdmf-common.table - core.nwb.device - nwb.language -- core.nwb.ophys.include -- core.nwb.ophys default_prefix: core.nwb.ophys/ classes: OnePhotonSeries: @@ -72,6 +70,35 @@ classes: range: TwoPhotonSeries__field_of_view required: false tree_root: true + TwoPhotonSeries__field_of_view: + name: TwoPhotonSeries__field_of_view + description: Width, height and depth of image, or imaged area, in meters. + attributes: + name: + name: name + ifabsent: string(field_of_view) + range: string + required: true + equals_string: field_of_view + array: + name: array + range: TwoPhotonSeries__field_of_view__Array + TwoPhotonSeries__field_of_view__Array: + name: TwoPhotonSeries__field_of_view__Array + is_a: Arraylike + attributes: + width|height: + name: width|height + range: float32 + required: false + minimum_cardinality: 2 + maximum_cardinality: 2 + width|height|depth: + name: width|height|depth + range: float32 + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 RoiResponseSeries: name: RoiResponseSeries description: ROI responses over an imaging plane. The first dimension represents @@ -96,6 +123,43 @@ classes: range: RoiResponseSeries__rois required: true tree_root: true + RoiResponseSeries__data: + name: RoiResponseSeries__data + description: Signals from ROIs. + attributes: + name: + name: name + ifabsent: string(data) + range: string + required: true + equals_string: data + array: + name: array + range: RoiResponseSeries__data__Array + RoiResponseSeries__data__Array: + name: RoiResponseSeries__data__Array + is_a: Arraylike + attributes: + num_times: + name: num_times + range: numeric + required: true + num_ROIs: + name: num_ROIs + range: numeric + required: false + RoiResponseSeries__rois: + name: RoiResponseSeries__rois + description: DynamicTableRegion referencing into an ROITable containing information + on the ROIs stored in this timeseries. + is_a: DynamicTableRegion + attributes: + name: + name: name + ifabsent: string(rois) + range: string + required: true + equals_string: rois DfOverF: name: DfOverF description: dF/F information about a region of interest (ROI). Storage hierarchy @@ -204,6 +268,40 @@ classes: any_of: - range: ImageSeries tree_root: true + PlaneSegmentation__image_mask: + name: PlaneSegmentation__image_mask + description: ROI masks for each ROI. Each image mask is the size of the original + imaging plane (or volume) and members of the ROI are finite non-zero. + is_a: VectorData + attributes: + name: + name: name + ifabsent: string(image_mask) + range: string + required: true + equals_string: image_mask + PlaneSegmentation__pixel_mask_index: + name: PlaneSegmentation__pixel_mask_index + description: Index into pixel_mask. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(pixel_mask_index) + range: string + required: true + equals_string: pixel_mask_index + PlaneSegmentation__voxel_mask_index: + name: PlaneSegmentation__voxel_mask_index + description: Index into voxel_mask. + is_a: VectorIndex + attributes: + name: + name: name + ifabsent: string(voxel_mask_index) + range: string + required: true + equals_string: voxel_mask_index ImagingPlane: name: ImagingPlane description: An imaging plane and its metadata. @@ -299,6 +397,129 @@ classes: range: OpticalChannel required: true tree_root: true + ImagingPlane__manifold: + name: ImagingPlane__manifold + description: DEPRECATED Physical position of each pixel. 'xyz' represents the + position of the pixel relative to the defined coordinate space. Deprecated in + favor of origin_coords and grid_spacing. + attributes: + name: + name: name + ifabsent: string(manifold) + range: string + required: true + equals_string: manifold + conversion: + name: conversion + description: Scalar to multiply each element in data to convert it to the + specified 'unit'. If the data are stored in acquisition system units or + other units that require a conversion to be interpretable, multiply the + data by 'conversion' to convert the data to the specified 'unit'. e.g. if + the data acquisition system stores values in this object as pixels from + x = -500 to 499, y = -500 to 499 that correspond to a 2 m x 2 m range, then + the 'conversion' multiplier to get from raw data acquisition pixel units + to meters is 2/1000. + range: float32 + unit: + name: unit + description: Base unit of measurement for working with the data. The default + value is 'meters'. + range: text + array: + name: array + range: ImagingPlane__manifold__Array + ImagingPlane__manifold__Array: + name: ImagingPlane__manifold__Array + is_a: Arraylike + attributes: + height: + name: height + range: float32 + required: true + width: + name: width + range: float32 + required: true + x, y, z: + name: x, y, z + range: float32 + required: true + minimum_cardinality: 3 + maximum_cardinality: 3 + depth: + name: depth + range: float32 + required: false + ImagingPlane__origin_coords: + name: ImagingPlane__origin_coords + description: Physical location of the first element of the imaging plane (0, 0) + for 2-D data or (0, 0, 0) for 3-D data. See also reference_frame for what the + physical location is relative to (e.g., bregma). + attributes: + name: + name: name + ifabsent: string(origin_coords) + range: string + required: true + equals_string: origin_coords + unit: + name: unit + description: Measurement units for origin_coords. The default value is 'meters'. + range: text + array: + name: array + range: ImagingPlane__origin_coords__Array + ImagingPlane__origin_coords__Array: + name: ImagingPlane__origin_coords__Array + is_a: Arraylike + attributes: + x, y: + name: x, y + range: float32 + required: false + minimum_cardinality: 2 + maximum_cardinality: 2 + x, y, z: + name: x, y, z + range: float32 + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 + ImagingPlane__grid_spacing: + name: ImagingPlane__grid_spacing + description: Space between pixels in (x, y) or voxels in (x, y, z) directions, + in the specified unit. Assumes imaging plane is a regular grid. See also reference_frame + to interpret the grid. + attributes: + name: + name: name + ifabsent: string(grid_spacing) + range: string + required: true + equals_string: grid_spacing + unit: + name: unit + description: Measurement units for grid_spacing. The default value is 'meters'. + range: text + array: + name: array + range: ImagingPlane__grid_spacing__Array + ImagingPlane__grid_spacing__Array: + name: ImagingPlane__grid_spacing__Array + is_a: Arraylike + attributes: + x, y: + name: x, y + range: float32 + required: false + minimum_cardinality: 2 + maximum_cardinality: 2 + x, y, z: + name: x, y, z + range: float32 + required: false + minimum_cardinality: 3 + maximum_cardinality: 3 OpticalChannel: name: OpticalChannel description: An optical channel used to record from an imaging plane. diff --git a/nwb_linkml/schema/core.nwb.retinotopy.include.yaml b/nwb_linkml/schema/core.nwb.retinotopy.include.yaml deleted file mode 100644 index 123fabf..0000000 --- a/nwb_linkml/schema/core.nwb.retinotopy.include.yaml +++ /dev/null @@ -1,290 +0,0 @@ -name: core.nwb.retinotopy.include -id: core.nwb.retinotopy.include -imports: -- core.nwb.base -- nwb.language -- core.nwb.retinotopy.include -- core.nwb.retinotopy -default_prefix: core.nwb.retinotopy.include/ -classes: - ImagingRetinotopy__axis_1_phase_map: - name: ImagingRetinotopy__axis_1_phase_map - description: Phase response to stimulus on the first measured axis. - attributes: - name: - name: name - ifabsent: string(axis_1_phase_map) - range: string - required: true - equals_string: axis_1_phase_map - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - unit: - name: unit - description: Unit that axis data is stored in (e.g., degrees). - range: text - array: - name: array - range: ImagingRetinotopy__axis_1_phase_map__Array - ImagingRetinotopy__axis_1_phase_map__Array: - name: ImagingRetinotopy__axis_1_phase_map__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: float32 - required: true - num_cols: - name: num_cols - range: float32 - required: true - ImagingRetinotopy__axis_1_power_map: - name: ImagingRetinotopy__axis_1_power_map - description: Power response on the first measured axis. Response is scaled so - 0.0 is no power in the response and 1.0 is maximum relative power. - attributes: - name: - name: name - ifabsent: string(axis_1_power_map) - range: string - required: true - equals_string: axis_1_power_map - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - unit: - name: unit - description: Unit that axis data is stored in (e.g., degrees). - range: text - array: - name: array - range: ImagingRetinotopy__axis_1_power_map__Array - ImagingRetinotopy__axis_1_power_map__Array: - name: ImagingRetinotopy__axis_1_power_map__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: float32 - required: true - num_cols: - name: num_cols - range: float32 - required: true - ImagingRetinotopy__axis_2_phase_map: - name: ImagingRetinotopy__axis_2_phase_map - description: Phase response to stimulus on the second measured axis. - attributes: - name: - name: name - ifabsent: string(axis_2_phase_map) - range: string - required: true - equals_string: axis_2_phase_map - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - unit: - name: unit - description: Unit that axis data is stored in (e.g., degrees). - range: text - array: - name: array - range: ImagingRetinotopy__axis_2_phase_map__Array - ImagingRetinotopy__axis_2_phase_map__Array: - name: ImagingRetinotopy__axis_2_phase_map__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: float32 - required: true - num_cols: - name: num_cols - range: float32 - required: true - ImagingRetinotopy__axis_2_power_map: - name: ImagingRetinotopy__axis_2_power_map - description: Power response on the second measured axis. Response is scaled so - 0.0 is no power in the response and 1.0 is maximum relative power. - attributes: - name: - name: name - ifabsent: string(axis_2_power_map) - range: string - required: true - equals_string: axis_2_power_map - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - unit: - name: unit - description: Unit that axis data is stored in (e.g., degrees). - range: text - array: - name: array - range: ImagingRetinotopy__axis_2_power_map__Array - ImagingRetinotopy__axis_2_power_map__Array: - name: ImagingRetinotopy__axis_2_power_map__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: float32 - required: true - num_cols: - name: num_cols - range: float32 - required: true - ImagingRetinotopy__focal_depth_image: - name: ImagingRetinotopy__focal_depth_image - description: 'Gray-scale image taken with same settings/parameters (e.g., focal - depth, wavelength) as data collection. Array format: [rows][columns].' - attributes: - name: - name: name - ifabsent: string(focal_depth_image) - range: string - required: true - equals_string: focal_depth_image - bits_per_pixel: - name: bits_per_pixel - description: Number of bits used to represent each value. This is necessary - to determine maximum (white) pixel value. - range: int32 - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - focal_depth: - name: focal_depth - description: Focal depth offset, in meters. - range: float32 - format: - name: format - description: Format of image. Right now only 'raw' is supported. - range: text - array: - name: array - range: ImagingRetinotopy__focal_depth_image__Array - ImagingRetinotopy__focal_depth_image__Array: - name: ImagingRetinotopy__focal_depth_image__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: uint16 - required: true - num_cols: - name: num_cols - range: uint16 - required: true - ImagingRetinotopy__sign_map: - name: ImagingRetinotopy__sign_map - description: Sine of the angle between the direction of the gradient in axis_1 - and axis_2. - attributes: - name: - name: name - ifabsent: string(sign_map) - range: string - required: true - equals_string: sign_map - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - array: - name: array - range: ImagingRetinotopy__sign_map__Array - ImagingRetinotopy__sign_map__Array: - name: ImagingRetinotopy__sign_map__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: float32 - required: true - num_cols: - name: num_cols - range: float32 - required: true - ImagingRetinotopy__vasculature_image: - name: ImagingRetinotopy__vasculature_image - description: 'Gray-scale anatomical image of cortical surface. Array structure: - [rows][columns]' - attributes: - name: - name: name - ifabsent: string(vasculature_image) - range: string - required: true - equals_string: vasculature_image - bits_per_pixel: - name: bits_per_pixel - description: Number of bits used to represent each value. This is necessary - to determine maximum (white) pixel value - range: int32 - dimension: - name: dimension - description: 'Number of rows and columns in the image. NOTE: row, column representation - is equivalent to height, width.' - range: int32 - field_of_view: - name: field_of_view - description: Size of viewing area, in meters. - range: float32 - format: - name: format - description: Format of image. Right now only 'raw' is supported. - range: text - array: - name: array - range: ImagingRetinotopy__vasculature_image__Array - ImagingRetinotopy__vasculature_image__Array: - name: ImagingRetinotopy__vasculature_image__Array - is_a: Arraylike - attributes: - num_rows: - name: num_rows - range: uint16 - required: true - num_cols: - name: num_cols - range: uint16 - required: true diff --git a/nwb_linkml/schema/core.nwb.retinotopy.yaml b/nwb_linkml/schema/core.nwb.retinotopy.yaml index 2d03658..c6334c4 100644 --- a/nwb_linkml/schema/core.nwb.retinotopy.yaml +++ b/nwb_linkml/schema/core.nwb.retinotopy.yaml @@ -3,8 +3,6 @@ id: core.nwb.retinotopy imports: - core.nwb.base - nwb.language -- core.nwb.retinotopy.include -- core.nwb.retinotopy default_prefix: core.nwb.retinotopy/ classes: ImagingRetinotopy: @@ -80,3 +78,284 @@ classes: range: ImagingRetinotopy__vasculature_image required: true tree_root: true + ImagingRetinotopy__axis_1_phase_map: + name: ImagingRetinotopy__axis_1_phase_map + description: Phase response to stimulus on the first measured axis. + attributes: + name: + name: name + ifabsent: string(axis_1_phase_map) + range: string + required: true + equals_string: axis_1_phase_map + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + unit: + name: unit + description: Unit that axis data is stored in (e.g., degrees). + range: text + array: + name: array + range: ImagingRetinotopy__axis_1_phase_map__Array + ImagingRetinotopy__axis_1_phase_map__Array: + name: ImagingRetinotopy__axis_1_phase_map__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: float32 + required: true + num_cols: + name: num_cols + range: float32 + required: true + ImagingRetinotopy__axis_1_power_map: + name: ImagingRetinotopy__axis_1_power_map + description: Power response on the first measured axis. Response is scaled so + 0.0 is no power in the response and 1.0 is maximum relative power. + attributes: + name: + name: name + ifabsent: string(axis_1_power_map) + range: string + required: true + equals_string: axis_1_power_map + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + unit: + name: unit + description: Unit that axis data is stored in (e.g., degrees). + range: text + array: + name: array + range: ImagingRetinotopy__axis_1_power_map__Array + ImagingRetinotopy__axis_1_power_map__Array: + name: ImagingRetinotopy__axis_1_power_map__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: float32 + required: true + num_cols: + name: num_cols + range: float32 + required: true + ImagingRetinotopy__axis_2_phase_map: + name: ImagingRetinotopy__axis_2_phase_map + description: Phase response to stimulus on the second measured axis. + attributes: + name: + name: name + ifabsent: string(axis_2_phase_map) + range: string + required: true + equals_string: axis_2_phase_map + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + unit: + name: unit + description: Unit that axis data is stored in (e.g., degrees). + range: text + array: + name: array + range: ImagingRetinotopy__axis_2_phase_map__Array + ImagingRetinotopy__axis_2_phase_map__Array: + name: ImagingRetinotopy__axis_2_phase_map__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: float32 + required: true + num_cols: + name: num_cols + range: float32 + required: true + ImagingRetinotopy__axis_2_power_map: + name: ImagingRetinotopy__axis_2_power_map + description: Power response on the second measured axis. Response is scaled so + 0.0 is no power in the response and 1.0 is maximum relative power. + attributes: + name: + name: name + ifabsent: string(axis_2_power_map) + range: string + required: true + equals_string: axis_2_power_map + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + unit: + name: unit + description: Unit that axis data is stored in (e.g., degrees). + range: text + array: + name: array + range: ImagingRetinotopy__axis_2_power_map__Array + ImagingRetinotopy__axis_2_power_map__Array: + name: ImagingRetinotopy__axis_2_power_map__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: float32 + required: true + num_cols: + name: num_cols + range: float32 + required: true + ImagingRetinotopy__focal_depth_image: + name: ImagingRetinotopy__focal_depth_image + description: 'Gray-scale image taken with same settings/parameters (e.g., focal + depth, wavelength) as data collection. Array format: [rows][columns].' + attributes: + name: + name: name + ifabsent: string(focal_depth_image) + range: string + required: true + equals_string: focal_depth_image + bits_per_pixel: + name: bits_per_pixel + description: Number of bits used to represent each value. This is necessary + to determine maximum (white) pixel value. + range: int32 + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + focal_depth: + name: focal_depth + description: Focal depth offset, in meters. + range: float32 + format: + name: format + description: Format of image. Right now only 'raw' is supported. + range: text + array: + name: array + range: ImagingRetinotopy__focal_depth_image__Array + ImagingRetinotopy__focal_depth_image__Array: + name: ImagingRetinotopy__focal_depth_image__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: uint16 + required: true + num_cols: + name: num_cols + range: uint16 + required: true + ImagingRetinotopy__sign_map: + name: ImagingRetinotopy__sign_map + description: Sine of the angle between the direction of the gradient in axis_1 + and axis_2. + attributes: + name: + name: name + ifabsent: string(sign_map) + range: string + required: true + equals_string: sign_map + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + array: + name: array + range: ImagingRetinotopy__sign_map__Array + ImagingRetinotopy__sign_map__Array: + name: ImagingRetinotopy__sign_map__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: float32 + required: true + num_cols: + name: num_cols + range: float32 + required: true + ImagingRetinotopy__vasculature_image: + name: ImagingRetinotopy__vasculature_image + description: 'Gray-scale anatomical image of cortical surface. Array structure: + [rows][columns]' + attributes: + name: + name: name + ifabsent: string(vasculature_image) + range: string + required: true + equals_string: vasculature_image + bits_per_pixel: + name: bits_per_pixel + description: Number of bits used to represent each value. This is necessary + to determine maximum (white) pixel value + range: int32 + dimension: + name: dimension + description: 'Number of rows and columns in the image. NOTE: row, column representation + is equivalent to height, width.' + range: int32 + field_of_view: + name: field_of_view + description: Size of viewing area, in meters. + range: float32 + format: + name: format + description: Format of image. Right now only 'raw' is supported. + range: text + array: + name: array + range: ImagingRetinotopy__vasculature_image__Array + ImagingRetinotopy__vasculature_image__Array: + name: ImagingRetinotopy__vasculature_image__Array + is_a: Arraylike + attributes: + num_rows: + name: num_rows + range: uint16 + required: true + num_cols: + name: num_cols + range: uint16 + required: true diff --git a/nwb_linkml/schema/core.yaml b/nwb_linkml/schema/core.yaml index c463cc5..72803e2 100644 --- a/nwb_linkml/schema/core.yaml +++ b/nwb_linkml/schema/core.yaml @@ -1,4 +1,8 @@ name: core +annotations: + namespace: + tag: namespace + value: 'True' description: NWB namespace id: core version: 2.6.0-alpha diff --git a/nwb_linkml/schema/hdmf-common.base.yaml b/nwb_linkml/schema/hdmf-common.base.yaml index a1cd455..b2db755 100644 --- a/nwb_linkml/schema/hdmf-common.base.yaml +++ b/nwb_linkml/schema/hdmf-common.base.yaml @@ -2,7 +2,6 @@ name: hdmf-common.base id: hdmf-common.base imports: - nwb.language -- hdmf-common.base default_prefix: hdmf-common.base/ classes: Data: diff --git a/nwb_linkml/schema/hdmf-common.sparse.yaml b/nwb_linkml/schema/hdmf-common.sparse.yaml index 594723d..779be11 100644 --- a/nwb_linkml/schema/hdmf-common.sparse.yaml +++ b/nwb_linkml/schema/hdmf-common.sparse.yaml @@ -3,7 +3,6 @@ id: hdmf-common.sparse imports: - hdmf-common.base - nwb.language -- hdmf-common.sparse default_prefix: hdmf-common.sparse/ classes: CSRMatrix: diff --git a/nwb_linkml/schema/hdmf-common.table.include.yaml b/nwb_linkml/schema/hdmf-common.table.include.yaml deleted file mode 100644 index dac1fa9..0000000 --- a/nwb_linkml/schema/hdmf-common.table.include.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: hdmf-common.table.include -id: hdmf-common.table.include -imports: -- hdmf-common.base -- nwb.language -- hdmf-common.table.include -- hdmf-common.table -default_prefix: hdmf-common.table.include/ -classes: - VectorData__Array: - name: VectorData__Array - is_a: Arraylike - attributes: - dim0: - name: dim0 - range: AnyType - required: true - dim1: - name: dim1 - range: AnyType - required: false - dim2: - name: dim2 - range: AnyType - required: false - dim3: - name: dim3 - range: AnyType - required: false - ElementIdentifiers__Array: - name: ElementIdentifiers__Array - is_a: Arraylike - attributes: - num_elements: - name: num_elements - range: int - required: true diff --git a/nwb_linkml/schema/hdmf-common.table.yaml b/nwb_linkml/schema/hdmf-common.table.yaml index d3b94fd..e4a4cf0 100644 --- a/nwb_linkml/schema/hdmf-common.table.yaml +++ b/nwb_linkml/schema/hdmf-common.table.yaml @@ -3,8 +3,6 @@ id: hdmf-common.table imports: - hdmf-common.base - nwb.language -- hdmf-common.table.include -- hdmf-common.table default_prefix: hdmf-common.table/ classes: VectorData: @@ -31,6 +29,26 @@ classes: name: array range: VectorData__Array tree_root: true + VectorData__Array: + name: VectorData__Array + is_a: Arraylike + attributes: + dim0: + name: dim0 + range: AnyType + required: true + dim1: + name: dim1 + range: AnyType + required: false + dim2: + name: dim2 + range: AnyType + required: false + dim3: + name: dim3 + range: AnyType + required: false VectorIndex: name: VectorIndex description: Used with VectorData to encode a ragged array. An array of indices @@ -63,6 +81,14 @@ classes: name: array range: ElementIdentifiers__Array tree_root: true + ElementIdentifiers__Array: + name: ElementIdentifiers__Array + is_a: Arraylike + attributes: + num_elements: + name: num_elements + range: int + required: true DynamicTableRegion: name: DynamicTableRegion description: DynamicTableRegion provides a link from one table to an index or diff --git a/nwb_linkml/schema/hdmf-common.yaml b/nwb_linkml/schema/hdmf-common.yaml index c43cbc1..88c45d1 100644 --- a/nwb_linkml/schema/hdmf-common.yaml +++ b/nwb_linkml/schema/hdmf-common.yaml @@ -1,4 +1,8 @@ name: hdmf-common +annotations: + namespace: + tag: namespace + value: 'True' description: Common data structures provided by HDMF id: hdmf-common version: 1.8.0 diff --git a/nwb_linkml/schema/hdmf-experimental.experimental.yaml b/nwb_linkml/schema/hdmf-experimental.experimental.yaml index cbfce79..389f525 100644 --- a/nwb_linkml/schema/hdmf-experimental.experimental.yaml +++ b/nwb_linkml/schema/hdmf-experimental.experimental.yaml @@ -3,7 +3,6 @@ id: hdmf-experimental.experimental imports: - hdmf-common.table - nwb.language -- hdmf-experimental.experimental default_prefix: hdmf-experimental.experimental/ classes: EnumData: diff --git a/nwb_linkml/schema/hdmf-experimental.resources.yaml b/nwb_linkml/schema/hdmf-experimental.resources.yaml index b8f3960..184bbc6 100644 --- a/nwb_linkml/schema/hdmf-experimental.resources.yaml +++ b/nwb_linkml/schema/hdmf-experimental.resources.yaml @@ -3,7 +3,6 @@ id: hdmf-experimental.resources imports: - hdmf-common.base - nwb.language -- hdmf-experimental.resources default_prefix: hdmf-experimental.resources/ classes: HERD: diff --git a/nwb_linkml/schema/hdmf-experimental.yaml b/nwb_linkml/schema/hdmf-experimental.yaml index 2eadb29..a97469f 100644 --- a/nwb_linkml/schema/hdmf-experimental.yaml +++ b/nwb_linkml/schema/hdmf-experimental.yaml @@ -1,4 +1,8 @@ name: hdmf-experimental +annotations: + namespace: + tag: namespace + value: 'True' description: Experimental data structures provided by HDMF. These are not guaranteed to be available in the future. id: hdmf-experimental diff --git a/nwb_linkml/translate.py b/nwb_linkml/translate.py new file mode 100644 index 0000000..0cfe8e4 --- /dev/null +++ b/nwb_linkml/translate.py @@ -0,0 +1,153 @@ +""" +Convenience functions for translating NWB schema +""" +import pdb +import tempfile +from typing import List, Optional, Dict +from types import ModuleType +from pathlib import Path +import json + + +import h5py +from linkml_runtime import SchemaView +from linkml_runtime.linkml_model import SchemaDefinition +from linkml_runtime.dumpers import yaml_dumper +from linkml_runtime.utils.compile_python import compile_python + + + +from nwb_schema_language import Namespaces +from nwb_linkml.io import load_schema_file +from nwb_linkml.generators.pydantic import NWBPydanticGenerator +from nwb_linkml.map import apply_preload +from nwb_linkml.adapters import SchemaAdapter, NamespacesAdapter + +def make_namespace_adapter(schema: dict) -> NamespacesAdapter: + """ + Create a :class:`.NamespacesAdapter` from a dictionary of loaded schema + namespace as are commonly + serialized in nwbfiles under /specifications + + Args: + schema: + + Returns: + + """ + namespace = Namespaces(**schema['namespace']) + schema_adapters = [] # type: List[SchemaAdapter] + + for schema_name, schema_dict in schema.items(): + if schema_name == 'namespace': + continue + path = Path(schema_name + '.yaml') + schema_adapters.append(load_schema_file(path, schema_dict)) + + ns_adapter = NamespacesAdapter( + namespaces=namespace, + schemas=schema_adapters + ) + return ns_adapter + +def populate_namespaces_imports(namespaces: List[NamespacesAdapter]) -> List[NamespacesAdapter]: + """ + Given a set of :class:`.NamespacesAdapter`s, populate their imports with the other namespaces, if necessary + """ + for ns in namespaces: + needed_imports = [] + for imported_ns in ns.namespaces.namespaces: + for imported_sch in imported_ns.schema_: + if imported_sch.namespace and not imported_sch.source: + needed_imports.append(imported_sch.namespace) + + # find the import among the namespaces we have + for other_ns in namespaces: + if any([imported_ns.name in needed_imports for imported_ns in other_ns.namespaces.namespaces]): + ns.imported.append(other_ns) + return namespaces + +def translate_namespaces(namespaces: NamespacesAdapter, base_dir: Path) -> List[Path]: + """ + Write translated namespaces to disk + """ + built_schemas = namespaces.build().schemas + base_dir = Path(base_dir) + + paths = [] + for schema in built_schemas: + output_file = base_dir / (schema.name + '.yaml') + paths.append(output_file) + yaml_dumper.dump(schema, output_file) + return paths + +def generate_pydantic( + namespaces: NamespacesAdapter, + schema_dir:Optional[Path]=None, + pydantic_dir:Optional[Path]=None +) -> ModuleType: + if schema_dir is None: + temp_schema_dir = tempfile.TemporaryDirectory() + schema_dir = Path(temp_schema_dir.name) + if pydantic_dir is None: + temp_pydantic_dir = tempfile.TemporaryDirectory() + pydantic_dir = Path(temp_pydantic_dir.name) + + if any(schema_dir.glob('*.yaml')): + # read already generated schema, do nothing here + schema_paths = list(schema_dir.glob('*.yaml')) + else: + # generate schema files + schema_paths = translate_namespaces(namespaces, base_dir=schema_dir) + + # just generate the namespace file, which should import everything + + ns_file = [s_path for s_path in schema_paths if s_path.stem == namespaces.namespaces.namespaces[0].name] + if len(ns_file) == 0: + raise ValueError("Could not find main namespace file") + ns_file = ns_file[0] + + generator = NWBPydanticGenerator( + str(ns_file), + split=False, + emit_metadata=True, + gen_classvars=True, + gen_slots=True, + pydantic_version='2' + ) + serialized = generator.serialize() + with open(pydantic_dir / 'models.py', 'w') as mfile: + mfile.write(serialized) + module = generator.compile_module(pydantic_dir) + return module + +def generate_from_nwbfile(path:Path) -> Dict[str, ModuleType]: + namespaces = [] + h5f = h5py.File(path, 'r') + for ns_name, ns in h5f['specifications'].items(): + ns_schema = {} + for version in ns.values(): + for schema_name, schema in version.items(): + # read the source json binary string + sch_str = schema[()] + sch_dict = json.loads(sch_str) + ns_schema[schema_name] = apply_preload(sch_dict) + namespaces.append(ns_schema) + + adapters = [make_namespace_adapter(sch) for sch in namespaces] + adapters = populate_namespaces_imports(adapters) + pydantic_modules = { + adapter.namespaces.namespaces[0].name: generate_pydantic(adapter) + for adapter in adapters + } + return pydantic_modules + + + + + + + + + + + diff --git a/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py b/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py index f041572..9762fab 100644 --- a/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py +++ b/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py @@ -112,8 +112,8 @@ class Namespace(ConfiguredBaseModel): full_name: Optional[str] = Field(None, description="""Optional string with extended full name for the namespace.""") version: str = Field(...) date: Optional[datetime ] = Field(None, description="""Date that a namespace was last modified or released""") - author: List[str] = Field(default_factory=list, description="""List of strings with the names of the authors of the namespace.""") - contact: List[str] = Field(default_factory=list, description="""List of strings with the contact information for the authors. Ordering of the contacts should match the ordering of the authors.""") + author: List[str] | str = Field(default_factory=list, description="""List of strings with the names of the authors of the namespace.""") + contact: List[str] | str = Field(default_factory=list, description="""List of strings with the contact information for the authors. Ordering of the contacts should match the ordering of the authors.""") schema_: Optional[List[Schema]] = Field(alias="schema", default_factory=list, description="""List of the schema to be included in this namespace.""") diff --git a/poetry.lock b/poetry.lock index cf3250e..ccbab52 100644 --- a/poetry.lock +++ b/poetry.lock @@ -490,6 +490,39 @@ files = [ docs = ["Sphinx", "docutils (<0.18)"] test = ["faulthandler", "objgraph", "psutil"] +[[package]] +name = "h5py" +version = "3.9.0" +description = "Read and write HDF5 files from Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "h5py-3.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eb7bdd5e601dd1739698af383be03f3dad0465fe67184ebd5afca770f50df9d6"}, + {file = "h5py-3.9.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:78e44686334cbbf2dd21d9df15823bc38663f27a3061f6a032c68a3e30c47bf7"}, + {file = "h5py-3.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f68b41efd110ce9af1cbe6fa8af9f4dcbadace6db972d30828b911949e28fadd"}, + {file = "h5py-3.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:12aa556d540f11a2cae53ea7cfb94017353bd271fb3962e1296b342f6550d1b8"}, + {file = "h5py-3.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:d97409e17915798029e297a84124705c8080da901307ea58f29234e09b073ddc"}, + {file = "h5py-3.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:551e358db05a874a0f827b22e95b30092f2303edc4b91bb62ad2f10e0236e1a0"}, + {file = "h5py-3.9.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6822a814b9d8b8363ff102f76ea8d026f0ca25850bb579d85376029ee3e73b93"}, + {file = "h5py-3.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54f01202cdea754ab4227dd27014bdbd561a4bbe4b631424fd812f7c2ce9c6ac"}, + {file = "h5py-3.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64acceaf6aff92af091a4b83f6dee3cf8d3061f924a6bb3a33eb6c4658a8348b"}, + {file = "h5py-3.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:804c7fb42a34c8ab3a3001901c977a5c24d2e9c586a0f3e7c0a389130b4276fc"}, + {file = "h5py-3.9.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8d9492391ff5c3c80ec30ae2fe82a3f0efd1e750833739c25b0d090e3be1b095"}, + {file = "h5py-3.9.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9da9e7e63376c32704e37ad4cea2dceae6964cee0d8515185b3ab9cbd6b947bc"}, + {file = "h5py-3.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a4e20897c88759cbcbd38fb45b507adc91af3e0f67722aa302d71f02dd44d286"}, + {file = "h5py-3.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dbf5225543ca35ce9f61c950b73899a82be7ba60d58340e76d0bd42bf659235a"}, + {file = "h5py-3.9.0-cp38-cp38-win_amd64.whl", hash = "sha256:36408f8c62f50007d14e000f9f3acf77e103b9e932c114cbe52a3089e50ebf94"}, + {file = "h5py-3.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:23e74b878bbe1653ab34ca49b83cac85529cd0b36b9d625516c5830cc5ca2eac"}, + {file = "h5py-3.9.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3f457089c5d524b7998e3649bc63240679b8fb0a3859ea53bbb06841f3d755f1"}, + {file = "h5py-3.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6284061f3214335e1eec883a6ee497dbe7a79f19e6a57fed2dd1f03acd5a8cb"}, + {file = "h5py-3.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95f7a745efd0d56076999b52e8da5fad5d30823bac98b59c68ae75588d09991a"}, + {file = "h5py-3.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:79bbca34696c6f9eeeb36a91776070c49a060b2879828e2c8fa6c58b8ed10dd1"}, + {file = "h5py-3.9.0.tar.gz", hash = "sha256:e604db6521c1e367c6bd7fad239c847f53cc46646f2d2651372d05ae5e95f817"}, +] + +[package.dependencies] +numpy = ">=1.17.3" + [[package]] name = "hbreader" version = "0.9.1" @@ -2158,4 +2191,4 @@ tests = ["pytest", "pytest-depends"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "b552d70308f5b757a624b3d0046e54af4297bfba994a8019f4b366cce2fbe06f" +content-hash = "4b3073d732a5ddcc84db255baea64e2df0414967995d20bd902f83a39de0bc10" diff --git a/pyproject.toml b/pyproject.toml index 6682fde..35f5fb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ dash = {version="^2.12.1", optional=true} dash-cytoscape = {version="^0.3.0", optional=true} nptyping = "^2.5.0" pydantic = "^2.3.0" +h5py = "^3.9.0" [tool.poetry.extras] dev = ["nwb_schema_language"] diff --git a/tests/test_translate.py b/tests/test_translate.py new file mode 100644 index 0000000..e0f10cc --- /dev/null +++ b/tests/test_translate.py @@ -0,0 +1,9 @@ +import pytest +from pathlib import Path +from nwb_linkml.translate import generate_from_nwbfile + +def test_generate_pydantic(): + #NWBFILE = Path('/Users/jonny/Dropbox/lab/p2p_ld/data/nwb/sub-738651046_ses-760693773.nwb') + + #pydantic_module = generate_from_nwbfile(NWBFILE) +