regenerating models, some minor code cleanup and coverage omissions

This commit is contained in:
sneakers-the-rat 2023-09-15 00:37:20 -07:00
parent 3e2e6915cf
commit ccf267babd
320 changed files with 57074 additions and 442 deletions

View file

@ -4,4 +4,5 @@ source = ./nwb_linkml/src/nwb_linkml
omit =
*/nwb_schema_language/*
*/nwb_linkml/models/*
*/tests/*
*/tests/*
*/plot.py

View file

@ -46,7 +46,7 @@ class BuildResult:
self.types.extend(other.types)
return self
def __repr__(self):
def __repr__(self): # pragma: no cover
out_str = "\nBuild Result:\n"
out_str += '-'*len(out_str)
@ -122,28 +122,3 @@ class Adapter(BaseModel):
for item in self.walk(input):
if any([type(item) == atype for atype in get_type]):
yield item
#
#
# if isinstance(input, BaseModel):
# for key in input.__fields__.keys():
# val = getattr(input, key)
# if key == field:
# yield val
# if isinstance(val, (BaseModel, dict, list)):
# yield from self.walk(val, field)
#
# elif isinstance(input, dict):
# for key, val in input.items():
# if key == field:
# yield val
# if isinstance(val, (BaseModel, dict, list)):
# yield from self.walk(val, field)
#
# elif isinstance(input, (list, tuple)):
# for val in input:
# yield from self.walk(val, field)
#
# else:
# # do nothing, is a string or whatever
# pass

View file

@ -82,7 +82,7 @@ metamodel_version = "{{metamodel_version}}"
version = "{{version if version else None}}"
"""
### BASE MODEL ###
if pydantic_ver == "1":
if pydantic_ver == "1": # pragma: no cover
template += """
class WeakRefShimBaseModel(BaseModel):
__slots__ = '__weakref__'
@ -165,7 +165,7 @@ class {{ c.name }}
{% endfor %}
"""
### FWD REFS / REBUILD MODEL ###
if pydantic_ver == "1":
if pydantic_ver == "1": # pragma: no cover
template += """
# Update forward refs
# see https://pydantic-docs.helpmanual.io/usage/postponed_annotations/
@ -337,7 +337,7 @@ class NWBPydanticGenerator(PydanticGenerator):
class_def.description = class_def.description.replace('"', '\\"')
return class_def
def _check_anyof(self, s:SlotDefinition, sn: SlotDefinitionName, sv:SchemaView):
def _check_anyof(self, s:SlotDefinition, sn: SlotDefinitionName, sv:SchemaView): # pragma: no cover
# Confirm that the original slot range (ignoring the default that comes in from
# induced_slot) isn't in addition to setting any_of
if len(s.any_of) > 0 and sv.get_slot(sn).range is not None:
@ -506,7 +506,7 @@ class NWBPydanticGenerator(PydanticGenerator):
# for class_def in sv.all_classes().values():
# for slot_name in sv.class_slots(class_def.name):
# slot = sv.induced_slot(slot_name, class_def.name)
if slot.designates_type:
if slot.designates_type: # pragma: no cover
target_value = get_type_designator_value(sv, slot, class_def)
slot_value = f'"{target_value}"'
if slot.multivalued:
@ -534,7 +534,7 @@ class NWBPydanticGenerator(PydanticGenerator):
predefined_slot_values = {}
"""splitting up parent class :meth:`.get_predefined_slot_values`"""
if self.template_file is not None:
if self.template_file is not None: # pragma: no cover
with open(self.template_file) as template_file:
template_obj = Template(template_file.read())
else:
@ -645,7 +645,7 @@ class NWBPydanticGenerator(PydanticGenerator):
)
return code
def compile_module(self, module_path:Path=None, **kwargs) -> ModuleType:
def compile_module(self, module_path:Path=None, **kwargs) -> ModuleType: # pragma: no cover - replaced with provider
"""
Compiles generated python code to a module
:return:
@ -662,7 +662,7 @@ class NWBPydanticGenerator(PydanticGenerator):
except NameError as e:
raise e
def compile_python(text_or_fn: str, package_path: Path = None) -> ModuleType:
def compile_python(text_or_fn: str, package_path: Path = None) -> ModuleType: # pragma: no cover - replaced with provider
"""
Compile the text or file and return the resulting module
@param text_or_fn: Python text or file name that references python file
@ -675,22 +675,6 @@ def compile_python(text_or_fn: str, package_path: Path = None) -> ModuleType:
package_path = Path(text_or_fn)
spec = compile(python_txt, '<string>', '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

View file

@ -26,7 +26,10 @@ def module_case(name:str) -> str:
- -
- .
"""
return name.replace('-', '_').replace('.', '_').lower()
return name.replace('-', '_'
).replace('.', '_'
).replace('/', '.'
).lower()
def version_module_case(name:str) -> str:
"""

View file

@ -0,0 +1 @@
from .pydantic.core.v2_6_0_alpha.namespace import *

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,149 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_0.hdmf_common_table import (
Container,
DynamicTable,
Data
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -3,7 +3,8 @@ 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
from nptyping import 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
@ -17,7 +18,7 @@ from .core_nwb_base import (
metamodel_version = "None"
version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
@ -40,5 +41,5 @@ class Device(NWBContainer):
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
# Device.model_rebuild()
Device.model_rebuild()

View file

@ -0,0 +1,238 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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(...)
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.
"""
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 description or comments field.
"""
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,74 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_0.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
TimeIntervals.model_rebuild()
TimeIntervalsTagsIndex.model_rebuild()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,220 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_base import (
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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.""")
nwb_container:Optional[List[NWBContainer]]= 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 Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:Literal["subject"]= Field("subject")
age:Optional[str]= 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.""")
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 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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBFile.model_rebuild()
NWBFileStimulus.model_rebuild()
NWBFileGeneral.model_rebuild()
NWBFileGeneralSourceScript.model_rebuild()
Subject.model_rebuild()
NWBFileGeneralExtracellularEphys.model_rebuild()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()

View file

@ -0,0 +1,321 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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(...)
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.""")
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 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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
# Model rebuild
# 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()

View file

@ -0,0 +1,171 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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.""")
data:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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 IndexSeries(TimeSeries):
"""
Stores indices to image frames stored in an ImageSeries. The purpose of the ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
GrayscaleImage.model_rebuild()
RGBImage.model_rebuild()
RGBAImage.model_rebuild()
ImageSeries.model_rebuild()
ImageSeriesData.model_rebuild()
ImageMaskSeries.model_rebuild()
OpticalSeries.model_rebuild()
OpticalSeriesFieldOfView.model_rebuild()
IndexSeries.model_rebuild()

View file

@ -3,7 +3,8 @@ 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
from nptyping import 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal

View file

@ -0,0 +1,265 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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.""")
bands:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
description:Optional[str]= Field(None, description="""Description of what these vectors represent.""")
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.""")
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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
class UnitsSpikeTimes(VectorData):
"""
Spike times for each unit.
"""
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
# 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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -3,7 +3,8 @@ 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
from nptyping import 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
@ -14,13 +15,13 @@ else:
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
TimeSeriesSync,
NWBContainer
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
@ -59,6 +60,6 @@ class OptogeneticStimulusSite(NWBContainer):
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
# OptogeneticSeries.model_rebuild()
# OptogeneticStimulusSite.model_rebuild()
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,275 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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[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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
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.""")
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.""")
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:float= Field(..., description="""Rate that images are acquired, in Hz.""")
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:OpticalChannel= Field(..., 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[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[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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,184 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
NWBData
)
from .core_nwb_image import (
GrayscaleImage
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class RetinotopyMap(NWBData):
"""
Abstract two-dimensional map of responses. Array structure: [num_rows][num_columns]
"""
name:str= Field(...)
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 AxisMap(RetinotopyMap):
"""
Abstract two-dimensional map of responses to stimuli along a single response axis (e.g. eccentricity)
"""
name:str= Field(...)
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)
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.""")
class RetinotopyImage(GrayscaleImage):
"""
Gray-scale image related to retinotopic mapping. Array structure: [num_rows][num_columns]
"""
name:str= Field(...)
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["* 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 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. 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 to stimulus on the second measured axis.""")
sign_map:ImagingRetinotopySignMap= Field(..., description="""Sine of the angle between the direction of the gradient in axis_1 and axis_2.""")
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:ImagingRetinotopyFocalDepthImage= Field(..., description="""Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].""")
vasculature_image:ImagingRetinotopyVasculatureImage= Field(..., description="""Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]""")
class ImagingRetinotopyAxis1PhaseMap(AxisMap):
"""
Phase response to stimulus on the first measured axis.
"""
name:Literal["axis_1_phase_map"]= Field("axis_1_phase_map")
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)
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.""")
class ImagingRetinotopyAxis1PowerMap(AxisMap):
"""
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")
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)
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.""")
class ImagingRetinotopyAxis2PhaseMap(AxisMap):
"""
Phase response to stimulus on the second measured axis.
"""
name:Literal["axis_2_phase_map"]= Field("axis_2_phase_map")
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)
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.""")
class ImagingRetinotopyAxis2PowerMap(AxisMap):
"""
Power response to stimulus on the second measured axis.
"""
name:Literal["axis_2_power_map"]= Field("axis_2_power_map")
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)
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.""")
class ImagingRetinotopySignMap(RetinotopyMap):
"""
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 ImagingRetinotopyFocalDepthImage(RetinotopyImage):
"""
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")
focal_depth:Optional[float]= Field(None, description="""Focal depth offset, in meters.""")
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["* 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 ImagingRetinotopyVasculatureImage(RetinotopyImage):
"""
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["* 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
RetinotopyMap.model_rebuild()
AxisMap.model_rebuild()
RetinotopyImage.model_rebuild()
ImagingRetinotopy.model_rebuild()
ImagingRetinotopyAxis1PhaseMap.model_rebuild()
ImagingRetinotopyAxis1PowerMap.model_rebuild()
ImagingRetinotopyAxis2PhaseMap.model_rebuild()
ImagingRetinotopyAxis2PowerMap.model_rebuild()
ImagingRetinotopySignMap.model_rebuild()
ImagingRetinotopyFocalDepthImage.model_rebuild()
ImagingRetinotopyVasculatureImage.model_rebuild()

View file

@ -0,0 +1,143 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_0.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_1_0.hdmf_common_table import (
Data,
Index,
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
Container,
DynamicTable
)
from .core_nwb_retinotopy import (
RetinotopyMap,
AxisMap,
RetinotopyImage,
ImagingRetinotopy
)
from .core_nwb_image import (
GrayscaleImage,
RGBImage,
RGBAImage,
ImageSeries,
ImageMaskSeries,
OpticalSeries,
IndexSeries
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
TwoPhotonSeries,
RoiResponseSeries,
DfOverF,
Fluorescence,
ImageSegmentation,
ImagingPlane,
MotionCorrection
)
from .core_nwb_device import (
Device
)
from .core_nwb_ogen import (
OptogeneticSeries,
OptogeneticStimulusSite
)
from .core_nwb_icephys import (
PatchClampSeries,
CurrentClampSeries,
IZeroClampSeries,
CurrentClampStimulusSeries,
VoltageClampSeries,
VoltageClampStimulusSeries,
IntracellularElectrode,
SweepTable
)
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 (
NWBFile
)
from .core_nwb_epoch import (
TimeIntervals
)
metamodel_version = "None"
version = "2.2.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,149 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_2.hdmf_common_table import (
Container,
DynamicTable,
Data
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -0,0 +1,45 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBContainer
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Device.model_rebuild()

View file

@ -0,0 +1,238 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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(...)
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.
"""
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 description or comments field.
"""
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,74 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_2.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
TimeIntervals.model_rebuild()
TimeIntervalsTagsIndex.model_rebuild()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,220 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_base import (
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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.""")
nwb_container:Optional[List[NWBContainer]]= 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 Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:Literal["subject"]= Field("subject")
age:Optional[str]= 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.""")
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 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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBFile.model_rebuild()
NWBFileStimulus.model_rebuild()
NWBFileGeneral.model_rebuild()
NWBFileGeneralSourceScript.model_rebuild()
Subject.model_rebuild()
NWBFileGeneralExtracellularEphys.model_rebuild()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()

View file

@ -0,0 +1,321 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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(...)
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.""")
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 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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
# Model rebuild
# 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()

View file

@ -0,0 +1,171 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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.""")
data:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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 IndexSeries(TimeSeries):
"""
Stores indices to image frames stored in an ImageSeries. The purpose of the ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
GrayscaleImage.model_rebuild()
RGBImage.model_rebuild()
RGBAImage.model_rebuild()
ImageSeries.model_rebuild()
ImageSeriesData.model_rebuild()
ImageMaskSeries.model_rebuild()
OpticalSeries.model_rebuild()
OpticalSeriesFieldOfView.model_rebuild()
IndexSeries.model_rebuild()

View file

@ -0,0 +1,39 @@
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 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
from nwb_linkml.types import NDArray
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 Arraylike(ConfiguredBaseModel):
"""
Container for arraylike information held in the dims, shape, and dtype properties.this is a special case to be interpreted by downstream i/o. this class has no slotsand is abstract by default.- Each slot within a subclass indicates a possible dimension.- Only dimensions that are present in all the dimension specifiers in the original schema are required.- Shape requirements are indicated using max/min cardinalities on the slot.
"""
None
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Arraylike.model_rebuild()

View file

@ -0,0 +1,265 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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.""")
bands:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
description:Optional[str]= Field(None, description="""Description of what these vectors represent.""")
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.""")
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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
class UnitsSpikeTimes(VectorData):
"""
Spike times for each unit.
"""
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
# 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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -0,0 +1,65 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,275 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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[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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
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.""")
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.""")
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:float= Field(..., description="""Rate that images are acquired, in Hz.""")
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:OpticalChannel= Field(..., 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[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[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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,184 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
NWBData
)
from .core_nwb_image import (
GrayscaleImage
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class RetinotopyMap(NWBData):
"""
Abstract two-dimensional map of responses. Array structure: [num_rows][num_columns]
"""
name:str= Field(...)
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 AxisMap(RetinotopyMap):
"""
Abstract two-dimensional map of responses to stimuli along a single response axis (e.g. eccentricity)
"""
name:str= Field(...)
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)
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.""")
class RetinotopyImage(GrayscaleImage):
"""
Gray-scale image related to retinotopic mapping. Array structure: [num_rows][num_columns]
"""
name:str= Field(...)
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["* 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 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. 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 to stimulus on the second measured axis.""")
sign_map:ImagingRetinotopySignMap= Field(..., description="""Sine of the angle between the direction of the gradient in axis_1 and axis_2.""")
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:ImagingRetinotopyFocalDepthImage= Field(..., description="""Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns].""")
vasculature_image:ImagingRetinotopyVasculatureImage= Field(..., description="""Gray-scale anatomical image of cortical surface. Array structure: [rows][columns]""")
class ImagingRetinotopyAxis1PhaseMap(AxisMap):
"""
Phase response to stimulus on the first measured axis.
"""
name:Literal["axis_1_phase_map"]= Field("axis_1_phase_map")
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)
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.""")
class ImagingRetinotopyAxis1PowerMap(AxisMap):
"""
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")
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)
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.""")
class ImagingRetinotopyAxis2PhaseMap(AxisMap):
"""
Phase response to stimulus on the second measured axis.
"""
name:Literal["axis_2_phase_map"]= Field("axis_2_phase_map")
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)
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.""")
class ImagingRetinotopyAxis2PowerMap(AxisMap):
"""
Power response to stimulus on the second measured axis.
"""
name:Literal["axis_2_power_map"]= Field("axis_2_power_map")
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)
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.""")
class ImagingRetinotopySignMap(RetinotopyMap):
"""
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 ImagingRetinotopyFocalDepthImage(RetinotopyImage):
"""
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")
focal_depth:Optional[float]= Field(None, description="""Focal depth offset, in meters.""")
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["* 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 ImagingRetinotopyVasculatureImage(RetinotopyImage):
"""
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["* 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
RetinotopyMap.model_rebuild()
AxisMap.model_rebuild()
RetinotopyImage.model_rebuild()
ImagingRetinotopy.model_rebuild()
ImagingRetinotopyAxis1PhaseMap.model_rebuild()
ImagingRetinotopyAxis1PowerMap.model_rebuild()
ImagingRetinotopyAxis2PhaseMap.model_rebuild()
ImagingRetinotopyAxis2PowerMap.model_rebuild()
ImagingRetinotopySignMap.model_rebuild()
ImagingRetinotopyFocalDepthImage.model_rebuild()
ImagingRetinotopyVasculatureImage.model_rebuild()

View file

@ -0,0 +1,143 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_2.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_1_2.hdmf_common_table import (
Data,
Index,
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
Container,
DynamicTable
)
from .core_nwb_retinotopy import (
RetinotopyMap,
AxisMap,
RetinotopyImage,
ImagingRetinotopy
)
from .core_nwb_image import (
GrayscaleImage,
RGBImage,
RGBAImage,
ImageSeries,
ImageMaskSeries,
OpticalSeries,
IndexSeries
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
TwoPhotonSeries,
RoiResponseSeries,
DfOverF,
Fluorescence,
ImageSegmentation,
ImagingPlane,
MotionCorrection
)
from .core_nwb_device import (
Device
)
from .core_nwb_ogen import (
OptogeneticSeries,
OptogeneticStimulusSite
)
from .core_nwb_icephys import (
PatchClampSeries,
CurrentClampSeries,
IZeroClampSeries,
CurrentClampStimulusSeries,
VoltageClampSeries,
VoltageClampStimulusSeries,
IntracellularElectrode,
SweepTable
)
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 (
NWBFile
)
from .core_nwb_epoch import (
TimeIntervals
)
metamodel_version = "None"
version = "2.2.1"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,149 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Container,
DynamicTable,
Data
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -0,0 +1,45 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBContainer
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Device.model_rebuild()

View file

@ -0,0 +1,250 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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(...)
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.
"""
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 description or comments field.
"""
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,76 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
TimeIntervals.model_rebuild()
TimeIntervalsTagsIndex.model_rebuild()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,220 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_base import (
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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.""")
nwb_container:Optional[List[NWBContainer]]= 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 Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:Literal["subject"]= Field("subject")
age:Optional[str]= 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.""")
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 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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBFile.model_rebuild()
NWBFileStimulus.model_rebuild()
NWBFileGeneral.model_rebuild()
NWBFileGeneralSourceScript.model_rebuild()
Subject.model_rebuild()
NWBFileGeneralExtracellularEphys.model_rebuild()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()

View file

@ -0,0 +1,322 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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(...)
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.""")
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 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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# 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()

View file

@ -0,0 +1,183 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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 ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,39 @@
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 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
from nwb_linkml.types import NDArray
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 Arraylike(ConfiguredBaseModel):
"""
Container for arraylike information held in the dims, shape, and dtype properties.this is a special case to be interpreted by downstream i/o. this class has no slotsand is abstract by default.- Each slot within a subclass indicates a possible dimension.- Only dimensions that are present in all the dimension specifiers in the original schema are required.- Shape requirements are indicated using max/min cardinalities on the slot.
"""
None
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Arraylike.model_rebuild()

View file

@ -0,0 +1,304 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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.""")
bands:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
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 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.""")
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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
class UnitsSpikeTimes(VectorData):
"""
Spike times for each unit.
"""
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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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)
# 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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -0,0 +1,65 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,289 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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[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.""")
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.""")
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.""")
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.""")
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.""")
vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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:float= Field(..., description="""Rate that images are acquired, in Hz.""")
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[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[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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -3,7 +3,8 @@ 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
from nptyping import 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
@ -17,7 +18,7 @@ from .core_nwb_base import (
metamodel_version = "None"
version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
@ -125,12 +126,12 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel):
# 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()
ImagingRetinotopy.model_rebuild()
ImagingRetinotopyAxis1PhaseMap.model_rebuild()
ImagingRetinotopyAxis1PowerMap.model_rebuild()
ImagingRetinotopyAxis2PhaseMap.model_rebuild()
ImagingRetinotopyAxis2PowerMap.model_rebuild()
ImagingRetinotopyFocalDepthImage.model_rebuild()
ImagingRetinotopySignMap.model_rebuild()
ImagingRetinotopyVasculatureImage.model_rebuild()

View file

@ -0,0 +1,140 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Data,
Index,
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
Container,
DynamicTable
)
from .core_nwb_retinotopy import (
ImagingRetinotopy
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
TwoPhotonSeries,
RoiResponseSeries,
DfOverF,
Fluorescence,
ImageSegmentation,
ImagingPlane,
MotionCorrection
)
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
)
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 (
NWBFile
)
from .core_nwb_epoch import (
TimeIntervals
)
metamodel_version = "None"
version = "2.2.2"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,149 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Container,
DynamicTable,
Data
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -0,0 +1,45 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBContainer
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Device.model_rebuild()

View file

@ -0,0 +1,250 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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(...)
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.
"""
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 description or comments field.
"""
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,76 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
TimeIntervals.model_rebuild()
TimeIntervalsTagsIndex.model_rebuild()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,238 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_base import (
NWBData,
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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""")
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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(...)
class Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:str= Field(...)
age:Optional[str]= 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.""")
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.""")
# Model rebuild
# 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()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()
LabMetaData.model_rebuild()
Subject.model_rebuild()

View file

@ -0,0 +1,322 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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(...)
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.""")
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 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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# 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()

View file

@ -0,0 +1,183 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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 ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,39 @@
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 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
from nwb_linkml.types import NDArray
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 Arraylike(ConfiguredBaseModel):
"""
Container for arraylike information held in the dims, shape, and dtype properties.this is a special case to be interpreted by downstream i/o. this class has no slotsand is abstract by default.- Each slot within a subclass indicates a possible dimension.- Only dimensions that are present in all the dimension specifiers in the original schema are required.- Shape requirements are indicated using max/min cardinalities on the slot.
"""
None
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Arraylike.model_rebuild()

View file

@ -0,0 +1,304 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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.""")
bands:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
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 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.""")
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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
class UnitsSpikeTimes(VectorData):
"""
Spike times for each unit.
"""
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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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)
# 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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -0,0 +1,65 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,289 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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[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.""")
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.""")
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.""")
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.""")
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.""")
vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
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[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[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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,137 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface
)
metamodel_version = "None"
version = "2.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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]""")
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()

View file

@ -0,0 +1,146 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Data,
Index,
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
Container,
DynamicTable
)
from .core_nwb_retinotopy import (
ImagingRetinotopy
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
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
)
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.2.4"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,149 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Container,
DynamicTable,
Data
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -0,0 +1,45 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBContainer
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Device.model_rebuild()

View file

@ -0,0 +1,250 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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(...)
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.
"""
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 description or comments field.
"""
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,76 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
TimeIntervals.model_rebuild()
TimeIntervalsTagsIndex.model_rebuild()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,238 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_base import (
NWBData,
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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""")
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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(...)
class Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:str= Field(...)
age:Optional[str]= 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.""")
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.""")
# Model rebuild
# 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()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()
LabMetaData.model_rebuild()
Subject.model_rebuild()

View file

@ -0,0 +1,322 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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(...)
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.""")
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 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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
# Model rebuild
# 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()

View file

@ -0,0 +1,183 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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 ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,39 @@
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 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
from nwb_linkml.types import NDArray
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 Arraylike(ConfiguredBaseModel):
"""
Container for arraylike information held in the dims, shape, and dtype properties.this is a special case to be interpreted by downstream i/o. this class has no slotsand is abstract by default.- Each slot within a subclass indicates a possible dimension.- Only dimensions that are present in all the dimension specifiers in the original schema are required.- Shape requirements are indicated using max/min cardinalities on the slot.
"""
None
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Arraylike.model_rebuild()

View file

@ -0,0 +1,304 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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.""")
bands:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector columns of this dynamic table.""")
class DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
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 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.""")
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.""")
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 of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], Any]]= Field(None)
class UnitsSpikeTimes(VectorData):
"""
Spike times for each unit.
"""
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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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)
# 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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -0,0 +1,65 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,298 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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.""")
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.""")
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.""")
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.""")
vector_data:Optional[List[VectorData]]= Field(default_factory=list, description="""Vector columns of this dynamic table.""")
vector_index:Optional[List[VectorIndex]]= Field(default_factory=list, description="""Indices for the vector 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
array:Optional[NDArray[Shape["* num_rows"], 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.""")
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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,137 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface
)
metamodel_version = "None"
version = "2.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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]""")
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()

View file

@ -0,0 +1,146 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_1_3.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_1_3.hdmf_common_table import (
Data,
Index,
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
Container,
DynamicTable
)
from .core_nwb_retinotopy import (
ImagingRetinotopy
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
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
)
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.2.5"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,153 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_5_0.hdmf_common_base import (
Container,
Data
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTable
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
name:str= Field(...)
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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

View file

@ -0,0 +1,45 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBContainer
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Device.model_rebuild()

View file

@ -0,0 +1,252 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTableRegion,
DynamicTable
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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' and 'channel_conversion' (if present).""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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""")
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""")
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.""")
# 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()

View file

@ -0,0 +1,87 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTable,
VectorIndex,
VectorData
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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[List[Any]]= Field(default_factory=list, 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 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()
TimeIntervalsTimeseriesIndex.model_rebuild()

View file

@ -0,0 +1,237 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_epoch import (
TimeIntervals
)
from .core_nwb_base import (
NWBData,
NWBDataInterface,
TimeSeries,
ProcessingModule,
NWBContainer
)
from .core_nwb_icephys import (
SweepTable,
IntracellularElectrode
)
from .core_nwb_ogen import (
OptogeneticStimulusSite
)
from .core_nwb_ophys import (
ImagingPlane
)
from .core_nwb_misc import (
Units
)
from .core_nwb_device import (
Device
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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""")
class NWBFile(NWBContainer):
"""
An NWB:N file storing cellular-based neurophysiology data from a single experimental session.
"""
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[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[NWBFileGeneralExtracellularEphysElectrodes]= Field(None, description="""A table of all electrodes (i.e. channels) used for recording.""")
class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable):
"""
A table of all electrodes (i.e. channels) used for recording.
"""
name:Literal["electrodes"]= Field("electrodes")
x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate of the channel location in the brain (+x is posterior).""")
y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate of the channel location in the brain (+y is inferior).""")
z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate of the channel location in the brain (+z is right).""")
imp:Optional[List[float]]= Field(default_factory=list, description="""Impedance of the channel, in ohms.""")
location:Optional[List[str]]= Field(default_factory=list, description="""Location of the electrode (channel). 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.""")
filtering:Optional[List[float]]= Field(default_factory=list, description="""Description of hardware filtering, including the filter name and frequency cutoffs.""")
group:Optional[List[ElectrodeGroup]]= Field(default_factory=list, description="""Reference to the ElectrodeGroup this electrode is a part of.""")
group_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the ElectrodeGroup this electrode is a part of.""")
rel_x:Optional[List[float]]= Field(default_factory=list, description="""x coordinate in electrode group""")
rel_y:Optional[List[float]]= Field(default_factory=list, description="""y coordinate in electrode group""")
rel_z:Optional[List[float]]= Field(default_factory=list, description="""z coordinate in electrode group""")
reference:Optional[List[str]]= Field(default_factory=list, description="""Description of the reference used for this 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.""")
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 NWBFileGeneralIntracellularEphys(ConfiguredBaseModel):
"""
Metadata related to intracellular electrophysiology.
"""
name:Literal["intracellular_ephys"]= Field("intracellular_ephys")
filtering:Optional[str]= Field(None, description="""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="""The table which groups different PatchClampSeries together.""")
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(...)
class Subject(NWBContainer):
"""
Information about the animal or person from which the data was measured.
"""
name:str= Field(...)
age:Optional[str]= 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.""")
# Model rebuild
# 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()
NWBFileGeneralExtracellularEphysElectrodes.model_rebuild()
NWBFileGeneralIntracellularEphys.model_rebuild()
NWBFileIntervals.model_rebuild()
LabMetaData.model_rebuild()
Subject.model_rebuild()

View file

@ -0,0 +1,327 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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'.""")
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.""")
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.""")
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'.""")
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.""")
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'.""")
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.""")
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'.""")
value:Any= Field(...)
class IntracellularElectrode(NWBContainer):
"""
An intracellular electrode and its metadata.
"""
name:str= Field(...)
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):
"""
The table which groups different PatchClampSeries together.
"""
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)
# Model rebuild
# 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()

View file

@ -0,0 +1,183 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
Image,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.
"""
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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 ImageIndexSeries is to allow a static image stack to be stored somewhere, 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 ImageSeries, and the timestamps array indicates when that image was displayed.
"""
name:str= Field(...)
data:List[int]= Field(default_factory=list, description="""Index of the frame in the referenced ImageSeries.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,39 @@
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 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
from nwb_linkml.types import NDArray
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 Arraylike(ConfiguredBaseModel):
"""
Container for arraylike information held in the dims, shape, and dtype properties.this is a special case to be interpreted by downstream i/o. this class has no slotsand is abstract by default.- Each slot within a subclass indicates a possible dimension.- Only dimensions that are present in all the dimension specifiers in the original schema are required.- Shape requirements are indicated using max/min cardinalities on the slot.
"""
None
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
Arraylike.model_rebuild()

View file

@ -0,0 +1,389 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
from .core_nwb_ecephys import (
ElectrodeGroup
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
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.""")
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:DecompositionSeriesBands= 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 DecompositionSeriesBands(DynamicTable):
"""
Table for describing the bands that this series was generated from. There should be one row in this table for each band.
"""
name:Literal["bands"]= Field("bands")
band_name:Optional[List[str]]= Field(default_factory=list, description="""Name of the band, e.g. theta.""")
band_limits:DecompositionSeriesBandsBandLimits= Field(..., description="""Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.""")
band_mean:List[float]= Field(default_factory=list, description="""The mean Gaussian filters, in Hz.""")
band_stdev:List[float]= Field(default_factory=list, description="""The standard deviation of Gaussian filters, in Hz.""")
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 DecompositionSeriesBandsBandLimits(VectorData):
"""
Low and high limit of each band in Hz. If it is a Gaussian filter, use 2 SD on either side of the center.
"""
name:Literal["band_limits"]= Field("band_limits")
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 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.""")
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.
"""
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()
DecompositionSeriesBands.model_rebuild()
DecompositionSeriesBandsBandLimits.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()

View file

@ -0,0 +1,65 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
TimeSeriesStartingTime,
TimeSeries,
NWBContainer,
TimeSeriesSync
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OptogeneticSeries.model_rebuild()
OptogeneticStimulusSite.model_rebuild()

View file

@ -0,0 +1,309 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries,
NWBContainer
)
from .core_nwb_image import (
ImageSeriesData,
ImageSeries
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTableRegion,
VectorIndex,
VectorData,
DynamicTable
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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:Optional[ImageSeriesData]= Field(None, description="""Binary data representing images across frames.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
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()

View file

@ -0,0 +1,137 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface
)
metamodel_version = "None"
version = "2.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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]""")
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()

View file

@ -0,0 +1,158 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_experimental.v0_1_0.hdmf_experimental_resources import (
ExternalResources
)
from ...hdmf_common.v1_5_0.hdmf_common_sparse import (
CSRMatrix
)
from ...hdmf_common.v1_5_0.hdmf_common_base import (
Data,
Container,
SimpleMultiContainer
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
VectorData,
VectorIndex,
ElementIdentifiers,
DynamicTableRegion,
DynamicTable,
AlignedDynamicTable
)
from ...hdmf_experimental.v0_1_0.hdmf_experimental_experimental import (
EnumData
)
from .core_nwb_retinotopy import (
ImagingRetinotopy
)
from .core_nwb_base import (
NWBData,
Image,
NWBContainer,
NWBDataInterface,
TimeSeries,
ProcessingModule,
Images
)
from .core_nwb_ophys import (
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
)
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.3.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model

View file

@ -0,0 +1,169 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from ...hdmf_common.v1_5_0.hdmf_common_base import (
Container,
Data
)
from ...hdmf_common.v1_5_0.hdmf_common_table import (
DynamicTable,
VectorData
)
metamodel_version = "None"
version = "2.4.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class NWBData(Data):
"""
An abstract data type for a dataset.
"""
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[
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 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[
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)
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(...)
class NWBDataInterface(NWBContainer):
"""
An abstract data type for a generic container storing collections of data, as opposed to metadata.
"""
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.""")
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.""")
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'.""")
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.""")
class Images(NWBDataInterface):
"""
A collection 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.""")
# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
NWBData.model_rebuild()
TimeSeriesReferenceVectorData.model_rebuild()
Image.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()

View file

@ -0,0 +1,135 @@
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 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
from nwb_linkml.types import NDArray
import sys
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from .core_nwb_base import (
NWBDataInterface,
TimeSeriesSync,
TimeSeriesStartingTime,
TimeSeries
)
from .core_nwb_misc import (
IntervalSeries
)
metamodel_version = "None"
version = "2.4.0"
class ConfiguredBaseModel(BaseModel,
validate_assignment = True,
validate_default = True,
extra = 'forbid',
arbitrary_types_allowed = True,
use_enum_values = True):
pass
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.""")
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'.""")
array:Optional[Union[
NDArray[Shape["* num_times"], Number],
NDArray[Shape["* num_times, * num_features"], 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.""")
class BehavioralEvents(NWBDataInterface):
"""
TimeSeries for storing behavioral events. See description of <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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 <a href=\"#BehavioralEpochs\">BehavioralEpochs</a> for more details.
"""
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.""")
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.""")
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.""")
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.""")
# 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()
PupilTracking.model_rebuild()
EyeTracking.model_rebuild()
CompassDirection.model_rebuild()
Position.model_rebuild()

Some files were not shown because too many files have changed in this diff Show more