diff --git a/docs/conf.py b/docs/conf.py index b10a269..55adb16 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,7 +27,7 @@ extensions = [ 'sphinx.ext.graphviz', 'sphinx.ext.napoleon', 'sphinx.ext.autodoc', - 'sphinxcontrib.autodoc_pydantic', + #'sphinxcontrib.autodoc_pydantic', 'sphinx.ext.intersphinx', 'sphinx.ext.doctest', "sphinx_design", @@ -93,7 +93,8 @@ graphviz_output_format = "svg" # autodoc autodoc_pydantic_model_show_json_error_strategy = 'coerce' autodoc_pydantic_model_show_json = False -autodoc_mock_imports = [] +#autodoc_mock_imports = ['pydantic', 'curies', 'pydantic_settings'] +autodoc_mock_imports = ['curies'] autoclass_content = "both" autodoc_member_order='bysource' add_module_names = False @@ -109,16 +110,16 @@ nb_append_css = False # -------------------------------------------------- # doctest -doctest_global_setup = """ -from linkml_runtime.linkml_model import ClassDefinition, SlotDefinition, SchemaDefinition -from nwb_schema_language import Namespaces, Namespace, Dataset, Group, Schema -from linkml_runtime.dumpers import yaml_dumper -import yaml -from pydantic import BaseModel, Field -import numpy as np - -from nwb_linkml.adapters import BuildResult -""" +# doctest_global_setup = """ +# from linkml_runtime.linkml_model import ClassDefinition, SlotDefinition, SchemaDefinition +# from nwb_schema_language import Namespaces, Namespace, Dataset, Group, Schema +# from linkml_runtime.dumpers import yaml_dumper +# import yaml +# from pydantic import BaseModel, Field +# import numpy as np +# +# from nwb_linkml.adapters import BuildResult +# """ # -------------------------------------------------- # Etc one-off settings diff --git a/nwb_linkml/src/nwb_linkml/adapters/adapter.py b/nwb_linkml/src/nwb_linkml/adapters/adapter.py index 63bf086..dbdc961 100644 --- a/nwb_linkml/src/nwb_linkml/adapters/adapter.py +++ b/nwb_linkml/src/nwb_linkml/adapters/adapter.py @@ -118,7 +118,7 @@ class Adapter(BaseModel): Generate the corresponding linkML element for this adapter """ - def walk(self, input: BaseModel | list | dict) -> Generator[BaseModel | Any | None, None, None]: + def walk(self, input: Union[BaseModel, dict, list]) -> Generator[Union[BaseModel, Any, None], None, None]: """ Iterate through all items in the given model. @@ -158,7 +158,7 @@ class Adapter(BaseModel): pass def walk_fields( - self, input: BaseModel | list | dict, field: str | Tuple[str, ...] + self, input: Union[BaseModel, dict, list], field: str | Tuple[str, ...] ) -> Generator[Any, None, None]: """ Recursively walk input for fields that match ``field`` @@ -178,7 +178,7 @@ class Adapter(BaseModel): yield item[1] def walk_field_values( - self, input: BaseModel | list | dict, field: str, value: Optional[Any] = None + self, input: Union[BaseModel, dict, list], field: str, value: Optional[Any] = None ) -> Generator[BaseModel, None, None]: """ Recursively walk input for **models** that contain a ``field`` as a direct child @@ -202,7 +202,7 @@ class Adapter(BaseModel): yield item def walk_types( - self, input: BaseModel | list | dict, get_type: Type[T] | Tuple[Type[T], Type[Unpack[Ts]]] + self, input: Union[BaseModel, dict, list], get_type: Type[T] | Tuple[Type[T], Type[Unpack[Ts]]] ) -> Generator[T | Ts, None, None]: """ Walk a model, yielding items that are the same type as the given type diff --git a/nwb_linkml/src/nwb_linkml/generators/pydantic.py b/nwb_linkml/src/nwb_linkml/generators/pydantic.py index 41192f7..494d92b 100644 --- a/nwb_linkml/src/nwb_linkml/generators/pydantic.py +++ b/nwb_linkml/src/nwb_linkml/generators/pydantic.py @@ -67,10 +67,10 @@ from nwb_linkml.maps import flat_to_nptyping from nwb_linkml.maps.naming import module_case, version_module_case -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False +# class LinkML_Meta(BaseModel): +# """Extra LinkML Metadata stored as a class attribute""" +# +# tree_root: bool = False def default_template( @@ -112,32 +112,9 @@ from {{ import_module }} import ( metamodel_version = "{{metamodel_version}}" version = "{{version if version else None}}" """ - ### BASE MODEL ### - if pydantic_ver == "1": # pragma: no cover - template += """ -List = BaseList - -class WeakRefShimBaseModel(BaseModel): - __slots__ = '__weakref__' - -class ConfiguredBaseModel(WeakRefShimBaseModel, - validate_assignment = False, - validate_all = True, - underscore_attrs_are_private = True, - extra = {% if allow_extra %}'allow'{% else %}'forbid'{% endif %}, - arbitrary_types_allowed = True, - use_enum_values = True): -""" - else: - template += """ + template += """ class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment = True, - validate_default = True, - extra = {% if allow_extra %}'allow'{% else %}'forbid'{% endif %}, - arbitrary_types_allowed = True, - use_enum_values = True - ) + """ ### Injected Fields template += """ @@ -233,23 +210,6 @@ class {{ c.name }} None {% endfor %} {% endfor %} -""" - ### FWD REFS / REBUILD MODEL ### - if pydantic_ver == "1": # pragma: no cover - template += """ -# Update forward refs -# see https://pydantic-docs.helpmanual.io/usage/postponed_annotations/ -{% for c in schema.classes.values() -%} -{{ c.name }}.update_forward_refs() -{% endfor %} -""" - else: - template += """ -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -{% for c in schema.classes.values() -%} -{{ c.name }}.model_rebuild() -{% endfor %} """ return template @@ -455,18 +415,18 @@ class NWBPydanticGenerator(PydanticGenerator): if not base_range_subsumes_any_of: raise ValueError("Slot cannot have both range and any_of defined") - def _get_linkml_classvar(self, cls: ClassDefinition) -> SlotDefinition: - """A class variable that holds additional linkml attrs""" - slot = SlotDefinition(name="linkml_meta") - slot.annotations["python_range"] = Annotation("python_range", "ClassVar[LinkML_Meta]") - meta_fields = {k: getattr(cls, k, None) for k in LinkML_Meta.model_fields.keys()} - meta_field_strings = [f"{k}={v}" for k, v in meta_fields.items() if v is not None] - meta_field_string = ", ".join(meta_field_strings) - slot.annotations["fixed_field"] = Annotation( - "fixed_field", f"Field(LinkML_Meta({meta_field_string}), frozen=True)" - ) - - return slot + # def _get_linkml_classvar(self, cls: ClassDefinition) -> SlotDefinition: + # """A class variable that holds additional linkml attrs""" + # slot = SlotDefinition(name="linkml_meta") + # slot.annotations["python_range"] = Annotation("python_range", "ClassVar[LinkML_Meta]") + # meta_fields = {k: getattr(cls, k, None) for k in LinkML_Meta.model_fields.keys()} + # meta_field_strings = [f"{k}={v}" for k, v in meta_fields.items() if v is not None] + # meta_field_string = ", ".join(meta_field_strings) + # slot.annotations["fixed_field"] = Annotation( + # "fixed_field", f"Field(LinkML_Meta({meta_field_string}), frozen=True)" + # ) + # + # return slot def sort_classes( self, clist: List[ClassDefinition], imports: Dict[str, List[str]] @@ -673,7 +633,7 @@ class NWBPydanticGenerator(PydanticGenerator): template_obj = Template(template_file.read()) else: template_obj = Template( - default_template(self.pydantic_version, extra_classes=[LinkML_Meta]) + default_template(self.pydantic_version, extra_classes=[]) ) sv: SchemaView @@ -718,7 +678,7 @@ class NWBPydanticGenerator(PydanticGenerator): del class_def.attributes[attribute] # make class attr that stores extra linkml attrs - class_def.attributes["linkml_meta"] = self._get_linkml_classvar(class_def) + # class_def.attributes["linkml_meta"] = self._get_linkml_classvar(class_def) class_name = class_original.name predefined_slot_values[camelcase(class_name)] = {} diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_base.py index 8b185f9..413763b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_0.hdmf_common_table import Container, Data, DynamicTable +from ...hdmf_common.v1_1_0.hdmf_common_table import Data, Container, DynamicTable metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -81,7 +67,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -103,7 +88,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -112,7 +96,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -121,7 +104,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -161,7 +143,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -190,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -205,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -214,7 +193,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -227,7 +205,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -235,17 +212,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_behavior.py index f72bf99..06218a0 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_device.py index 5277903..e05712d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ecephys.py index a5382bd..12c3900 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -129,7 +115,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -193,7 +177,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -220,7 +203,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -236,7 +218,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -256,7 +237,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -268,7 +248,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -280,7 +259,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -292,7 +270,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -311,7 +288,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -323,7 +299,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -343,7 +318,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -360,20 +334,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_epoch.py index 4ef7020..d3ca995 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_1_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -122,7 +108,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -135,7 +120,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -158,17 +142,8 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = 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() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_file.py index a49386a..1a87d9c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_file.py @@ -27,27 +27,27 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import TimeSeries, NWBDataInterface, ProcessingModule, NWBContainer +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_1_0.hdmf_common_table import ( - DynamicTable, - VectorData, - VectorIndex, -) +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import IntracellularElectrode, SweepTable +from .core_nwb_base import NWBContainer, ProcessingModule, NWBDataInterface, TimeSeries -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_1_0.hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, +) + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -55,13 +55,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -81,18 +74,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBFile(NWBContainer): """ An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -163,7 +149,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -179,7 +164,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -269,7 +253,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -280,7 +263,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["subject"] = Field("subject") age: Optional[str] = Field( None, @@ -314,7 +296,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -330,7 +311,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -400,7 +380,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -413,15 +392,3 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): None, description="""The table which groups different PatchClampSeries together.""", ) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_icephys.py index b515f02..b68d0e3 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_1_0.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bias_current: float = Field( ..., description="""Bias current, in amps, fixed to 0.0.""" @@ -273,7 +255,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -321,7 +302,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -335,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -404,7 +383,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -418,7 +396,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -432,7 +409,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -446,7 +422,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -460,7 +435,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -474,7 +448,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -488,7 +461,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -502,7 +474,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -518,7 +489,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -566,7 +536,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -580,7 +549,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -612,7 +580,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -648,34 +615,8 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_image.py index e2ce562..68bc1ba 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_misc.py index 4eb8b57..b6aa819 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_misc.py @@ -27,15 +27,15 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesStartingTime, TimeSeriesSync - from ...hdmf_common.v1_1_0.hdmf_common_table import ( DynamicTableRegion, - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeriesStartingTime, TimeSeries, TimeSeriesSync + from .core_nwb_ecephys import ElectrodeGroup @@ -44,13 +44,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -266,7 +248,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -282,7 +263,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -322,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -386,7 +365,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -399,7 +377,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -415,7 +392,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -428,7 +404,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -441,7 +416,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -450,20 +424,3 @@ class UnitsElectrodes(DynamicTableRegion): description: Optional[str] = Field( None, description="""Description of what this table region points to.""" ) - - -# 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ogen.py index 71266f5..c8dbfca 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ophys.py index d88b691..877eedb 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_ophys.py @@ -27,31 +27,24 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTable, DynamicTableRegion +from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTableRegion, DynamicTable + +from .core_nwb_image import ImageSeriesExternalFile, ImageSeries from .core_nwb_base import ( - NWBDataInterface, - TimeSeriesStartingTime, - TimeSeries, NWBContainer, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, TimeSeriesSync, ) -from .core_nwb_image import ImageSeries, ImageSeriesExternalFile - metamodel_version = "None" version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -71,18 +64,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -149,7 +135,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -193,7 +178,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -209,7 +193,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -221,7 +204,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -233,7 +215,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable]] | Union[BaseModel, DynamicTable] ] = Field(default_factory=dict) @@ -245,7 +226,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the imaging plane.""" @@ -287,7 +267,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["manifold"] = Field("manifold") conversion: Optional[float] = Field( None, @@ -310,7 +289,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["origin_coords"] = Field("origin_coords") unit: Optional[str] = Field( None, @@ -324,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["grid_spacing"] = Field("grid_spacing") unit: Optional[str] = Field( None, @@ -338,7 +315,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -353,24 +329,7 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[NWBDataInterface] | NWBDataInterface] = Field( default_factory=dict ) name: str = Field(...) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TwoPhotonSeries.model_rebuild() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -ImagingPlane.model_rebuild() -ImagingPlaneManifold.model_rebuild() -ImagingPlaneOriginCoords.model_rebuild() -ImagingPlaneGridSpacing.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_retinotopy.py index b90c155..eeb88c3 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/core_nwb_retinotopy.py @@ -27,23 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import NWBDataInterface, NWBData - from .core_nwb_image import GrayscaleImage +from .core_nwb_base import NWBData, NWBDataInterface + metamodel_version = "None" version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class RetinotopyMap(NWBData): """ Abstract two-dimensional map of responses. Array structure: [num_rows][num_columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) dimension: Optional[int] = Field( None, @@ -91,7 +77,6 @@ class AxisMap(RetinotopyMap): Abstract two-dimensional map of responses to stimuli along a single response axis (e.g. eccentricity) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) unit: Optional[str] = Field( None, description="""Unit that axis data is stored in (e.g., degrees).""" @@ -111,7 +96,6 @@ class RetinotopyImage(GrayscaleImage): Gray-scale image related to retinotopic mapping. Array structure: [num_rows][num_columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bits_per_pixel: Optional[int] = Field( None, @@ -147,7 +131,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -185,7 +168,6 @@ class ImagingRetinotopyAxis1PhaseMap(AxisMap): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -225,7 +206,6 @@ class ImagingRetinotopyAxis2PhaseMap(AxisMap): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -245,7 +225,6 @@ class ImagingRetinotopyAxis2PowerMap(AxisMap): Power response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -265,7 +244,6 @@ class ImagingRetinotopySignMap(RetinotopyMap): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -282,7 +260,6 @@ class ImagingRetinotopyFocalDepthImage(RetinotopyImage): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") focal_depth: Optional[float] = Field( None, description="""Focal depth offset, in meters.""" @@ -321,7 +298,6 @@ class ImagingRetinotopyVasculatureImage(RetinotopyImage): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -350,18 +326,3 @@ class ImagingRetinotopyVasculatureImage(RetinotopyImage): NDArray[Shape["* x, * y, 4 r_g_b_a"], float], ] ] = Field(None) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/namespace.py index bb9e62b..83bd6c9 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_0/namespace.py @@ -194,13 +194,6 @@ version = "2.2.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -218,13 +211,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_base.py index 42e887f..802ec47 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_2.hdmf_common_table import Container, Data, DynamicTable +from ...hdmf_common.v1_1_2.hdmf_common_table import Data, Container, DynamicTable metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -81,7 +67,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -103,7 +88,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -112,7 +96,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -121,7 +104,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -161,7 +143,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -190,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -205,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -214,7 +193,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -227,7 +205,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -235,17 +212,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_behavior.py index 8322f55..15b5619 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_device.py index 5a094c5..600af74 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ecephys.py index 510cd49..cb557bd 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -129,7 +115,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -193,7 +177,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -220,7 +203,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -236,7 +218,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -256,7 +237,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -268,7 +248,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -280,7 +259,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -292,7 +270,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -311,7 +288,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -323,7 +299,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -343,7 +318,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -360,20 +334,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_epoch.py index 9984f79..35ba0aa 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_1_2.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -122,7 +108,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -135,7 +120,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -158,17 +142,8 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = 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() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_file.py index 61b31eb..d95bbe1 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_file.py @@ -27,27 +27,27 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import TimeSeries, NWBDataInterface, ProcessingModule, NWBContainer +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_1_2.hdmf_common_table import ( - DynamicTable, - VectorData, - VectorIndex, -) +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import IntracellularElectrode, SweepTable +from .core_nwb_base import NWBContainer, ProcessingModule, NWBDataInterface, TimeSeries -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_1_2.hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, +) + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -55,13 +55,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -81,18 +74,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBFile(NWBContainer): """ An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -163,7 +149,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -179,7 +164,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -269,7 +253,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -280,7 +263,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["subject"] = Field("subject") age: Optional[str] = Field( None, @@ -314,7 +296,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -330,7 +311,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -400,7 +380,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -413,15 +392,3 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): None, description="""The table which groups different PatchClampSeries together.""", ) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_icephys.py index 7b59c71..54888da 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_1_2.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bias_current: float = Field( ..., description="""Bias current, in amps, fixed to 0.0.""" @@ -273,7 +255,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -321,7 +302,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -335,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -404,7 +383,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -418,7 +396,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -432,7 +409,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -446,7 +422,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -460,7 +435,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -474,7 +448,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -488,7 +461,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -502,7 +474,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -518,7 +489,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -566,7 +536,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -580,7 +549,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -612,7 +580,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -648,34 +615,8 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_image.py index 020436f..9aa104d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_misc.py index 35abf70..4d8b2ad 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_misc.py @@ -27,15 +27,15 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesStartingTime, TimeSeriesSync - from ...hdmf_common.v1_1_2.hdmf_common_table import ( DynamicTableRegion, - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeriesStartingTime, TimeSeries, TimeSeriesSync + from .core_nwb_ecephys import ElectrodeGroup @@ -44,13 +44,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -266,7 +248,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -282,7 +263,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -322,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -386,7 +365,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -399,7 +377,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -415,7 +392,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -428,7 +404,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -441,7 +416,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -450,20 +424,3 @@ class UnitsElectrodes(DynamicTableRegion): description: Optional[str] = Field( None, description="""Description of what this table region points to.""" ) - - -# 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ogen.py index 5f19f64..8189191 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ophys.py index cbceea3..ece81c6 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_ophys.py @@ -27,31 +27,24 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTable, DynamicTableRegion +from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTableRegion, DynamicTable + +from .core_nwb_image import ImageSeriesExternalFile, ImageSeries from .core_nwb_base import ( - NWBDataInterface, - TimeSeriesStartingTime, - TimeSeries, NWBContainer, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, TimeSeriesSync, ) -from .core_nwb_image import ImageSeries, ImageSeriesExternalFile - metamodel_version = "None" version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -71,18 +64,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -149,7 +135,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -193,7 +178,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -209,7 +193,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -221,7 +204,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -233,7 +215,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable]] | Union[BaseModel, DynamicTable] ] = Field(default_factory=dict) @@ -245,7 +226,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the imaging plane.""" @@ -287,7 +267,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["manifold"] = Field("manifold") conversion: Optional[float] = Field( None, @@ -310,7 +289,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["origin_coords"] = Field("origin_coords") unit: Optional[str] = Field( None, @@ -324,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["grid_spacing"] = Field("grid_spacing") unit: Optional[str] = Field( None, @@ -338,7 +315,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -353,24 +329,7 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[NWBDataInterface] | NWBDataInterface] = Field( default_factory=dict ) name: str = Field(...) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TwoPhotonSeries.model_rebuild() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -ImagingPlane.model_rebuild() -ImagingPlaneManifold.model_rebuild() -ImagingPlaneOriginCoords.model_rebuild() -ImagingPlaneGridSpacing.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_retinotopy.py index 198a64b..6504e00 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/core_nwb_retinotopy.py @@ -27,23 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import NWBDataInterface, NWBData - from .core_nwb_image import GrayscaleImage +from .core_nwb_base import NWBData, NWBDataInterface + metamodel_version = "None" version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class RetinotopyMap(NWBData): """ Abstract two-dimensional map of responses. Array structure: [num_rows][num_columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) dimension: Optional[int] = Field( None, @@ -91,7 +77,6 @@ class AxisMap(RetinotopyMap): Abstract two-dimensional map of responses to stimuli along a single response axis (e.g. eccentricity) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) unit: Optional[str] = Field( None, description="""Unit that axis data is stored in (e.g., degrees).""" @@ -111,7 +96,6 @@ class RetinotopyImage(GrayscaleImage): Gray-scale image related to retinotopic mapping. Array structure: [num_rows][num_columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bits_per_pixel: Optional[int] = Field( None, @@ -147,7 +131,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -185,7 +168,6 @@ class ImagingRetinotopyAxis1PhaseMap(AxisMap): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -225,7 +206,6 @@ class ImagingRetinotopyAxis2PhaseMap(AxisMap): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -245,7 +225,6 @@ class ImagingRetinotopyAxis2PowerMap(AxisMap): Power response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) 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).""" @@ -265,7 +244,6 @@ class ImagingRetinotopySignMap(RetinotopyMap): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -282,7 +260,6 @@ class ImagingRetinotopyFocalDepthImage(RetinotopyImage): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") focal_depth: Optional[float] = Field( None, description="""Focal depth offset, in meters.""" @@ -321,7 +298,6 @@ class ImagingRetinotopyVasculatureImage(RetinotopyImage): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -350,18 +326,3 @@ class ImagingRetinotopyVasculatureImage(RetinotopyImage): NDArray[Shape["* x, * y, 4 r_g_b_a"], float], ] ] = Field(None) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/namespace.py index f645bea..a83f232 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_1/namespace.py @@ -194,13 +194,6 @@ version = "2.2.1" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -218,13 +211,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_base.py index cc3fe09..39997b7 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_3.hdmf_common_table import Container, Data, DynamicTable +from ...hdmf_common.v1_1_3.hdmf_common_table import Data, Container, DynamicTable metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -81,7 +67,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -103,7 +88,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -112,7 +96,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -121,7 +104,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -161,7 +143,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -190,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -205,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -214,7 +193,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -227,7 +205,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -235,17 +212,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_behavior.py index 05ddcd3..675287d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_device.py index 78c7a06..39fe662 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ecephys.py index 9143d05..fc6b1c8 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -129,7 +115,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -153,7 +138,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -201,7 +185,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -228,7 +211,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -252,7 +234,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -272,7 +253,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -284,7 +264,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -296,7 +275,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -308,7 +286,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -327,7 +304,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -339,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -359,7 +334,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -376,20 +350,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_epoch.py index 2164a6c..c7106a2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -122,7 +108,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -136,7 +121,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -167,18 +151,9 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = 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() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_file.py index 3e80143..029c37a 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_file.py @@ -27,27 +27,27 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import TimeSeries, NWBDataInterface, ProcessingModule, NWBContainer +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, - VectorData, - VectorIndex, -) +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import IntracellularElectrode, SweepTable +from .core_nwb_base import NWBContainer, ProcessingModule, NWBDataInterface, TimeSeries -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, +) + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -55,13 +55,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -81,18 +74,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBFile(NWBContainer): """ An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -163,7 +149,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -179,7 +164,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -269,7 +253,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -280,7 +263,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["subject"] = Field("subject") age: Optional[str] = Field( None, @@ -314,7 +296,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -330,7 +311,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -400,7 +380,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -413,15 +392,3 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): None, description="""The table which groups different PatchClampSeries together.""", ) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_icephys.py index 9ccfc33..cc35e4a 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bias_current: float = Field( ..., description="""Bias current, in amps, fixed to 0.0.""" @@ -273,7 +255,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -321,7 +302,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -335,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -404,7 +383,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -418,7 +396,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -432,7 +409,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -446,7 +422,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -460,7 +435,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -474,7 +448,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -488,7 +461,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -502,7 +474,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -518,7 +489,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -566,7 +536,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -580,7 +549,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -612,7 +580,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -648,35 +615,9 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_image.py index 4a0cc17..9263d50 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_misc.py index 3e9ae8e..e3f3eaf 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_misc.py @@ -27,15 +27,15 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesStartingTime, TimeSeriesSync - from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTableRegion, DynamicTable, - VectorIndex, VectorData, ) +from .core_nwb_base import TimeSeriesStartingTime, TimeSeries, TimeSeriesSync + from .core_nwb_ecephys import ElectrodeGroup @@ -44,13 +44,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -266,7 +248,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -282,7 +263,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -322,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -386,7 +365,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -400,7 +378,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -424,7 +401,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -438,7 +414,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -452,7 +427,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -469,20 +443,3 @@ class UnitsElectrodes(DynamicTableRegion): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ogen.py index 944f65a..45a618c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ophys.py index 3a59c4d..3557ff5 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_ophys.py @@ -27,31 +27,24 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, DynamicTableRegion +from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable + +from .core_nwb_image import ImageSeriesExternalFile, ImageSeries from .core_nwb_base import ( - NWBDataInterface, - TimeSeriesStartingTime, - TimeSeries, NWBContainer, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, TimeSeriesSync, ) -from .core_nwb_image import ImageSeries, ImageSeriesExternalFile - metamodel_version = "None" version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -71,18 +64,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -149,7 +135,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -193,7 +178,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -217,7 +201,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -229,7 +212,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -241,7 +223,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable]] | Union[BaseModel, DynamicTable] ] = Field(default_factory=dict) @@ -253,7 +234,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[NWBContainer] | NWBContainer] = Field(default_factory=dict) name: str = Field(...) @@ -263,20 +243,7 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[NWBDataInterface] | NWBDataInterface] = Field( default_factory=dict ) name: str = Field(...) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TwoPhotonSeries.model_rebuild() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -ImagingPlane.model_rebuild() -MotionCorrection.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_retinotopy.py index afade9e..c129bbe 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/namespace.py index 09a8983..1d1835c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_2/namespace.py @@ -187,13 +187,6 @@ version = "2.2.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -211,13 +204,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_base.py index 33b0e90..a7e8fe7 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_3.hdmf_common_table import Container, Data, DynamicTable +from ...hdmf_common.v1_1_3.hdmf_common_table import Data, Container, DynamicTable metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -81,7 +67,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -103,7 +88,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -112,7 +96,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -121,7 +104,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -161,7 +143,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -190,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -205,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -214,7 +193,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -227,7 +205,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -235,17 +212,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_behavior.py index b143c39..874a4f4 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_device.py index 89aaf36..fbcc70c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ecephys.py index 9fb3557..f20a6f0 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -129,7 +115,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -153,7 +138,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -201,7 +185,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -228,7 +211,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -252,7 +234,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -272,7 +253,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -284,7 +264,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -296,7 +275,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -308,7 +286,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -327,7 +304,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -339,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -359,7 +334,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -376,20 +350,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_epoch.py index 5e0d2d3..d71668b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -122,7 +108,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -136,7 +121,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -167,18 +151,9 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = 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() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_file.py index 7b791e5..6fb2b9e 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_file.py @@ -27,33 +27,33 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, -) +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, - VectorData, - VectorIndex, +from .core_nwb_ecephys import ElectrodeGroup + +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_icephys import IntracellularElectrode, SweepTable - -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, +) + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -61,13 +61,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -87,18 +80,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -110,7 +96,6 @@ class NWBFile(NWBContainer): An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -181,7 +166,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -197,7 +181,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -287,7 +270,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -298,7 +280,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -314,7 +295,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -384,7 +364,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -404,7 +383,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -413,7 +391,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -440,17 +417,3 @@ class Subject(NWBContainer): 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_icephys.py index 75275fc..9d9e235 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bias_current: float = Field( ..., description="""Bias current, in amps, fixed to 0.0.""" @@ -273,7 +255,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -321,7 +302,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -335,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -404,7 +383,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -418,7 +396,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -432,7 +409,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -446,7 +422,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -460,7 +435,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -474,7 +448,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -488,7 +461,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -502,7 +474,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -518,7 +489,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -566,7 +536,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -580,7 +549,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -612,7 +580,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -648,35 +615,9 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_image.py index be82dd2..376f7ed 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_misc.py index 890e25b..a17123b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_misc.py @@ -27,15 +27,15 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesStartingTime, TimeSeriesSync - from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTableRegion, DynamicTable, - VectorIndex, VectorData, ) +from .core_nwb_base import TimeSeriesStartingTime, TimeSeries, TimeSeriesSync + from .core_nwb_ecephys import ElectrodeGroup @@ -44,13 +44,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -266,7 +248,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -282,7 +263,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -322,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -386,7 +365,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -400,7 +378,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -424,7 +401,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -438,7 +414,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -452,7 +427,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -469,20 +443,3 @@ class UnitsElectrodes(DynamicTableRegion): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ogen.py index dfab333..e94b884 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ophys.py index 2c3884e..4f30578 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_1_3.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -154,7 +140,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -198,7 +183,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -222,7 +206,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -234,7 +217,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -246,7 +228,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -258,7 +239,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -312,7 +292,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -326,7 +305,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -349,7 +327,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -363,7 +340,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -387,7 +363,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -399,7 +374,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -414,7 +388,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -426,7 +399,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -436,22 +408,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_retinotopy.py index 12df614..b9bbc67 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/namespace.py index 2414647..0b12d93 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_4/namespace.py @@ -196,13 +196,6 @@ version = "2.2.4" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -220,13 +213,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_base.py index febf0d8..8a65d3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_1_3.hdmf_common_table import Container, Data, DynamicTable +from ...hdmf_common.v1_1_3.hdmf_common_table import Data, Container, DynamicTable metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -81,7 +67,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -103,7 +88,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -112,7 +96,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -121,7 +104,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -161,7 +143,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -190,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -205,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -214,7 +193,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -227,7 +205,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -235,17 +212,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_behavior.py index 00fc7b8..9d332a6 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_device.py index 2f1b9e4..10dcac3 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ecephys.py index 58b45e8..51ac12d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -129,7 +115,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -153,7 +138,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -201,7 +185,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -228,7 +211,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -252,7 +234,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -272,7 +253,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -284,7 +264,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -296,7 +275,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -308,7 +286,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -327,7 +304,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -339,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -359,7 +334,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -376,20 +350,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_epoch.py index ec7b0d2..555f691 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -122,7 +108,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -136,7 +121,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -167,18 +151,9 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = 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() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_file.py index 7d21b7c..7db1f78 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_file.py @@ -27,33 +27,33 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, -) +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_1_3.hdmf_common_table import ( - DynamicTable, - VectorData, - VectorIndex, +from .core_nwb_ecephys import ElectrodeGroup + +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_icephys import IntracellularElectrode, SweepTable - -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, + DynamicTable, + VectorData, +) + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -61,13 +61,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -87,18 +80,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -110,7 +96,6 @@ class NWBFile(NWBContainer): An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -181,7 +166,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -197,7 +181,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -287,7 +270,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -298,7 +280,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -314,7 +295,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -384,7 +364,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -404,7 +383,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -413,7 +391,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -440,17 +417,3 @@ class Subject(NWBContainer): 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_icephys.py index a73a5b8..ab40059 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) bias_current: float = Field( ..., description="""Bias current, in amps, fixed to 0.0.""" @@ -273,7 +255,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -321,7 +302,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -335,7 +315,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -404,7 +383,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -418,7 +396,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -432,7 +409,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -446,7 +422,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -460,7 +435,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -474,7 +448,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -488,7 +461,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -502,7 +474,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -518,7 +489,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -566,7 +536,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -580,7 +549,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -612,7 +580,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -648,35 +615,9 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_image.py index 1d2284a..afbdbe0 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_misc.py index 55edb05..31a5561 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_misc.py @@ -27,15 +27,15 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesStartingTime, TimeSeriesSync - from ...hdmf_common.v1_1_3.hdmf_common_table import ( + VectorIndex, DynamicTableRegion, DynamicTable, - VectorIndex, VectorData, ) +from .core_nwb_base import TimeSeriesStartingTime, TimeSeries, TimeSeriesSync + from .core_nwb_ecephys import ElectrodeGroup @@ -44,13 +44,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -266,7 +248,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -282,7 +263,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -322,7 +302,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -386,7 +365,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -400,7 +378,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -424,7 +401,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -438,7 +414,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -452,7 +427,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -469,20 +443,3 @@ class UnitsElectrodes(DynamicTableRegion): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ogen.py index 79263be..f661793 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ophys.py index f7efc1e..506783a 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_1_3.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -154,7 +140,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -198,7 +183,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -222,7 +206,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -234,7 +217,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -246,7 +228,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -258,7 +239,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -312,7 +292,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -326,7 +305,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -349,7 +327,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -363,7 +340,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -387,7 +363,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -399,7 +374,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -414,7 +388,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -426,7 +399,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -436,22 +408,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_retinotopy.py index 4874895..bae1146 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/namespace.py index 502d3ea..d73a305 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_2_5/namespace.py @@ -196,13 +196,6 @@ version = "2.2.5" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -220,13 +213,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_base.py index b867caf..f3c66c9 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_base.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_5_0.hdmf_common_base import Container, Data +from ...hdmf_common.v1_5_0.hdmf_common_base import Data, Container from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable @@ -37,13 +37,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -83,7 +69,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -105,7 +90,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -114,7 +98,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -123,7 +106,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -163,7 +145,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -196,7 +177,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -211,7 +191,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -220,7 +199,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -233,7 +211,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -241,17 +218,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_behavior.py index 6fb99ed..fb63332 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_device.py index 05419ba..5e6e77d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ecephys.py index 8418015..5249cf2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) filtering: Optional[str] = Field( None, @@ -133,7 +119,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -157,7 +142,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -209,7 +193,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -236,7 +219,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -260,7 +242,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -280,7 +261,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -292,7 +272,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -304,7 +283,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -316,7 +294,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -335,7 +312,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -347,7 +323,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -367,7 +342,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -384,20 +358,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_epoch.py index 108c6a0..637b6ae 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -119,7 +105,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -143,7 +128,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -174,7 +158,6 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = Field( None, @@ -191,11 +174,3 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervals.model_rebuild() -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_file.py index 040df51..15bf459 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_file.py @@ -27,29 +27,29 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, -) +from .core_nwb_icephys import SweepTable, IntracellularElectrode from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import IntracellularElectrode, SweepTable +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + NWBData, + NWBDataInterface, + TimeSeries, +) -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -57,13 +57,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -83,18 +76,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -106,7 +92,6 @@ class NWBFile(NWBContainer): An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -177,7 +162,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -193,7 +177,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -283,7 +266,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -294,7 +276,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -310,7 +291,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -378,7 +358,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -398,7 +377,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -407,7 +385,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -435,17 +412,3 @@ class Subject(NWBContainer): 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_icephys.py index ace8c1a..3f13f1a 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_icephys.py @@ -28,16 +28,16 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, + NWBContainer, TimeSeriesSync, TimeSeriesStartingTime, - NWBContainer, + TimeSeries, ) from ...hdmf_common.v1_5_0.hdmf_common_table import ( + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) @@ -46,13 +46,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -72,18 +65,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -131,7 +117,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -145,7 +130,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -202,7 +186,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -216,7 +199,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, @@ -274,7 +256,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -322,7 +303,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -336,7 +316,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -405,7 +384,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -419,7 +397,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -433,7 +410,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -447,7 +423,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -461,7 +436,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -475,7 +449,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -489,7 +462,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -503,7 +475,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -519,7 +490,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -567,7 +537,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -581,7 +550,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -613,7 +581,6 @@ class SweepTable(DynamicTable): The table which groups different PatchClampSeries together. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -646,7 +613,6 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = Field( None, @@ -663,28 +629,3 @@ class SweepTableSeriesIndex(VectorIndex): 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() -PatchClampSeriesData.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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_image.py index 425dc85..c69f8f7 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -191,7 +174,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -205,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Optional[ Union[ @@ -258,7 +239,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -327,7 +307,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -359,15 +338,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_misc.py index 03aaa01..f7352a1 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_misc.py @@ -27,16 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesSync, TimeSeriesStartingTime +from .core_nwb_ecephys import ElectrodeGroup from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_base import TimeSeriesSync, TimeSeriesStartingTime, TimeSeries metamodel_version = "None" @@ -44,13 +44,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -270,7 +252,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -286,7 +267,6 @@ class DecompositionSeriesSourceChannels(DynamicTableRegion): DynamicTableRegion pointer to the channels that this decomposition series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_channels"] = Field("source_channels") table: Optional[str] = Field( None, @@ -310,7 +290,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -347,7 +326,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -422,7 +400,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -446,7 +423,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -470,7 +446,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -494,7 +469,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -518,7 +492,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -542,7 +515,6 @@ class UnitsWaveformsIndex(VectorIndex): Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index"] = Field("waveforms_index") target: Optional[str] = Field( None, @@ -566,7 +538,6 @@ class UnitsWaveformsIndexIndex(VectorIndex): Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index_index"] = Field("waveforms_index_index") target: Optional[str] = Field( None, @@ -583,23 +554,3 @@ class UnitsWaveformsIndexIndex(VectorIndex): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ogen.py index 9ade7da..4f59909 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ophys.py index c9f7f99..f6d72d6 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -154,7 +140,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -198,7 +183,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -222,7 +206,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -234,7 +217,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -246,7 +228,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -258,7 +239,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -309,7 +289,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -333,7 +312,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -356,7 +334,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -380,7 +357,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -404,7 +380,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -416,7 +391,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -431,7 +405,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -443,7 +416,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -453,22 +425,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_retinotopy.py index 53ba1cb..76f7a88 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/namespace.py index f452b2a..6aba439 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_3_0/namespace.py @@ -205,13 +205,6 @@ version = "2.3.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -229,13 +222,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_base.py index 30a9e20..cca02e2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_base.py @@ -27,9 +27,9 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from ...hdmf_common.v1_5_0.hdmf_common_base import Data, Container -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" @@ -37,13 +37,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -83,7 +69,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("timeseries") idx_start: int = Field( ..., @@ -114,7 +99,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -136,7 +120,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -145,7 +128,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -154,7 +136,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -194,7 +175,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -227,7 +207,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -242,7 +221,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -251,7 +229,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -264,7 +241,6 @@ class Images(NWBDataInterface): A collection of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -272,18 +248,3 @@ class Images(NWBDataInterface): image: List[str] | str = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_behavior.py index e0b6810..722f04b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -142,7 +127,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -154,7 +138,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -164,7 +147,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -174,7 +156,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -184,7 +165,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -196,7 +176,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -208,21 +187,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_device.py index 47ce3cd..c7ffa5c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ecephys.py index 2889380..9b9150f 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) filtering: Optional[str] = Field( None, @@ -133,7 +119,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -157,7 +142,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -209,7 +193,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -236,7 +219,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -260,7 +242,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -280,7 +261,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -292,7 +272,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -304,7 +283,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -316,7 +294,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -335,7 +312,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -347,7 +323,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -367,7 +342,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -384,20 +358,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_epoch.py index 6c92859..e763d71 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries - from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeries + metamodel_version = "None" version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -119,7 +105,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -143,7 +128,6 @@ class TimeIntervalsTimeseries(VectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: Optional[int] = Field( None, @@ -174,7 +158,6 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = Field( None, @@ -191,11 +174,3 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervals.model_rebuild() -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_file.py index f89f7ab..8f55173 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_file.py @@ -27,37 +27,37 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, +from .core_nwb_icephys import ( + SweepTable, + SimultaneousRecordingsTable, + SequentialRecordingsTable, + RepetitionsTable, + ExperimentalConditionsTable, + IntracellularElectrode, + IntracellularRecordingsTable, ) from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import ( - RepetitionsTable, - IntracellularElectrode, - SequentialRecordingsTable, - IntracellularRecordingsTable, - SweepTable, - ExperimentalConditionsTable, - SimultaneousRecordingsTable, +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -65,13 +65,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -91,18 +84,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -114,7 +100,6 @@ class NWBFile(NWBContainer): An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -185,7 +170,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -201,7 +185,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -291,7 +274,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -302,7 +284,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -318,7 +299,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -386,7 +366,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -426,7 +405,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -435,7 +413,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -463,17 +440,3 @@ class Subject(NWBContainer): 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_icephys.py index a8b83e6..0e27d8b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_icephys.py @@ -27,20 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - TimeSeriesStartingTime, - NWBContainer, - TimeSeriesReferenceVectorData, +from ...hdmf_common.v1_5_0.hdmf_common_table import ( + AlignedDynamicTable, + DynamicTableRegion, + VectorIndex, + DynamicTable, + VectorData, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTableRegion, - DynamicTable, - AlignedDynamicTable, - VectorData, - VectorIndex, +from .core_nwb_base import ( + NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + TimeSeriesReferenceVectorData, + TimeSeries, ) @@ -49,13 +49,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,18 +68,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -134,7 +120,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -148,7 +133,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -205,7 +189,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -219,7 +202,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, @@ -277,7 +259,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -325,7 +306,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -339,7 +319,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -408,7 +387,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -422,7 +400,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -436,7 +413,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -450,7 +426,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -464,7 +439,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -478,7 +452,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -492,7 +465,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -506,7 +478,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -522,7 +493,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -570,7 +540,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -584,7 +553,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., @@ -616,7 +584,6 @@ class SweepTable(DynamicTable): [DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -649,7 +616,6 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = Field( None, @@ -673,7 +639,6 @@ class IntracellularElectrodesTable(DynamicTable): Table for storing intracellular electrode related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -701,7 +666,6 @@ class IntracellularStimuliTable(DynamicTable): Table for storing intracellular stimulus related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -729,7 +693,6 @@ class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): Column storing the reference to the recorded stimulus for the recording (rows). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") idx_start: int = Field( ..., @@ -760,7 +723,6 @@ class IntracellularResponsesTable(DynamicTable): Table for storing intracellular response related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -788,7 +750,6 @@ class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): Column storing the reference to the recorded response for the recording (rows) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["response"] = Field("response") idx_start: int = Field( ..., @@ -819,7 +780,6 @@ class IntracellularRecordingsTable(AlignedDynamicTable): A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["intracellular_recordings"] = Field("intracellular_recordings") description: Optional[str] = Field( None, @@ -859,7 +819,6 @@ class SimultaneousRecordingsTable(DynamicTable): A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") recordings: str = Field( ..., @@ -890,7 +849,6 @@ class SimultaneousRecordingsTableRecordings(DynamicTableRegion): A reference to one or more rows in the IntracellularRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings"] = Field("recordings") table: Optional[str] = Field( None, @@ -914,7 +872,6 @@ class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): Index dataset for the recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings_index"] = Field("recordings_index") target: Optional[str] = Field( None, @@ -938,7 +895,6 @@ class SequentialRecordingsTable(DynamicTable): A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") simultaneous_recordings: str = Field( ..., @@ -973,7 +929,6 @@ class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): A reference to one or more rows in the SimultaneousRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") table: Optional[str] = Field( None, @@ -997,7 +952,6 @@ class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): Index dataset for the simultaneous_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings_index"] = Field( "simultaneous_recordings_index" ) @@ -1023,7 +977,6 @@ class RepetitionsTable(DynamicTable): A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["repetitions"] = Field("repetitions") sequential_recordings: str = Field( ..., @@ -1054,7 +1007,6 @@ class RepetitionsTableSequentialRecordings(DynamicTableRegion): A reference to one or more rows in the SequentialRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") table: Optional[str] = Field( None, @@ -1078,7 +1030,6 @@ class RepetitionsTableSequentialRecordingsIndex(VectorIndex): Index dataset for the sequential_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings_index"] = Field("sequential_recordings_index") target: Optional[str] = Field( None, @@ -1102,7 +1053,6 @@ class ExperimentalConditionsTable(DynamicTable): A table for grouping different intracellular recording repetitions together that belong to the same experimental condition. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["experimental_conditions"] = Field("experimental_conditions") repetitions: str = Field( ..., @@ -1133,7 +1083,6 @@ class ExperimentalConditionsTableRepetitions(DynamicTableRegion): A reference to one or more rows in the RepetitionsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions"] = Field("repetitions") table: Optional[str] = Field( None, @@ -1157,7 +1106,6 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): Index dataset for the repetitions column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions_index"] = Field("repetitions_index") target: Optional[str] = Field( None, @@ -1174,46 +1122,3 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): 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() -PatchClampSeriesData.model_rebuild() -CurrentClampSeries.model_rebuild() -CurrentClampSeriesData.model_rebuild() -IZeroClampSeries.model_rebuild() -CurrentClampStimulusSeries.model_rebuild() -CurrentClampStimulusSeriesData.model_rebuild() -VoltageClampSeries.model_rebuild() -VoltageClampSeriesData.model_rebuild() -VoltageClampSeriesCapacitanceFast.model_rebuild() -VoltageClampSeriesCapacitanceSlow.model_rebuild() -VoltageClampSeriesResistanceCompBandwidth.model_rebuild() -VoltageClampSeriesResistanceCompCorrection.model_rebuild() -VoltageClampSeriesResistanceCompPrediction.model_rebuild() -VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() -VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() -VoltageClampStimulusSeries.model_rebuild() -VoltageClampStimulusSeriesData.model_rebuild() -IntracellularElectrode.model_rebuild() -SweepTable.model_rebuild() -SweepTableSeriesIndex.model_rebuild() -IntracellularElectrodesTable.model_rebuild() -IntracellularStimuliTable.model_rebuild() -IntracellularStimuliTableStimulus.model_rebuild() -IntracellularResponsesTable.model_rebuild() -IntracellularResponsesTableResponse.model_rebuild() -IntracellularRecordingsTable.model_rebuild() -SimultaneousRecordingsTable.model_rebuild() -SimultaneousRecordingsTableRecordings.model_rebuild() -SimultaneousRecordingsTableRecordingsIndex.model_rebuild() -SequentialRecordingsTable.model_rebuild() -SequentialRecordingsTableSimultaneousRecordings.model_rebuild() -SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() -RepetitionsTable.model_rebuild() -RepetitionsTableSequentialRecordings.model_rebuild() -RepetitionsTableSequentialRecordingsIndex.model_rebuild() -ExperimentalConditionsTable.model_rebuild() -ExperimentalConditionsTableRepetitions.model_rebuild() -ExperimentalConditionsTableRepetitionsIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_image.py index b9f3bd2..212a548 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -192,7 +175,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -206,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -260,7 +241,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -329,7 +309,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Index of the frame in the referenced ImageSeries.""" @@ -361,15 +340,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_misc.py index ea7c764..8a70e84 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_misc.py @@ -27,16 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesSync, TimeSeriesStartingTime +from .core_nwb_ecephys import ElectrodeGroup from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_base import TimeSeriesSync, TimeSeriesStartingTime, TimeSeries metamodel_version = "None" @@ -44,13 +44,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -270,7 +252,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -286,7 +267,6 @@ class DecompositionSeriesSourceChannels(DynamicTableRegion): DynamicTableRegion pointer to the channels that this decomposition series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_channels"] = Field("source_channels") table: Optional[str] = Field( None, @@ -310,7 +290,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -347,7 +326,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -422,7 +400,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -446,7 +423,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -470,7 +446,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -494,7 +469,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -518,7 +492,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -542,7 +515,6 @@ class UnitsWaveformsIndex(VectorIndex): Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index"] = Field("waveforms_index") target: Optional[str] = Field( None, @@ -566,7 +538,6 @@ class UnitsWaveformsIndexIndex(VectorIndex): Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index_index"] = Field("waveforms_index_index") target: Optional[str] = Field( None, @@ -583,23 +554,3 @@ class UnitsWaveformsIndexIndex(VectorIndex): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ogen.py index 79baa5f..70fde28 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ophys.py index 5991925..705cc69 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -155,7 +141,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -199,7 +184,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -223,7 +207,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -235,7 +218,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -247,7 +229,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -259,7 +240,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -310,7 +290,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -334,7 +313,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -357,7 +335,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -381,7 +358,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -405,7 +381,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -417,7 +392,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -432,7 +406,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -444,7 +417,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -454,22 +426,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_retinotopy.py index f5bd3e2..73367f8 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/namespace.py index 39774c7..8757124 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_4_0/namespace.py @@ -224,13 +224,6 @@ version = "2.4.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -248,13 +241,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_base.py index d6a19f3..971c33f 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_base.py @@ -27,9 +27,9 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from ...hdmf_common.v1_5_0.hdmf_common_base import Data, Container -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" @@ -37,13 +37,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -83,7 +69,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("timeseries") idx_start: int = Field( ..., @@ -114,7 +99,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -136,7 +120,6 @@ class ImageReferences(NWBData): Ordered dataset of references to Image objects. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image: List[str] | str = Field( default_factory=list, @@ -149,7 +132,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -158,7 +140,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -167,7 +148,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -207,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -244,7 +223,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -259,7 +237,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -268,7 +245,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -281,7 +257,6 @@ class Images(NWBDataInterface): A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -300,26 +275,8 @@ class ImagesOrderOfImages(ImageReferences): Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["order_of_images"] = Field("order_of_images") image: List[str] | str = Field( default_factory=list, description="""Ordered dataset of references to Image objects.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -NWBData.model_rebuild() -TimeSeriesReferenceVectorData.model_rebuild() -Image.model_rebuild() -ImageReferences.model_rebuild() -NWBContainer.model_rebuild() -NWBDataInterface.model_rebuild() -TimeSeries.model_rebuild() -TimeSeriesData.model_rebuild() -TimeSeriesStartingTime.model_rebuild() -TimeSeriesSync.model_rebuild() -ProcessingModule.model_rebuild() -Images.model_rebuild() -ImagesOrderOfImages.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_behavior.py index 4dec916..b137179 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -156,7 +140,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -166,7 +149,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -176,7 +158,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -186,7 +167,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -198,7 +178,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -210,21 +189,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_device.py index b4f2964..8c0a924 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ecephys.py index b3e6bef..883d1e7 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) filtering: Optional[str] = Field( None, @@ -133,7 +119,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -157,7 +142,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -209,7 +193,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -236,7 +219,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -260,7 +242,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -280,7 +261,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -292,7 +272,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -304,7 +283,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -316,7 +294,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -335,7 +312,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -347,7 +323,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -367,7 +342,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -384,20 +358,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_epoch.py index 5c8cf58..c048959 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesReferenceVectorData - from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeriesReferenceVectorData, TimeSeries + metamodel_version = "None" version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -119,7 +105,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -143,7 +128,6 @@ class TimeIntervalsTimeseries(TimeSeriesReferenceVectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: int = Field( ..., @@ -174,7 +158,6 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = Field( None, @@ -191,11 +174,3 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervals.model_rebuild() -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_file.py index 5d13e87..ca8be6e 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_file.py @@ -27,38 +27,38 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, - Images, +from .core_nwb_icephys import ( + SweepTable, + SimultaneousRecordingsTable, + SequentialRecordingsTable, + RepetitionsTable, + ExperimentalConditionsTable, + IntracellularElectrode, + IntracellularRecordingsTable, ) from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import ( - RepetitionsTable, - IntracellularElectrode, - SequentialRecordingsTable, - IntracellularRecordingsTable, - SweepTable, - ExperimentalConditionsTable, - SimultaneousRecordingsTable, +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + Images, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -66,13 +66,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -92,18 +85,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -115,7 +101,6 @@ class NWBFile(NWBContainer): An NWB:N file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -186,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -204,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -294,7 +277,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -305,7 +287,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -321,7 +302,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -389,7 +369,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -429,7 +408,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -438,7 +416,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -466,17 +443,3 @@ class Subject(NWBContainer): 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_icephys.py index a49ba27..34c4793 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_icephys.py @@ -27,20 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - TimeSeriesStartingTime, - NWBContainer, - TimeSeriesReferenceVectorData, +from ...hdmf_common.v1_5_0.hdmf_common_table import ( + AlignedDynamicTable, + DynamicTableRegion, + VectorIndex, + DynamicTable, + VectorData, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTableRegion, - DynamicTable, - AlignedDynamicTable, - VectorData, - VectorIndex, +from .core_nwb_base import ( + NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + TimeSeriesReferenceVectorData, + TimeSeries, ) @@ -49,13 +49,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,18 +68,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -134,7 +120,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -148,7 +133,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -205,7 +189,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -219,7 +202,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, @@ -277,7 +259,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -325,7 +306,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -339,7 +319,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -408,7 +387,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -422,7 +400,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -436,7 +413,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -450,7 +426,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -464,7 +439,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -478,7 +452,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -492,7 +465,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -506,7 +478,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -522,7 +493,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -570,7 +540,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -584,7 +553,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) cell_id: Optional[str] = Field(None, description="""unique ID of the cell""") description: str = Field( @@ -617,7 +585,6 @@ class SweepTable(DynamicTable): [DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -650,7 +617,6 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = Field( None, @@ -674,7 +640,6 @@ class IntracellularElectrodesTable(DynamicTable): Table for storing intracellular electrode related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -702,7 +667,6 @@ class IntracellularStimuliTable(DynamicTable): Table for storing intracellular stimulus related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -730,7 +694,6 @@ class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): Column storing the reference to the recorded stimulus for the recording (rows). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") idx_start: int = Field( ..., @@ -761,7 +724,6 @@ class IntracellularResponsesTable(DynamicTable): Table for storing intracellular response related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -789,7 +751,6 @@ class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): Column storing the reference to the recorded response for the recording (rows) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["response"] = Field("response") idx_start: int = Field( ..., @@ -820,7 +781,6 @@ class IntracellularRecordingsTable(AlignedDynamicTable): A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["intracellular_recordings"] = Field("intracellular_recordings") description: Optional[str] = Field( None, @@ -860,7 +820,6 @@ class SimultaneousRecordingsTable(DynamicTable): A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") recordings: str = Field( ..., @@ -891,7 +850,6 @@ class SimultaneousRecordingsTableRecordings(DynamicTableRegion): A reference to one or more rows in the IntracellularRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings"] = Field("recordings") table: Optional[str] = Field( None, @@ -915,7 +873,6 @@ class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): Index dataset for the recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings_index"] = Field("recordings_index") target: Optional[str] = Field( None, @@ -939,7 +896,6 @@ class SequentialRecordingsTable(DynamicTable): A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") simultaneous_recordings: str = Field( ..., @@ -974,7 +930,6 @@ class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): A reference to one or more rows in the SimultaneousRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") table: Optional[str] = Field( None, @@ -998,7 +953,6 @@ class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): Index dataset for the simultaneous_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings_index"] = Field( "simultaneous_recordings_index" ) @@ -1024,7 +978,6 @@ class RepetitionsTable(DynamicTable): A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["repetitions"] = Field("repetitions") sequential_recordings: str = Field( ..., @@ -1055,7 +1008,6 @@ class RepetitionsTableSequentialRecordings(DynamicTableRegion): A reference to one or more rows in the SequentialRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") table: Optional[str] = Field( None, @@ -1079,7 +1031,6 @@ class RepetitionsTableSequentialRecordingsIndex(VectorIndex): Index dataset for the sequential_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings_index"] = Field("sequential_recordings_index") target: Optional[str] = Field( None, @@ -1103,7 +1054,6 @@ class ExperimentalConditionsTable(DynamicTable): A table for grouping different intracellular recording repetitions together that belong to the same experimental condition. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["experimental_conditions"] = Field("experimental_conditions") repetitions: str = Field( ..., @@ -1134,7 +1084,6 @@ class ExperimentalConditionsTableRepetitions(DynamicTableRegion): A reference to one or more rows in the RepetitionsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions"] = Field("repetitions") table: Optional[str] = Field( None, @@ -1158,7 +1107,6 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): Index dataset for the repetitions column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions_index"] = Field("repetitions_index") target: Optional[str] = Field( None, @@ -1175,46 +1123,3 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): 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() -PatchClampSeriesData.model_rebuild() -CurrentClampSeries.model_rebuild() -CurrentClampSeriesData.model_rebuild() -IZeroClampSeries.model_rebuild() -CurrentClampStimulusSeries.model_rebuild() -CurrentClampStimulusSeriesData.model_rebuild() -VoltageClampSeries.model_rebuild() -VoltageClampSeriesData.model_rebuild() -VoltageClampSeriesCapacitanceFast.model_rebuild() -VoltageClampSeriesCapacitanceSlow.model_rebuild() -VoltageClampSeriesResistanceCompBandwidth.model_rebuild() -VoltageClampSeriesResistanceCompCorrection.model_rebuild() -VoltageClampSeriesResistanceCompPrediction.model_rebuild() -VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() -VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() -VoltageClampStimulusSeries.model_rebuild() -VoltageClampStimulusSeriesData.model_rebuild() -IntracellularElectrode.model_rebuild() -SweepTable.model_rebuild() -SweepTableSeriesIndex.model_rebuild() -IntracellularElectrodesTable.model_rebuild() -IntracellularStimuliTable.model_rebuild() -IntracellularStimuliTableStimulus.model_rebuild() -IntracellularResponsesTable.model_rebuild() -IntracellularResponsesTableResponse.model_rebuild() -IntracellularRecordingsTable.model_rebuild() -SimultaneousRecordingsTable.model_rebuild() -SimultaneousRecordingsTableRecordings.model_rebuild() -SimultaneousRecordingsTableRecordingsIndex.model_rebuild() -SequentialRecordingsTable.model_rebuild() -SequentialRecordingsTableSimultaneousRecordings.model_rebuild() -SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() -RepetitionsTable.model_rebuild() -RepetitionsTableSequentialRecordings.model_rebuild() -RepetitionsTableSequentialRecordingsIndex.model_rebuild() -ExperimentalConditionsTable.model_rebuild() -ExperimentalConditionsTableRepetitions.model_rebuild() -ExperimentalConditionsTableRepetitionsIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_image.py index c9a9372..2e3218f 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -192,7 +175,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -206,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -260,7 +241,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -329,7 +309,6 @@ class IndexSeries(TimeSeries): Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., @@ -362,15 +341,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_misc.py index 04b3e4d..3e052c2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_misc.py @@ -27,16 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesSync, TimeSeriesStartingTime +from .core_nwb_ecephys import ElectrodeGroup from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_base import TimeSeriesSync, TimeSeriesStartingTime, TimeSeries metamodel_version = "None" @@ -44,13 +44,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -270,7 +252,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -286,7 +267,6 @@ class DecompositionSeriesSourceChannels(DynamicTableRegion): DynamicTableRegion pointer to the channels that this decomposition series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_channels"] = Field("source_channels") table: Optional[str] = Field( None, @@ -310,7 +290,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -347,7 +326,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -422,7 +400,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -446,7 +423,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -470,7 +446,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -494,7 +469,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -518,7 +492,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -542,7 +515,6 @@ class UnitsWaveformsIndex(VectorIndex): Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index"] = Field("waveforms_index") target: Optional[str] = Field( None, @@ -566,7 +538,6 @@ class UnitsWaveformsIndexIndex(VectorIndex): Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index_index"] = Field("waveforms_index_index") target: Optional[str] = Field( None, @@ -583,23 +554,3 @@ class UnitsWaveformsIndexIndex(VectorIndex): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ogen.py index 8f765c9..3b7d8f7 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ophys.py index ec962e1..7e721ae 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TwoPhotonSeries(ImageSeries): """ Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -155,7 +141,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -199,7 +184,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -223,7 +207,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -235,7 +218,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -247,7 +229,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -259,7 +240,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -310,7 +290,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -334,7 +313,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -357,7 +335,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -381,7 +358,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -405,7 +381,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -417,7 +392,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -432,7 +406,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -444,7 +417,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -454,22 +426,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_retinotopy.py index 1205fab..efacbbf 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/namespace.py index 23ef74f..d24d393 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_5_0/namespace.py @@ -226,13 +226,6 @@ version = "2.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -250,13 +243,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_base.py index edb59f7..0da448e 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_base.py @@ -27,9 +27,9 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from ...hdmf_common.v1_5_0.hdmf_common_base import Data, Container -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" @@ -37,13 +37,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -83,7 +69,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("timeseries") idx_start: int = Field( ..., @@ -114,7 +99,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -136,7 +120,6 @@ class ImageReferences(NWBData): Ordered dataset of references to Image objects. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image: List[str] | str = Field( default_factory=list, @@ -149,7 +132,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -158,7 +140,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -167,7 +148,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -207,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -244,7 +223,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -259,7 +237,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -268,7 +245,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -281,7 +257,6 @@ class Images(NWBDataInterface): A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -300,26 +275,8 @@ class ImagesOrderOfImages(ImageReferences): Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["order_of_images"] = Field("order_of_images") image: List[str] | str = Field( default_factory=list, description="""Ordered dataset of references to Image objects.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -NWBData.model_rebuild() -TimeSeriesReferenceVectorData.model_rebuild() -Image.model_rebuild() -ImageReferences.model_rebuild() -NWBContainer.model_rebuild() -NWBDataInterface.model_rebuild() -TimeSeries.model_rebuild() -TimeSeriesData.model_rebuild() -TimeSeriesStartingTime.model_rebuild() -TimeSeriesSync.model_rebuild() -ProcessingModule.model_rebuild() -Images.model_rebuild() -ImagesOrderOfImages.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_behavior.py index 97b63a5..a048faa 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -156,7 +140,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -166,7 +149,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -176,7 +158,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -186,7 +167,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -198,7 +178,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -210,21 +189,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_device.py index 27829dd..d05ff89 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ecephys.py index e1017cf..6015ccb 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) filtering: Optional[str] = Field( None, @@ -133,7 +119,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -157,7 +142,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -209,7 +193,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -236,7 +219,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -260,7 +242,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -280,7 +261,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -292,7 +272,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -304,7 +283,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -316,7 +294,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -335,7 +312,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -347,7 +323,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -367,7 +342,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -384,20 +358,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_epoch.py index ea7648b..4f0d9ac 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesReferenceVectorData - from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeriesReferenceVectorData, TimeSeries + metamodel_version = "None" version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -119,7 +105,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -143,7 +128,6 @@ class TimeIntervalsTimeseries(TimeSeriesReferenceVectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: int = Field( ..., @@ -174,7 +158,6 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = Field( None, @@ -191,11 +174,3 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervals.model_rebuild() -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_file.py index 34d7161..ddd319c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_file.py @@ -27,38 +27,38 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, - Images, +from .core_nwb_icephys import ( + SweepTable, + SimultaneousRecordingsTable, + SequentialRecordingsTable, + RepetitionsTable, + ExperimentalConditionsTable, + IntracellularElectrode, + IntracellularRecordingsTable, ) from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import ( - RepetitionsTable, - IntracellularElectrode, - SequentialRecordingsTable, - IntracellularRecordingsTable, - SweepTable, - ExperimentalConditionsTable, - SimultaneousRecordingsTable, +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + Images, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -66,13 +66,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -92,18 +85,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -115,7 +101,6 @@ class NWBFile(NWBContainer): An NWB file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -186,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[List[TimeSeries] | TimeSeries] = Field( default_factory=dict, description="""Stimuli presented during the experiment.""" @@ -204,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -294,7 +277,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -305,7 +287,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -321,7 +302,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -389,7 +369,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -429,7 +408,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -438,7 +416,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -473,25 +450,9 @@ class SubjectAge(ConfiguredBaseModel): Age of subject. Can be supplied instead of 'date_of_birth'. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["age"] = Field("age") reference: Optional[str] = Field( None, description="""Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.""", ) value: str = Field(...) - - -# 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() -SubjectAge.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_icephys.py index d7b37cd..d2a2935 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_icephys.py @@ -27,20 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - TimeSeriesStartingTime, - NWBContainer, - TimeSeriesReferenceVectorData, +from ...hdmf_common.v1_5_0.hdmf_common_table import ( + AlignedDynamicTable, + DynamicTableRegion, + VectorIndex, + DynamicTable, + VectorData, ) -from ...hdmf_common.v1_5_0.hdmf_common_table import ( - DynamicTableRegion, - DynamicTable, - AlignedDynamicTable, - VectorData, - VectorIndex, +from .core_nwb_base import ( + NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + TimeSeriesReferenceVectorData, + TimeSeries, ) @@ -49,13 +49,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,18 +68,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -134,7 +120,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -148,7 +133,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -205,7 +189,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -219,7 +202,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, @@ -277,7 +259,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -325,7 +306,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -339,7 +319,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -408,7 +387,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -422,7 +400,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -436,7 +413,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -450,7 +426,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -464,7 +439,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -478,7 +452,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -492,7 +465,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -506,7 +478,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -522,7 +493,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -570,7 +540,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -584,7 +553,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) cell_id: Optional[str] = Field(None, description="""unique ID of the cell""") description: str = Field( @@ -617,7 +585,6 @@ class SweepTable(DynamicTable): [DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -650,7 +617,6 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = Field( None, @@ -674,7 +640,6 @@ class IntracellularElectrodesTable(DynamicTable): Table for storing intracellular electrode related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -702,7 +667,6 @@ class IntracellularStimuliTable(DynamicTable): Table for storing intracellular stimulus related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -730,7 +694,6 @@ class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): Column storing the reference to the recorded stimulus for the recording (rows). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") idx_start: int = Field( ..., @@ -761,7 +724,6 @@ class IntracellularResponsesTable(DynamicTable): Table for storing intracellular response related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -789,7 +751,6 @@ class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): Column storing the reference to the recorded response for the recording (rows) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["response"] = Field("response") idx_start: int = Field( ..., @@ -820,7 +781,6 @@ class IntracellularRecordingsTable(AlignedDynamicTable): A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["intracellular_recordings"] = Field("intracellular_recordings") description: Optional[str] = Field( None, @@ -860,7 +820,6 @@ class SimultaneousRecordingsTable(DynamicTable): A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") recordings: str = Field( ..., @@ -891,7 +850,6 @@ class SimultaneousRecordingsTableRecordings(DynamicTableRegion): A reference to one or more rows in the IntracellularRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings"] = Field("recordings") table: Optional[str] = Field( None, @@ -915,7 +873,6 @@ class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): Index dataset for the recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings_index"] = Field("recordings_index") target: Optional[str] = Field( None, @@ -939,7 +896,6 @@ class SequentialRecordingsTable(DynamicTable): A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") simultaneous_recordings: str = Field( ..., @@ -974,7 +930,6 @@ class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): A reference to one or more rows in the SimultaneousRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") table: Optional[str] = Field( None, @@ -998,7 +953,6 @@ class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): Index dataset for the simultaneous_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings_index"] = Field( "simultaneous_recordings_index" ) @@ -1024,7 +978,6 @@ class RepetitionsTable(DynamicTable): A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["repetitions"] = Field("repetitions") sequential_recordings: str = Field( ..., @@ -1055,7 +1008,6 @@ class RepetitionsTableSequentialRecordings(DynamicTableRegion): A reference to one or more rows in the SequentialRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") table: Optional[str] = Field( None, @@ -1079,7 +1031,6 @@ class RepetitionsTableSequentialRecordingsIndex(VectorIndex): Index dataset for the sequential_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings_index"] = Field("sequential_recordings_index") target: Optional[str] = Field( None, @@ -1103,7 +1054,6 @@ class ExperimentalConditionsTable(DynamicTable): A table for grouping different intracellular recording repetitions together that belong to the same experimental condition. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["experimental_conditions"] = Field("experimental_conditions") repetitions: str = Field( ..., @@ -1134,7 +1084,6 @@ class ExperimentalConditionsTableRepetitions(DynamicTableRegion): A reference to one or more rows in the RepetitionsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions"] = Field("repetitions") table: Optional[str] = Field( None, @@ -1158,7 +1107,6 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): Index dataset for the repetitions column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions_index"] = Field("repetitions_index") target: Optional[str] = Field( None, @@ -1175,46 +1123,3 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): 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() -PatchClampSeriesData.model_rebuild() -CurrentClampSeries.model_rebuild() -CurrentClampSeriesData.model_rebuild() -IZeroClampSeries.model_rebuild() -CurrentClampStimulusSeries.model_rebuild() -CurrentClampStimulusSeriesData.model_rebuild() -VoltageClampSeries.model_rebuild() -VoltageClampSeriesData.model_rebuild() -VoltageClampSeriesCapacitanceFast.model_rebuild() -VoltageClampSeriesCapacitanceSlow.model_rebuild() -VoltageClampSeriesResistanceCompBandwidth.model_rebuild() -VoltageClampSeriesResistanceCompCorrection.model_rebuild() -VoltageClampSeriesResistanceCompPrediction.model_rebuild() -VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() -VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() -VoltageClampStimulusSeries.model_rebuild() -VoltageClampStimulusSeriesData.model_rebuild() -IntracellularElectrode.model_rebuild() -SweepTable.model_rebuild() -SweepTableSeriesIndex.model_rebuild() -IntracellularElectrodesTable.model_rebuild() -IntracellularStimuliTable.model_rebuild() -IntracellularStimuliTableStimulus.model_rebuild() -IntracellularResponsesTable.model_rebuild() -IntracellularResponsesTableResponse.model_rebuild() -IntracellularRecordingsTable.model_rebuild() -SimultaneousRecordingsTable.model_rebuild() -SimultaneousRecordingsTableRecordings.model_rebuild() -SimultaneousRecordingsTableRecordingsIndex.model_rebuild() -SequentialRecordingsTable.model_rebuild() -SequentialRecordingsTableSimultaneousRecordings.model_rebuild() -SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() -RepetitionsTable.model_rebuild() -RepetitionsTableSequentialRecordings.model_rebuild() -RepetitionsTableSequentialRecordingsIndex.model_rebuild() -ExperimentalConditionsTable.model_rebuild() -ExperimentalConditionsTableRepetitions.model_rebuild() -ExperimentalConditionsTableRepetitionsIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_image.py index 8226cde..de94c2d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -192,7 +175,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -206,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -260,7 +241,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -329,7 +309,6 @@ class IndexSeries(TimeSeries): Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., @@ -362,15 +341,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_misc.py index 4b7715c..b258ed4 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_misc.py @@ -27,16 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesSync, TimeSeriesStartingTime +from .core_nwb_ecephys import ElectrodeGroup from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_base import TimeSeriesSync, TimeSeriesStartingTime, TimeSeries metamodel_version = "None" @@ -44,13 +44,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -270,7 +252,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -286,7 +267,6 @@ class DecompositionSeriesSourceChannels(DynamicTableRegion): DynamicTableRegion pointer to the channels that this decomposition series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_channels"] = Field("source_channels") table: Optional[str] = Field( None, @@ -310,7 +290,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -347,7 +326,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -422,7 +400,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -446,7 +423,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit in seconds. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -470,7 +446,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -494,7 +469,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -518,7 +492,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -542,7 +515,6 @@ class UnitsWaveformsIndex(VectorIndex): Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index"] = Field("waveforms_index") target: Optional[str] = Field( None, @@ -566,7 +538,6 @@ class UnitsWaveformsIndexIndex(VectorIndex): Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index_index"] = Field("waveforms_index_index") target: Optional[str] = Field( None, @@ -583,23 +554,3 @@ class UnitsWaveformsIndexIndex(VectorIndex): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ogen.py index 5e08ac2..b206017 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], float] = Field( ..., description="""Applied power for optogenetic stimulus, in watts.""" @@ -116,7 +102,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -126,9 +111,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ophys.py index 13e447a..528760d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_5_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OnePhotonSeries(ImageSeries): """ Image stack recorded over time from 1-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -160,7 +146,6 @@ class TwoPhotonSeries(ImageSeries): Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -228,7 +213,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -272,7 +256,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -296,7 +279,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -308,7 +290,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -320,7 +301,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -332,7 +312,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -383,7 +362,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -407,7 +385,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -430,7 +407,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -454,7 +430,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -478,7 +453,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -490,7 +464,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -505,7 +478,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -517,7 +489,6 @@ class CorrectedImageStack(NWBDataInterface): Reuslts from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -527,23 +498,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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 -OnePhotonSeries.model_rebuild() -TwoPhotonSeries.model_rebuild() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_retinotopy.py index c6e4c54..b783b75 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/namespace.py index bd30a3a..a818074 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_6_0_alpha/namespace.py @@ -228,13 +228,6 @@ version = "2.6.0-alpha" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -252,13 +245,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_base.py index 0cb791e..38eddb4 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_base.py @@ -27,9 +27,9 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTable, VectorData +from ...hdmf_common.v1_8_0.hdmf_common_base import Data, Container -from ...hdmf_common.v1_8_0.hdmf_common_base import Container, Data +from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTable, VectorData metamodel_version = "None" @@ -37,13 +37,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -63,18 +56,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class NWBData(Data): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -83,7 +69,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("timeseries") idx_start: int = Field( ..., @@ -114,7 +99,6 @@ 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)). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -136,7 +120,6 @@ class ImageReferences(NWBData): Ordered dataset of references to Image objects. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image: List[str] | str = Field( default_factory=list, @@ -149,7 +132,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -158,7 +140,6 @@ class NWBDataInterface(NWBContainer): An abstract data type for a generic container storing collections of data, as opposed to metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -167,7 +148,6 @@ class TimeSeries(NWBDataInterface): General purpose time series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of the time series.""" @@ -207,7 +187,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") conversion: Optional[float] = Field( None, @@ -244,7 +223,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["starting_time"] = Field("starting_time") rate: Optional[float] = Field(None, description="""Sampling rate, in Hz.""") unit: Optional[str] = Field( @@ -259,7 +237,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sync"] = Field("sync") @@ -268,7 +245,6 @@ class ProcessingModule(NWBContainer): A collection of processed data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface]] | Union[BaseModel, DynamicTable, NWBDataInterface] @@ -281,7 +257,6 @@ class Images(NWBDataInterface): A collection of images with an optional way to specify the order of the images using the \"order_of_images\" dataset. An order must be specified if the images are referenced by index, e.g., from an IndexSeries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Images") description: Optional[str] = Field( None, description="""Description of this collection of images.""" @@ -300,26 +275,8 @@ class ImagesOrderOfImages(ImageReferences): Ordered dataset of references to Image objects stored in the parent group. Each Image object in the Images group should be stored once and only once, so the dataset should have the same length as the number of images. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["order_of_images"] = Field("order_of_images") image: List[str] | str = Field( default_factory=list, description="""Ordered dataset of references to Image objects.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -NWBData.model_rebuild() -TimeSeriesReferenceVectorData.model_rebuild() -Image.model_rebuild() -ImageReferences.model_rebuild() -NWBContainer.model_rebuild() -NWBDataInterface.model_rebuild() -TimeSeries.model_rebuild() -TimeSeriesData.model_rebuild() -TimeSeriesStartingTime.model_rebuild() -TimeSeriesSync.model_rebuild() -ProcessingModule.model_rebuild() -Images.model_rebuild() -ImagesOrderOfImages.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_behavior.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_behavior.py index bcb4530..4307af5 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_behavior.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_behavior.py @@ -28,9 +28,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( - NWBDataInterface, TimeSeries, TimeSeriesStartingTime, + NWBDataInterface, TimeSeriesSync, ) @@ -42,13 +42,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -68,18 +61,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field( ..., @@ -123,7 +109,6 @@ class SpatialSeriesData(ConfiguredBaseModel): 1-D or 2-D array storing position or direction relative to some reference frame. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[IntervalSeries] | IntervalSeries] = Field( default_factory=dict ) @@ -156,7 +140,6 @@ class BehavioralEvents(NWBDataInterface): TimeSeries for storing behavioral events. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -166,7 +149,6 @@ class BehavioralTimeSeries(NWBDataInterface): TimeSeries for storing Behavoioral time series data. See description of BehavioralEpochs for more details. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -176,7 +158,6 @@ class PupilTracking(NWBDataInterface): Eye-tracking data, representing pupil size. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[TimeSeries] | TimeSeries] = Field(default_factory=dict) name: str = Field(...) @@ -186,7 +167,6 @@ class EyeTracking(NWBDataInterface): Eye-tracking data, representing direction of gaze. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -198,7 +178,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) @@ -210,21 +189,7 @@ class Position(NWBDataInterface): Position data, whether along the x, x/y or x/y/z axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpatialSeries] | SpatialSeries] = Field( default_factory=dict ) name: str = Field(...) - - -# 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_device.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_device.py index e7bfbc4..d52d8e1 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_device.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_device.py @@ -35,13 +35,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Device(NWBContainer): """ Metadata about a data acquisition device, e.g., recording system, electrode, microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, @@ -81,8 +67,3 @@ class Device(NWBContainer): 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ecephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ecephys.py index c7d5281..7dd56c2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ecephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ecephys.py @@ -27,29 +27,22 @@ if TYPE_CHECKING: import numpy as np +from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTableRegion, DynamicTable + from .core_nwb_base import ( + NWBContainer, + TimeSeriesStartingTime, NWBDataInterface, TimeSeries, - TimeSeriesStartingTime, - NWBContainer, TimeSeriesSync, ) -from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTableRegion, DynamicTable - metamodel_version = "None" version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -69,18 +62,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) filtering: Optional[str] = Field( None, @@ -133,7 +119,6 @@ class ElectricalSeriesElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -157,7 +142,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_events, * num_channels, * num_samples"], float], @@ -209,7 +193,6 @@ class FeatureExtraction(NWBDataInterface): Features, such as PC1 and PC2, that are extracted from signals stored in a SpikeEventSeries or other source. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("FeatureExtraction") description: NDArray[Shape["* num_features"], str] = Field( ..., @@ -236,7 +219,6 @@ class FeatureExtractionElectrodes(DynamicTableRegion): DynamicTableRegion pointer to the electrodes that this time series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -260,7 +242,6 @@ class EventDetection(NWBDataInterface): Detected spike events from voltage trace(s). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("EventDetection") detection_method: str = Field( ..., @@ -280,7 +261,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[SpikeEventSeries] | SpikeEventSeries] = Field( default_factory=dict ) @@ -292,7 +272,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -304,7 +283,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[ElectricalSeries] | ElectricalSeries] = Field( default_factory=dict ) @@ -316,7 +294,6 @@ class ElectrodeGroup(NWBContainer): A physical grouping of electrodes, e.g. a shank of an array. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of this electrode group.""" @@ -335,7 +312,6 @@ class ElectrodeGroupPosition(ConfiguredBaseModel): stereotaxic or common framework coordinates """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["position"] = Field("position") x: Optional[float] = Field(None, description="""x coordinate""") y: Optional[float] = Field(None, description="""y coordinate""") @@ -347,7 +323,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ClusterWaveforms") waveform_filtering: str = Field( ..., description="""Filtering applied to data before generating mean/sd""" @@ -367,7 +342,6 @@ class Clustering(NWBDataInterface): DEPRECATED Clustered spike data, whether from automatic clustering tools (e.g., klustakwik) or as a result of manual sorting. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Clustering") description: str = Field( ..., @@ -384,20 +358,3 @@ class Clustering(NWBDataInterface): ..., 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() -ElectricalSeriesElectrodes.model_rebuild() -SpikeEventSeries.model_rebuild() -FeatureExtraction.model_rebuild() -FeatureExtractionElectrodes.model_rebuild() -EventDetection.model_rebuild() -EventWaveform.model_rebuild() -FilteredEphys.model_rebuild() -LFP.model_rebuild() -ElectrodeGroup.model_rebuild() -ElectrodeGroupPosition.model_rebuild() -ClusterWaveforms.model_rebuild() -Clustering.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_epoch.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_epoch.py index cbe7e09..5affb53 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_epoch.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_epoch.py @@ -27,27 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesReferenceVectorData - from ...hdmf_common.v1_8_0.hdmf_common_table import ( - DynamicTable, VectorIndex, + DynamicTable, VectorData, ) +from .core_nwb_base import TimeSeriesReferenceVectorData, TimeSeries + metamodel_version = "None" version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -67,18 +60,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class TimeIntervals(DynamicTable): """ A container for aggregating epoch data and the TimeSeries that each epoch applies to. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) start_time: Optional[List[float] | float] = Field( default_factory=list, description="""Start time of epoch, in seconds.""" @@ -119,7 +105,6 @@ class TimeIntervalsTagsIndex(VectorIndex): Index for tags. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["tags_index"] = Field("tags_index") target: Optional[str] = Field( None, @@ -143,7 +128,6 @@ class TimeIntervalsTimeseries(TimeSeriesReferenceVectorData): An index into a TimeSeries object. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries"] = Field("timeseries") idx_start: int = Field( ..., @@ -174,7 +158,6 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): Index for timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["timeseries_index"] = Field("timeseries_index") target: Optional[str] = Field( None, @@ -191,11 +174,3 @@ class TimeIntervalsTimeseriesIndex(VectorIndex): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -TimeIntervals.model_rebuild() -TimeIntervalsTagsIndex.model_rebuild() -TimeIntervalsTimeseries.model_rebuild() -TimeIntervalsTimeseriesIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_file.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_file.py index 15d7e9c..428bc7b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_file.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_file.py @@ -27,38 +27,38 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_ophys import ImagingPlane - -from .core_nwb_base import ( - TimeSeries, - NWBDataInterface, - ProcessingModule, - NWBContainer, - NWBData, - Images, +from .core_nwb_icephys import ( + SweepTable, + SimultaneousRecordingsTable, + SequentialRecordingsTable, + RepetitionsTable, + ExperimentalConditionsTable, + IntracellularElectrode, + IntracellularRecordingsTable, ) from .core_nwb_epoch import TimeIntervals -from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTable, VectorData +from .core_nwb_ecephys import ElectrodeGroup -from .core_nwb_icephys import ( - RepetitionsTable, - IntracellularElectrode, - SequentialRecordingsTable, - IntracellularRecordingsTable, - SweepTable, - ExperimentalConditionsTable, - SimultaneousRecordingsTable, +from .core_nwb_base import ( + NWBContainer, + ProcessingModule, + Images, + NWBData, + NWBDataInterface, + TimeSeries, ) -from .core_nwb_ogen import OptogeneticStimulusSite +from .core_nwb_device import Device from .core_nwb_misc import Units -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_ogen import OptogeneticStimulusSite -from .core_nwb_device import Device +from ...hdmf_common.v1_8_0.hdmf_common_table import DynamicTable, VectorData + +from .core_nwb_ophys import ImagingPlane metamodel_version = "None" @@ -66,13 +66,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -92,18 +85,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ScratchData(NWBData): """ Any one-off datasets """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) notes: Optional[str] = Field( None, description="""Any notes the user has about the dataset being stored""" @@ -115,7 +101,6 @@ class NWBFile(NWBContainer): An NWB file storing cellular-based neurophysiology data from a single experimental session. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["root"] = Field("root") nwb_version: Optional[str] = Field( None, @@ -186,7 +171,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") presentation: Optional[ List[Union[BaseModel, DynamicTable, NWBDataInterface, TimeSeries]] @@ -207,7 +191,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["general"] = Field("general") data_collection: Optional[str] = Field( None, description="""Notes about data collection and analysis.""" @@ -297,7 +280,6 @@ class NWBFileGeneralSourceScript(ConfiguredBaseModel): Script file or link to public source code used to create this NWB file. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_script"] = Field("source_script") file_name: Optional[str] = Field(None, description="""Name of script file.""") value: str = Field(...) @@ -308,7 +290,6 @@ class NWBFileGeneralExtracellularEphys(ConfiguredBaseModel): Metadata related to extracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["extracellular_ephys"] = Field("extracellular_ephys") electrode_group: Optional[List[str] | str] = Field( default_factory=list, description="""Physical group of electrodes.""" @@ -324,7 +305,6 @@ class NWBFileGeneralExtracellularEphysElectrodes(DynamicTable): A table of all electrodes (i.e. channels) used for recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") x: Optional[List[float] | float] = Field( default_factory=list, @@ -392,7 +372,6 @@ class NWBFileGeneralIntracellularEphys(ConfiguredBaseModel): Metadata related to intracellular electrophysiology. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["intracellular_ephys"] = Field("intracellular_ephys") filtering: Optional[str] = Field( None, @@ -432,7 +411,6 @@ class LabMetaData(NWBContainer): Lab-specific meta-data. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -441,7 +419,6 @@ class Subject(NWBContainer): Information about the animal or person from which the data was measured. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) age: Optional[str] = Field( None, @@ -476,25 +453,9 @@ class SubjectAge(ConfiguredBaseModel): Age of subject. Can be supplied instead of 'date_of_birth'. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["age"] = Field("age") reference: Optional[str] = Field( None, description="""Age is with reference to this event. Can be 'birth' or 'gestational'. If reference is omitted, 'birth' is implied.""", ) value: str = Field(...) - - -# 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() -LabMetaData.model_rebuild() -Subject.model_rebuild() -SubjectAge.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_icephys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_icephys.py index e205af8..791fbb0 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_icephys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_icephys.py @@ -27,20 +27,20 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - TimeSeriesStartingTime, - NWBContainer, - TimeSeriesReferenceVectorData, +from ...hdmf_common.v1_8_0.hdmf_common_table import ( + AlignedDynamicTable, + DynamicTableRegion, + VectorIndex, + DynamicTable, + VectorData, ) -from ...hdmf_common.v1_8_0.hdmf_common_table import ( - DynamicTableRegion, - DynamicTable, - AlignedDynamicTable, - VectorData, - VectorIndex, +from .core_nwb_base import ( + NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + TimeSeriesReferenceVectorData, + TimeSeries, ) @@ -49,13 +49,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,18 +68,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class PatchClampSeries(TimeSeries): """ An abstract base class for patch-clamp data - stimulus or response, current or voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, description="""Protocol/stimulus name for this patch-clamp dataset.""" @@ -134,7 +120,6 @@ class PatchClampSeriesData(ConfiguredBaseModel): Recorded voltage or current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -148,7 +133,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded voltage.""") bias_current: Optional[float] = Field( @@ -205,7 +189,6 @@ class CurrentClampSeriesData(ConfiguredBaseModel): Recorded voltage. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -219,7 +202,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) stimulus_description: Optional[str] = Field( None, @@ -277,7 +259,6 @@ class CurrentClampStimulusSeries(PatchClampSeries): Stimulus current applied during current clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus current applied.""") stimulus_description: Optional[str] = Field( @@ -325,7 +306,6 @@ class CurrentClampStimulusSeriesData(ConfiguredBaseModel): Stimulus current applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -339,7 +319,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Recorded current.""") capacitance_fast: Optional[str] = Field( @@ -408,7 +387,6 @@ class VoltageClampSeriesData(ConfiguredBaseModel): Recorded current. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -422,7 +400,6 @@ class VoltageClampSeriesCapacitanceFast(ConfiguredBaseModel): Fast capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_fast"] = Field("capacitance_fast") unit: Optional[str] = Field( None, @@ -436,7 +413,6 @@ class VoltageClampSeriesCapacitanceSlow(ConfiguredBaseModel): Slow capacitance, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["capacitance_slow"] = Field("capacitance_slow") unit: Optional[str] = Field( None, @@ -450,7 +426,6 @@ class VoltageClampSeriesResistanceCompBandwidth(ConfiguredBaseModel): Resistance compensation bandwidth, in hertz. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_bandwidth"] = Field("resistance_comp_bandwidth") unit: Optional[str] = Field( None, @@ -464,7 +439,6 @@ class VoltageClampSeriesResistanceCompCorrection(ConfiguredBaseModel): Resistance compensation correction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_correction"] = Field("resistance_comp_correction") unit: Optional[str] = Field( None, @@ -478,7 +452,6 @@ class VoltageClampSeriesResistanceCompPrediction(ConfiguredBaseModel): Resistance compensation prediction, in percent. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resistance_comp_prediction"] = Field("resistance_comp_prediction") unit: Optional[str] = Field( None, @@ -492,7 +465,6 @@ class VoltageClampSeriesWholeCellCapacitanceComp(ConfiguredBaseModel): Whole cell capacitance compensation, in farads. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_capacitance_comp"] = Field("whole_cell_capacitance_comp") unit: Optional[str] = Field( None, @@ -506,7 +478,6 @@ class VoltageClampSeriesWholeCellSeriesResistanceComp(ConfiguredBaseModel): Whole cell series resistance compensation, in ohms. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["whole_cell_series_resistance_comp"] = Field( "whole_cell_series_resistance_comp" ) @@ -522,7 +493,6 @@ class VoltageClampStimulusSeries(PatchClampSeries): Stimulus voltage applied during a voltage clamp recording. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Stimulus voltage applied.""") stimulus_description: Optional[str] = Field( @@ -570,7 +540,6 @@ class VoltageClampStimulusSeriesData(ConfiguredBaseModel): Stimulus voltage applied. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -584,7 +553,6 @@ class IntracellularElectrode(NWBContainer): An intracellular electrode and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) cell_id: Optional[str] = Field(None, description="""unique ID of the cell""") description: str = Field( @@ -617,7 +585,6 @@ class SweepTable(DynamicTable): [DEPRECATED] Table used to group different PatchClampSeries. SweepTable is being replaced by IntracellularRecordingsTable and SimultaneousRecordingsTable tables. Additional SequentialRecordingsTable, RepetitionsTable, and ExperimentalConditions tables provide enhanced support for experiment metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) sweep_number: Optional[List[int] | int] = Field( default_factory=list, @@ -650,7 +617,6 @@ class SweepTableSeriesIndex(VectorIndex): Index for series. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["series_index"] = Field("series_index") target: Optional[str] = Field( None, @@ -674,7 +640,6 @@ class IntracellularElectrodesTable(DynamicTable): Table for storing intracellular electrode related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -702,7 +667,6 @@ class IntracellularStimuliTable(DynamicTable): Table for storing intracellular stimulus related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -734,7 +698,6 @@ class IntracellularStimuliTableStimulus(TimeSeriesReferenceVectorData): Column storing the reference to the recorded stimulus for the recording (rows). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus"] = Field("stimulus") idx_start: int = Field( ..., @@ -765,7 +728,6 @@ class IntracellularStimuliTableStimulusTemplate(TimeSeriesReferenceVectorData): Column storing the reference to the stimulus template for the recording (rows). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["stimulus_template"] = Field("stimulus_template") idx_start: int = Field( ..., @@ -796,7 +758,6 @@ class IntracellularResponsesTable(DynamicTable): Table for storing intracellular response related metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what is in this dynamic table.""" @@ -824,7 +785,6 @@ class IntracellularResponsesTableResponse(TimeSeriesReferenceVectorData): Column storing the reference to the recorded response for the recording (rows) """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["response"] = Field("response") idx_start: int = Field( ..., @@ -855,7 +815,6 @@ class IntracellularRecordingsTable(AlignedDynamicTable): A table to group together a stimulus and response from a single electrode and a single simultaneous recording. Each row in the table represents a single recording consisting typically of a stimulus and a corresponding response. In some cases, however, only a stimulus or a response is recorded as part of an experiment. In this case, both the stimulus and response will point to the same TimeSeries while the idx_start and count of the invalid column will be set to -1, thus, indicating that no values have been recorded for the stimulus or response, respectively. Note, a recording MUST contain at least a stimulus or a response. Typically the stimulus and response are PatchClampSeries. However, the use of AD/DA channels that are not associated to an electrode is also common in intracellular electrophysiology, in which case other TimeSeries may be used. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["intracellular_recordings"] = Field("intracellular_recordings") description: Optional[str] = Field( None, @@ -895,7 +854,6 @@ class SimultaneousRecordingsTable(DynamicTable): A table for grouping different intracellular recordings from the IntracellularRecordingsTable table together that were recorded simultaneously from different electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") recordings: str = Field( ..., @@ -926,7 +884,6 @@ class SimultaneousRecordingsTableRecordings(DynamicTableRegion): A reference to one or more rows in the IntracellularRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings"] = Field("recordings") table: Optional[str] = Field( None, @@ -950,7 +907,6 @@ class SimultaneousRecordingsTableRecordingsIndex(VectorIndex): Index dataset for the recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["recordings_index"] = Field("recordings_index") target: Optional[str] = Field( None, @@ -974,7 +930,6 @@ class SequentialRecordingsTable(DynamicTable): A table for grouping different sequential recordings from the SimultaneousRecordingsTable table together. This is typically used to group together sequential recordings where a sequence of stimuli of the same type with varying parameters have been presented in a sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") simultaneous_recordings: str = Field( ..., @@ -1009,7 +964,6 @@ class SequentialRecordingsTableSimultaneousRecordings(DynamicTableRegion): A reference to one or more rows in the SimultaneousRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings"] = Field("simultaneous_recordings") table: Optional[str] = Field( None, @@ -1033,7 +987,6 @@ class SequentialRecordingsTableSimultaneousRecordingsIndex(VectorIndex): Index dataset for the simultaneous_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["simultaneous_recordings_index"] = Field( "simultaneous_recordings_index" ) @@ -1059,7 +1012,6 @@ class RepetitionsTable(DynamicTable): A table for grouping different sequential intracellular recordings together. With each SequentialRecording typically representing a particular type of stimulus, the RepetitionsTable table is typically used to group sets of stimuli applied in sequence. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["repetitions"] = Field("repetitions") sequential_recordings: str = Field( ..., @@ -1090,7 +1042,6 @@ class RepetitionsTableSequentialRecordings(DynamicTableRegion): A reference to one or more rows in the SequentialRecordingsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings"] = Field("sequential_recordings") table: Optional[str] = Field( None, @@ -1114,7 +1065,6 @@ class RepetitionsTableSequentialRecordingsIndex(VectorIndex): Index dataset for the sequential_recordings column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sequential_recordings_index"] = Field("sequential_recordings_index") target: Optional[str] = Field( None, @@ -1138,7 +1088,6 @@ class ExperimentalConditionsTable(DynamicTable): A table for grouping different intracellular recording repetitions together that belong to the same experimental condition. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: Literal["experimental_conditions"] = Field("experimental_conditions") repetitions: str = Field( ..., @@ -1169,7 +1118,6 @@ class ExperimentalConditionsTableRepetitions(DynamicTableRegion): A reference to one or more rows in the RepetitionsTable table. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions"] = Field("repetitions") table: Optional[str] = Field( None, @@ -1193,7 +1141,6 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): Index dataset for the repetitions column. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["repetitions_index"] = Field("repetitions_index") target: Optional[str] = Field( None, @@ -1210,47 +1157,3 @@ class ExperimentalConditionsTableRepetitionsIndex(VectorIndex): 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() -PatchClampSeriesData.model_rebuild() -CurrentClampSeries.model_rebuild() -CurrentClampSeriesData.model_rebuild() -IZeroClampSeries.model_rebuild() -CurrentClampStimulusSeries.model_rebuild() -CurrentClampStimulusSeriesData.model_rebuild() -VoltageClampSeries.model_rebuild() -VoltageClampSeriesData.model_rebuild() -VoltageClampSeriesCapacitanceFast.model_rebuild() -VoltageClampSeriesCapacitanceSlow.model_rebuild() -VoltageClampSeriesResistanceCompBandwidth.model_rebuild() -VoltageClampSeriesResistanceCompCorrection.model_rebuild() -VoltageClampSeriesResistanceCompPrediction.model_rebuild() -VoltageClampSeriesWholeCellCapacitanceComp.model_rebuild() -VoltageClampSeriesWholeCellSeriesResistanceComp.model_rebuild() -VoltageClampStimulusSeries.model_rebuild() -VoltageClampStimulusSeriesData.model_rebuild() -IntracellularElectrode.model_rebuild() -SweepTable.model_rebuild() -SweepTableSeriesIndex.model_rebuild() -IntracellularElectrodesTable.model_rebuild() -IntracellularStimuliTable.model_rebuild() -IntracellularStimuliTableStimulus.model_rebuild() -IntracellularStimuliTableStimulusTemplate.model_rebuild() -IntracellularResponsesTable.model_rebuild() -IntracellularResponsesTableResponse.model_rebuild() -IntracellularRecordingsTable.model_rebuild() -SimultaneousRecordingsTable.model_rebuild() -SimultaneousRecordingsTableRecordings.model_rebuild() -SimultaneousRecordingsTableRecordingsIndex.model_rebuild() -SequentialRecordingsTable.model_rebuild() -SequentialRecordingsTableSimultaneousRecordings.model_rebuild() -SequentialRecordingsTableSimultaneousRecordingsIndex.model_rebuild() -RepetitionsTable.model_rebuild() -RepetitionsTableSequentialRecordings.model_rebuild() -RepetitionsTableSequentialRecordingsIndex.model_rebuild() -ExperimentalConditionsTable.model_rebuild() -ExperimentalConditionsTableRepetitions.model_rebuild() -ExperimentalConditionsTableRepetitionsIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_image.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_image.py index 8ab8ae0..82259dc 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_image.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_image.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import Image, TimeSeries, TimeSeriesStartingTime, TimeSeriesSync +from .core_nwb_base import Image, TimeSeriesStartingTime, TimeSeries, TimeSeriesSync metamodel_version = "None" @@ -35,13 +35,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class GrayscaleImage(Image): """ A grayscale image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -94,7 +80,6 @@ class RGBImage(Image): A color image. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -116,7 +101,6 @@ class RGBAImage(Image): A color image with transparency. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) resolution: Optional[float] = Field( None, description="""Pixel resolution of the image, in pixels per centimeter.""" @@ -138,7 +122,6 @@ 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]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -192,7 +175,6 @@ class ImageSeriesExternalFile(ConfiguredBaseModel): 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["external_file"] = Field("external_file") starting_frame: Optional[int] = Field( None, @@ -206,7 +188,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* frame, * x, * y"], float], @@ -260,7 +241,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) distance: Optional[float] = Field( None, description="""Distance from camera/monitor to target/eye.""" @@ -329,7 +309,6 @@ class IndexSeries(TimeSeries): Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored in an Images object, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced Images object, and the timestamps array indicates when that image was displayed. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., @@ -362,15 +341,3 @@ class IndexSeries(TimeSeries): 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() -ImageSeriesExternalFile.model_rebuild() -ImageMaskSeries.model_rebuild() -OpticalSeries.model_rebuild() -IndexSeries.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_misc.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_misc.py index 8036441..2083477 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_misc.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_misc.py @@ -27,16 +27,16 @@ if TYPE_CHECKING: import numpy as np -from .core_nwb_base import TimeSeries, TimeSeriesSync, TimeSeriesStartingTime +from .core_nwb_ecephys import ElectrodeGroup from ...hdmf_common.v1_8_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) -from .core_nwb_ecephys import ElectrodeGroup +from .core_nwb_base import TimeSeriesSync, TimeSeriesStartingTime, TimeSeries metamodel_version = "None" @@ -44,13 +44,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,18 +63,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Values of each feature at each time.""") feature_units: Optional[NDArray[Shape["* num_features"], str]] = Field( @@ -125,7 +111,6 @@ class AbstractFeatureSeriesData(ConfiguredBaseModel): Values of each feature at each time. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -144,7 +129,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], str] = Field( ..., description="""Annotations made during an experiment.""" @@ -183,7 +167,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: NDArray[Shape["* num_times"], int] = Field( ..., description="""Use values >0 if interval started, <0 if interval ended.""" @@ -222,7 +205,6 @@ class DecompositionSeries(TimeSeries): Spectral analysis of a time series, e.g. of an LFP or a speech signal. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: str = Field(..., description="""Data decomposed into frequency bands.""") metric: str = Field( @@ -270,7 +252,6 @@ class DecompositionSeriesData(ConfiguredBaseModel): Data decomposed into frequency bands. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") unit: Optional[str] = Field( None, @@ -286,7 +267,6 @@ class DecompositionSeriesSourceChannels(DynamicTableRegion): DynamicTableRegion pointer to the channels that this decomposition series was generated from. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["source_channels"] = Field("source_channels") table: Optional[str] = Field( None, @@ -310,7 +290,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["bands"] = Field("bands") band_name: Optional[List[str] | str] = Field( default_factory=list, description="""Name of the band, e.g. theta.""" @@ -347,7 +326,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("Units") spike_times_index: Optional[str] = Field( None, description="""Index into the spike_times dataset.""" @@ -422,7 +400,6 @@ class UnitsSpikeTimesIndex(VectorIndex): Index into the spike_times dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times_index"] = Field("spike_times_index") target: Optional[str] = Field( None, @@ -446,7 +423,6 @@ class UnitsSpikeTimes(VectorData): Spike times for each unit in seconds. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["spike_times"] = Field("spike_times") resolution: Optional[float] = Field( None, @@ -470,7 +446,6 @@ class UnitsObsIntervalsIndex(VectorIndex): Index into the obs_intervals dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["obs_intervals_index"] = Field("obs_intervals_index") target: Optional[str] = Field( None, @@ -494,7 +469,6 @@ class UnitsElectrodesIndex(VectorIndex): Index into electrodes. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes_index"] = Field("electrodes_index") target: Optional[str] = Field( None, @@ -518,7 +492,6 @@ class UnitsElectrodes(DynamicTableRegion): Electrode that each spike unit came from, specified using a DynamicTableRegion. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["electrodes"] = Field("electrodes") table: Optional[str] = Field( None, @@ -542,7 +515,6 @@ class UnitsWaveformsIndex(VectorIndex): Index into the waveforms dataset. One value for every spike event. See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index"] = Field("waveforms_index") target: Optional[str] = Field( None, @@ -566,7 +538,6 @@ class UnitsWaveformsIndexIndex(VectorIndex): Index into the waveforms_index dataset. One value for every unit (row in the table). See 'waveforms' for more detail. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["waveforms_index_index"] = Field("waveforms_index_index") target: Optional[str] = Field( None, @@ -583,23 +554,3 @@ class UnitsWaveformsIndexIndex(VectorIndex): 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() -Units.model_rebuild() -UnitsSpikeTimesIndex.model_rebuild() -UnitsSpikeTimes.model_rebuild() -UnitsObsIntervalsIndex.model_rebuild() -UnitsElectrodesIndex.model_rebuild() -UnitsElectrodes.model_rebuild() -UnitsWaveformsIndex.model_rebuild() -UnitsWaveformsIndexIndex.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ogen.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ogen.py index 49effd2..ae48339 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ogen.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ogen.py @@ -29,9 +29,9 @@ if TYPE_CHECKING: from .core_nwb_base import ( TimeSeriesSync, - TimeSeries, NWBContainer, TimeSeriesStartingTime, + TimeSeries, ) @@ -40,13 +40,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -66,18 +59,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OptogeneticSeries(TimeSeries): """ An optogenetic stimulus. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -120,7 +106,6 @@ class OptogeneticStimulusSite(NWBContainer): A site of optogenetic stimulation. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field(..., description="""Description of stimulation site.""") excitation_lambda: float = Field( @@ -130,9 +115,3 @@ class OptogeneticStimulusSite(NWBContainer): ..., 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ophys.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ophys.py index 7c811da..82ac2ad 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ophys.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_ophys.py @@ -28,18 +28,18 @@ if TYPE_CHECKING: from .core_nwb_base import ( - TimeSeries, - TimeSeriesSync, - NWBDataInterface, - TimeSeriesStartingTime, NWBContainer, + TimeSeriesSync, + TimeSeriesStartingTime, + NWBDataInterface, + TimeSeries, ) from ...hdmf_common.v1_8_0.hdmf_common_table import ( DynamicTableRegion, + VectorIndex, DynamicTable, VectorData, - VectorIndex, ) from .core_nwb_image import ImageSeries, ImageSeriesExternalFile @@ -50,13 +50,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -76,18 +69,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class OnePhotonSeries(ImageSeries): """ Image stack recorded over time from 1-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -160,7 +146,6 @@ class TwoPhotonSeries(ImageSeries): Image stack recorded over time from 2-photon microscope. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) pmt_gain: Optional[float] = Field(None, description="""Photomultiplier gain.""") scan_line_rate: Optional[float] = Field( @@ -228,7 +213,6 @@ class RoiResponseSeries(TimeSeries): ROI responses over an imaging plane. The first dimension represents time. The second dimension, if present, represents ROIs. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) data: Union[ NDArray[Shape["* num_times"], float], @@ -272,7 +256,6 @@ class RoiResponseSeriesRois(DynamicTableRegion): DynamicTableRegion referencing into an ROITable containing information on the ROIs stored in this timeseries. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["rois"] = Field("rois") table: Optional[str] = Field( None, @@ -296,7 +279,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -308,7 +290,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[RoiResponseSeries] | RoiResponseSeries] = Field( default_factory=dict ) @@ -320,7 +301,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[PlaneSegmentation] | PlaneSegmentation] = Field( default_factory=dict ) @@ -332,7 +312,6 @@ class PlaneSegmentation(DynamicTable): Results from image segmentation of a specific imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) image_mask: Optional[ Union[ @@ -383,7 +362,6 @@ class PlaneSegmentationPixelMaskIndex(VectorIndex): Index into pixel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask_index"] = Field("pixel_mask_index") target: Optional[str] = Field( None, @@ -407,7 +385,6 @@ class PlaneSegmentationPixelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["pixel_mask"] = Field("pixel_mask") x: Optional[int] = Field(None, description="""Pixel x-coordinate.""") y: Optional[int] = Field(None, description="""Pixel y-coordinate.""") @@ -430,7 +407,6 @@ class PlaneSegmentationVoxelMaskIndex(VectorIndex): Index into voxel_mask. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask_index"] = Field("voxel_mask_index") target: Optional[str] = Field( None, @@ -454,7 +430,6 @@ class PlaneSegmentationVoxelMask(VectorData): 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 """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["voxel_mask"] = Field("voxel_mask") x: Optional[int] = Field(None, description="""Voxel x-coordinate.""") y: Optional[int] = Field(None, description="""Voxel y-coordinate.""") @@ -478,7 +453,6 @@ class ImagingPlane(NWBContainer): An imaging plane and its metadata. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[OpticalChannel] | OpticalChannel] = Field( default_factory=dict ) @@ -490,7 +464,6 @@ class OpticalChannel(NWBContainer): An optical channel used to record from an imaging plane. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: str = Field( ..., description="""Description or other notes about the channel.""" @@ -505,7 +478,6 @@ 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[CorrectedImageStack] | CorrectedImageStack] = Field( default_factory=dict ) @@ -517,7 +489,6 @@ class CorrectedImageStack(NWBDataInterface): Results from motion correction of an image stack. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) corrected: str = Field( ..., @@ -527,23 +498,3 @@ class CorrectedImageStack(NWBDataInterface): ..., 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 -OnePhotonSeries.model_rebuild() -TwoPhotonSeries.model_rebuild() -RoiResponseSeries.model_rebuild() -RoiResponseSeriesRois.model_rebuild() -DfOverF.model_rebuild() -Fluorescence.model_rebuild() -ImageSegmentation.model_rebuild() -PlaneSegmentation.model_rebuild() -PlaneSegmentationPixelMaskIndex.model_rebuild() -PlaneSegmentationPixelMask.model_rebuild() -PlaneSegmentationVoxelMaskIndex.model_rebuild() -PlaneSegmentationVoxelMask.model_rebuild() -ImagingPlane.model_rebuild() -OpticalChannel.model_rebuild() -MotionCorrection.model_rebuild() -CorrectedImageStack.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_retinotopy.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_retinotopy.py index 2ea3f4d..3f047f6 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_retinotopy.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/core_nwb_retinotopy.py @@ -35,13 +35,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ImagingRetinotopy(NWBDataInterface): """ DEPRECATED. 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). """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("ImagingRetinotopy") axis_1_phase_map: str = Field( ..., description="""Phase response to stimulus on the first measured axis.""" @@ -111,7 +97,6 @@ class ImagingRetinotopyAxis1PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the first measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_phase_map"] = Field("axis_1_phase_map") dimension: Optional[int] = Field( None, @@ -131,7 +116,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_1_power_map"] = Field("axis_1_power_map") dimension: Optional[int] = Field( None, @@ -151,7 +135,6 @@ class ImagingRetinotopyAxis2PhaseMap(ConfiguredBaseModel): Phase response to stimulus on the second measured axis. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_phase_map"] = Field("axis_2_phase_map") dimension: Optional[int] = Field( None, @@ -171,7 +154,6 @@ 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. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["axis_2_power_map"] = Field("axis_2_power_map") dimension: Optional[int] = Field( None, @@ -191,7 +173,6 @@ class ImagingRetinotopyFocalDepthImage(ConfiguredBaseModel): Gray-scale image taken with same settings/parameters (e.g., focal depth, wavelength) as data collection. Array format: [rows][columns]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["focal_depth_image"] = Field("focal_depth_image") bits_per_pixel: Optional[int] = Field( None, @@ -218,7 +199,6 @@ class ImagingRetinotopySignMap(ConfiguredBaseModel): Sine of the angle between the direction of the gradient in axis_1 and axis_2. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["sign_map"] = Field("sign_map") dimension: Optional[int] = Field( None, @@ -235,7 +215,6 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): Gray-scale anatomical image of cortical surface. Array structure: [rows][columns] """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["vasculature_image"] = Field("vasculature_image") bits_per_pixel: Optional[int] = Field( None, @@ -252,15 +231,3 @@ class ImagingRetinotopyVasculatureImage(ConfiguredBaseModel): None, description="""Format of image. Right now only 'raw' is supported.""" ) array: Optional[NDArray[Shape["* num_rows, * num_cols"], int]] = 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() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/namespace.py index 280d797..d6817b6 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/core/v2_7_0/namespace.py @@ -230,13 +230,6 @@ version = "2.7.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -254,13 +247,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_sparse.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_sparse.py index 1f4fe75..b9afd6a 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_sparse.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_sparse.py @@ -32,13 +32,6 @@ version = "1.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class CSRMatrix(ConfiguredBaseModel): """ a compressed sparse row matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) shape: Optional[int] = Field( None, description="""the shape of this sparse matrix""" @@ -84,7 +70,6 @@ class CSRMatrixIndices(ConfiguredBaseModel): column indices """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indices"] = Field("indices") @@ -93,7 +78,6 @@ class CSRMatrixIndptr(ConfiguredBaseModel): index pointer """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indptr"] = Field("indptr") @@ -102,13 +86,4 @@ class CSRMatrixData(ConfiguredBaseModel): values in the matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CSRMatrix.model_rebuild() -CSRMatrixIndices.model_rebuild() -CSRMatrixIndptr.model_rebuild() -CSRMatrixData.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_table.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_table.py index afb66ce..e13569c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_table.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/hdmf_common_table.py @@ -32,13 +32,6 @@ version = "1.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -78,7 +64,6 @@ class Index(Data): Pointers that index data values. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, description="""Target dataset that this index applies to.""" @@ -90,7 +75,6 @@ class VectorData(Data): An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex(0)+1]. The second vector is at VectorData[VectorIndex(0)+1:VectorIndex(1)+1], and so on. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what these vectors represent.""" @@ -102,7 +86,6 @@ class VectorIndex(Index): Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, @@ -115,7 +98,6 @@ class ElementIdentifiers(Data): A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("element_id") @@ -124,7 +106,6 @@ class DynamicTableRegion(VectorData): DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) table: Optional[str] = Field( None, @@ -140,7 +121,6 @@ class Container(ConfiguredBaseModel): An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -149,7 +129,6 @@ class DynamicTable(Container): A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). Apart from a column that contains unique identifiers for each row there are no other required datasets. Users are free to add any number of VectorData objects here. Table functionality is already supported through compound types, which is analogous to storing an array-of-structs. DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. For example, DynamicTable was originally developed for storing trial data and spike unit metadata. Both of these use cases are expected to produce relatively small tables, so the spatial locality of multiple datasets present in a DynamicTable is not expected to have a significant performance impact. Additionally, requirements of trial and unit metadata tables are sufficiently diverse that performance implications can be overlooked in favor of usability. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) colnames: Optional[str] = Field( None, @@ -169,15 +148,3 @@ class DynamicTable(Container): default_factory=list, description="""Indices for the vector columns of this dynamic table.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Data.model_rebuild() -Index.model_rebuild() -VectorData.model_rebuild() -VectorIndex.model_rebuild() -ElementIdentifiers.model_rebuild() -DynamicTableRegion.model_rebuild() -Container.model_rebuild() -DynamicTable.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/namespace.py index e7bd65b..2136699 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_0/namespace.py @@ -51,13 +51,6 @@ version = "1.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,13 +68,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_sparse.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_sparse.py index 757bd91..ae27964 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_sparse.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_sparse.py @@ -32,13 +32,6 @@ version = "1.1.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class CSRMatrix(ConfiguredBaseModel): """ a compressed sparse row matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) shape: Optional[int] = Field( None, description="""the shape of this sparse matrix""" @@ -84,7 +70,6 @@ class CSRMatrixIndices(ConfiguredBaseModel): column indices """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indices"] = Field("indices") @@ -93,7 +78,6 @@ class CSRMatrixIndptr(ConfiguredBaseModel): index pointer """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indptr"] = Field("indptr") @@ -102,13 +86,4 @@ class CSRMatrixData(ConfiguredBaseModel): values in the matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CSRMatrix.model_rebuild() -CSRMatrixIndices.model_rebuild() -CSRMatrixIndptr.model_rebuild() -CSRMatrixData.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_table.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_table.py index a6dd80d..5349a38 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_table.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/hdmf_common_table.py @@ -32,13 +32,6 @@ version = "1.1.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -78,7 +64,6 @@ class Index(Data): Pointers that index data values. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, description="""Target dataset that this index applies to.""" @@ -90,7 +75,6 @@ class VectorData(Data): An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex(0)+1]. The second vector is at VectorData[VectorIndex(0)+1:VectorIndex(1)+1], and so on. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what these vectors represent.""" @@ -102,7 +86,6 @@ class VectorIndex(Index): Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, @@ -115,7 +98,6 @@ class ElementIdentifiers(Data): A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("element_id") @@ -124,7 +106,6 @@ class DynamicTableRegion(VectorData): DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) table: Optional[str] = Field( None, @@ -140,7 +121,6 @@ class Container(ConfiguredBaseModel): An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -149,7 +129,6 @@ class DynamicTable(Container): A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). Apart from a column that contains unique identifiers for each row there are no other required datasets. Users are free to add any number of VectorData objects here. Table functionality is already supported through compound types, which is analogous to storing an array-of-structs. DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. For example, DynamicTable was originally developed for storing trial data and spike unit metadata. Both of these use cases are expected to produce relatively small tables, so the spatial locality of multiple datasets present in a DynamicTable is not expected to have a significant performance impact. Additionally, requirements of trial and unit metadata tables are sufficiently diverse that performance implications can be overlooked in favor of usability. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) colnames: Optional[str] = Field( None, @@ -169,15 +148,3 @@ class DynamicTable(Container): default_factory=list, description="""Indices for the vector columns of this dynamic table.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Data.model_rebuild() -Index.model_rebuild() -VectorData.model_rebuild() -VectorIndex.model_rebuild() -ElementIdentifiers.model_rebuild() -DynamicTableRegion.model_rebuild() -Container.model_rebuild() -DynamicTable.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/namespace.py index 585968b..cde458e 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_2/namespace.py @@ -51,13 +51,6 @@ version = "1.1.2" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,13 +68,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_sparse.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_sparse.py index a586ef2..18138b2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_sparse.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_sparse.py @@ -32,13 +32,6 @@ version = "1.1.3" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class CSRMatrix(ConfiguredBaseModel): """ a compressed sparse row matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) shape: Optional[int] = Field( None, description="""the shape of this sparse matrix""" @@ -84,7 +70,6 @@ class CSRMatrixIndices(ConfiguredBaseModel): column indices """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indices"] = Field("indices") @@ -93,7 +78,6 @@ class CSRMatrixIndptr(ConfiguredBaseModel): index pointer """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["indptr"] = Field("indptr") @@ -102,13 +86,4 @@ class CSRMatrixData(ConfiguredBaseModel): values in the matrix """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["data"] = Field("data") - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CSRMatrix.model_rebuild() -CSRMatrixIndices.model_rebuild() -CSRMatrixIndptr.model_rebuild() -CSRMatrixData.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_table.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_table.py index 3d8adc1..4fcb2f9 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_table.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/hdmf_common_table.py @@ -32,13 +32,6 @@ version = "1.1.3" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -78,7 +64,6 @@ class Index(Data): Pointers that index data values. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, description="""Target dataset that this index applies to.""" @@ -90,7 +75,6 @@ class VectorData(Data): An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex(0)+1]. The second vector is at VectorData[VectorIndex(0)+1:VectorIndex(1)+1], and so on. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what these vectors represent.""" @@ -110,7 +94,6 @@ class VectorIndex(Index): Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, @@ -124,7 +107,6 @@ class ElementIdentifiers(Data): A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("element_id") @@ -133,7 +115,6 @@ class DynamicTableRegion(VectorData): DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) table: Optional[str] = Field( None, @@ -157,7 +138,6 @@ class Container(ConfiguredBaseModel): An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -166,7 +146,6 @@ class DynamicTable(Container): A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). Apart from a column that contains unique identifiers for each row there are no other required datasets. Users are free to add any number of VectorData objects here. Table functionality is already supported through compound types, which is analogous to storing an array-of-structs. DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. For example, DynamicTable was originally developed for storing trial data and spike unit metadata. Both of these use cases are expected to produce relatively small tables, so the spatial locality of multiple datasets present in a DynamicTable is not expected to have a significant performance impact. Additionally, requirements of trial and unit metadata tables are sufficiently diverse that performance implications can be overlooked in favor of usability. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) colnames: Optional[str] = Field( None, @@ -186,15 +165,3 @@ class DynamicTable(Container): default_factory=list, description="""Indices for the vector columns of this dynamic table.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Data.model_rebuild() -Index.model_rebuild() -VectorData.model_rebuild() -VectorIndex.model_rebuild() -ElementIdentifiers.model_rebuild() -DynamicTableRegion.model_rebuild() -Container.model_rebuild() -DynamicTable.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/namespace.py index 31de187..3229c4d 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_1_3/namespace.py @@ -51,13 +51,6 @@ version = "1.1.3" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -75,13 +68,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_base.py index 0e733d2..fe48a8c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_base.py @@ -32,13 +32,6 @@ version = "1.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -78,7 +64,6 @@ class Container(ConfiguredBaseModel): An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -87,13 +72,5 @@ class SimpleMultiContainer(Container): A simple Container for holding onto multiple containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[Container] | Container] = Field(default_factory=dict) name: str = Field(...) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Data.model_rebuild() -Container.model_rebuild() -SimpleMultiContainer.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_sparse.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_sparse.py index e35bb8a..2c9b11b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_sparse.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_sparse.py @@ -35,13 +35,6 @@ version = "1.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class CSRMatrix(Container): """ A compressed sparse row matrix. Data are stored in the standard CSR format, where column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) shape: Optional[int] = Field( None, @@ -87,8 +73,3 @@ class CSRMatrix(Container): data: NDArray[Shape["* number_of_non_zero_values"], Any] = Field( ..., description="""The non-zero values in the matrix.""" ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CSRMatrix.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_table.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_table.py index df6acb6..49525ad 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_table.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/hdmf_common_table.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .hdmf_common_base import Container, Data +from .hdmf_common_base import Data, Container metamodel_version = "None" @@ -35,13 +35,6 @@ version = "1.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class VectorData(Data): """ An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]], and so on. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what these vectors represent.""" @@ -92,7 +78,6 @@ class VectorIndex(VectorData): Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. The name of the VectorIndex is expected to be the name of the target VectorData object followed by \"_index\". """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, @@ -116,7 +101,6 @@ class ElementIdentifiers(Data): A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("element_id") @@ -125,7 +109,6 @@ class DynamicTableRegion(VectorData): DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) table: Optional[str] = Field( None, @@ -149,7 +132,6 @@ class DynamicTable(Container): A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). These datasets represent different columns in the table. Apart from a column that contains unique identifiers for each row, there are no other required datasets. Users are free to add any number of custom VectorData objects (columns) here. DynamicTable also supports ragged array columns, where each element can be of a different size. To add a ragged array column, use a VectorIndex type to index the corresponding VectorData type. See documentation for VectorData and VectorIndex for more details. Unlike a compound data type, which is analogous to storing an array-of-structs, a DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) colnames: Optional[str] = Field( None, @@ -173,7 +155,6 @@ class AlignedDynamicTable(DynamicTable): DynamicTable container that supports storing a collection of sub-tables. Each sub-table is a DynamicTable itself that is aligned with the main table by row index. I.e., all DynamicTables stored in this group MUST have the same number of rows. This type effectively defines a 2-level table in which the main data is stored in the main table implemented by this type and additional columns of the table are grouped into categories, with each category being represented by a separate DynamicTable stored within the group. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable]] | Union[BaseModel, DynamicTable] ] = Field(default_factory=dict) @@ -193,13 +174,3 @@ class AlignedDynamicTable(DynamicTable): default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -VectorData.model_rebuild() -VectorIndex.model_rebuild() -ElementIdentifiers.model_rebuild() -DynamicTableRegion.model_rebuild() -DynamicTable.model_rebuild() -AlignedDynamicTable.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/namespace.py index a7b666f..2363e43 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_5_0/namespace.py @@ -46,13 +46,6 @@ version = "1.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,13 +63,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_base.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_base.py index b7f821d..ff365c1 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_base.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_base.py @@ -32,13 +32,6 @@ version = "1.8.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -58,18 +51,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class Data(ConfiguredBaseModel): """ An abstract data type for a dataset. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -78,7 +64,6 @@ class Container(ConfiguredBaseModel): An abstract data type for a group storing collections of data and metadata. Base type for all data and metadata containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) @@ -87,13 +72,5 @@ class SimpleMultiContainer(Container): A simple Container for holding onto multiple containers. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[List[Container] | Container] = Field(default_factory=dict) name: str = Field(...) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Data.model_rebuild() -Container.model_rebuild() -SimpleMultiContainer.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_sparse.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_sparse.py index 087f4d4..8e32624 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_sparse.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_sparse.py @@ -35,13 +35,6 @@ version = "1.8.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class CSRMatrix(Container): """ A compressed sparse row matrix. Data are stored in the standard CSR format, where column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]]. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) shape: Optional[int] = Field( None, @@ -87,8 +73,3 @@ class CSRMatrix(Container): data: NDArray[Shape["* number_of_non_zero_values"], Any] = Field( ..., description="""The non-zero values in the matrix.""" ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -CSRMatrix.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_table.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_table.py index 17c69b1..6229638 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_table.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/hdmf_common_table.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from .hdmf_common_base import Container, Data +from .hdmf_common_base import Data, Container metamodel_version = "None" @@ -35,13 +35,6 @@ version = "1.8.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class VectorData(Data): """ An n-dimensional dataset representing a column of a DynamicTable. If used without an accompanying VectorIndex, first dimension is along the rows of the DynamicTable and each step along the first dimension is a cell of the larger table. VectorData can also be used to represent a ragged array if paired with a VectorIndex. This allows for storing arrays of varying length in a single cell of the DynamicTable by indexing into this VectorData. The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]], and so on. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) description: Optional[str] = Field( None, description="""Description of what these vectors represent.""" @@ -92,7 +78,6 @@ class VectorIndex(VectorData): Used with VectorData to encode a ragged array. An array of indices into the first dimension of the target VectorData, and forming a map between the rows of a DynamicTable and the indices of the VectorData. The name of the VectorIndex is expected to be the name of the target VectorData object followed by \"_index\". """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) target: Optional[str] = Field( None, @@ -116,7 +101,6 @@ class ElementIdentifiers(Data): A list of unique identifiers for values within a dataset, e.g. rows of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field("element_id") @@ -125,7 +109,6 @@ class DynamicTableRegion(VectorData): DynamicTableRegion provides a link from one table to an index or region of another. The `table` attribute is a link to another `DynamicTable`, indicating which table is referenced, and the data is int(s) indicating the row(s) (0-indexed) of the target array. `DynamicTableRegion`s can be used to associate rows with repeated meta-data without data duplication. They can also be used to create hierarchical relationships between multiple `DynamicTable`s. `DynamicTableRegion` objects may be paired with a `VectorIndex` object to create ragged references, so a single cell of a `DynamicTable` can reference many rows of another `DynamicTable`. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) table: Optional[str] = Field( None, @@ -149,7 +132,6 @@ class DynamicTable(Container): A group containing multiple datasets that are aligned on the first dimension (Currently, this requirement if left up to APIs to check and enforce). These datasets represent different columns in the table. Apart from a column that contains unique identifiers for each row, there are no other required datasets. Users are free to add any number of custom VectorData objects (columns) here. DynamicTable also supports ragged array columns, where each element can be of a different size. To add a ragged array column, use a VectorIndex type to index the corresponding VectorData type. See documentation for VectorData and VectorIndex for more details. Unlike a compound data type, which is analogous to storing an array-of-structs, a DynamicTable can be thought of as a struct-of-arrays. This provides an alternative structure to choose from when optimizing storage for anticipated access patterns. Additionally, this type provides a way of creating a table without having to define a compound type up front. Although this convenience may be attractive, users should think carefully about how data will be accessed. DynamicTable is more appropriate for column-centric access, whereas a dataset with a compound type would be more appropriate for row-centric access. Finally, data size should also be taken into account. For small tables, performance loss may be an acceptable trade-off for the flexibility of a DynamicTable. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) colnames: Optional[str] = Field( None, @@ -173,7 +155,6 @@ class AlignedDynamicTable(DynamicTable): DynamicTable container that supports storing a collection of sub-tables. Each sub-table is a DynamicTable itself that is aligned with the main table by row index. I.e., all DynamicTables stored in this group MUST have the same number of rows. This type effectively defines a 2-level table in which the main data is stored in the main table implemented by this type and additional columns of the table are grouped into categories, with each category being represented by a separate DynamicTable stored within the group. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) children: Optional[ List[Union[BaseModel, DynamicTable]] | Union[BaseModel, DynamicTable] ] = Field(default_factory=dict) @@ -193,13 +174,3 @@ class AlignedDynamicTable(DynamicTable): default_factory=list, description="""Vector columns, including index columns, of this dynamic table.""", ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -VectorData.model_rebuild() -VectorIndex.model_rebuild() -ElementIdentifiers.model_rebuild() -DynamicTableRegion.model_rebuild() -DynamicTable.model_rebuild() -AlignedDynamicTable.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/namespace.py index 8d19caa..dcf877b 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_common/v1_8_0/namespace.py @@ -46,13 +46,6 @@ version = "1.8.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -70,13 +63,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_experimental.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_experimental.py index 9fd6763..ac0fea3 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_experimental.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_experimental.py @@ -35,13 +35,6 @@ version = "0.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class EnumData(VectorData): """ Data that come from a fixed set of values. A data value of i corresponds to the i-th value in the VectorData referenced by the 'elements' attribute. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) elements: Optional[str] = Field( None, @@ -89,8 +75,3 @@ class EnumData(VectorData): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -EnumData.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_resources.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_resources.py index c96ff47..45b4971 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_resources.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/hdmf_experimental_resources.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_5_0.hdmf_common_base import Container, Data +from ...hdmf_common.v1_5_0.hdmf_common_base import Data, Container metamodel_version = "None" @@ -35,13 +35,6 @@ version = "0.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class ExternalResources(Container): """ A set of four tables for tracking external resource references in a file. NOTE: this data type is in beta testing and is subject to change in a later version. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) keys: str = Field( ..., @@ -100,7 +86,6 @@ class ExternalResourcesKeys(Data): A table for storing user terms that are used to refer to external resources. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["keys"] = Field("keys") key: str = Field( ..., @@ -113,7 +98,6 @@ class ExternalResourcesEntities(Data): A table for mapping user terms (i.e., keys) to resource entities. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["entities"] = Field("entities") keys_idx: int = Field( ..., description="""The index to the key in the 'keys' table.""" @@ -133,7 +117,6 @@ class ExternalResourcesResources(Data): A table for mapping user terms (i.e., keys) to resource entities. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["resources"] = Field("resources") resource: str = Field(..., description="""The name of the resource.""") resource_uri: str = Field( @@ -146,7 +129,6 @@ class ExternalResourcesObjects(Data): A table for identifying which objects in a file contain references to external resources. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["objects"] = Field("objects") object_id: str = Field(..., description="""The UUID for the object.""") field: str = Field( @@ -160,7 +142,6 @@ class ExternalResourcesObjectKeys(Data): A table for identifying which objects use which keys. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["object_keys"] = Field("object_keys") objects_idx: int = Field( ..., @@ -169,13 +150,3 @@ class ExternalResourcesObjectKeys(Data): keys_idx: int = Field( ..., description="""The index to the 'keys' table for the key.""" ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -ExternalResources.model_rebuild() -ExternalResourcesKeys.model_rebuild() -ExternalResourcesEntities.model_rebuild() -ExternalResourcesResources.model_rebuild() -ExternalResourcesObjects.model_rebuild() -ExternalResourcesObjectKeys.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/namespace.py index 5e5bd7a..21016da 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_1_0/namespace.py @@ -57,13 +57,6 @@ version = "0.1.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -81,13 +74,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_experimental.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_experimental.py index 6cd3614..359cdb8 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_experimental.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_experimental.py @@ -35,13 +35,6 @@ version = "0.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class EnumData(VectorData): """ Data that come from a fixed set of values. A data value of i corresponds to the i-th value in the VectorData referenced by the 'elements' attribute. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) elements: Optional[str] = Field( None, @@ -89,8 +75,3 @@ class EnumData(VectorData): NDArray[Shape["* dim0, * dim1, * dim2, * dim3"], Any], ] ] = Field(None) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -EnumData.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_nwb_language.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_nwb_language.py index 9f13c86..92afa3c 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_nwb_language.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_nwb_language.py @@ -32,13 +32,6 @@ version = "None" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -56,13 +49,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_resources.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_resources.py index ed2437d..cd4f619 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_resources.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/hdmf_experimental_resources.py @@ -27,7 +27,7 @@ if TYPE_CHECKING: import numpy as np -from ...hdmf_common.v1_8_0.hdmf_common_base import Container, Data +from ...hdmf_common.v1_8_0.hdmf_common_base import Data, Container metamodel_version = "None" @@ -35,13 +35,6 @@ version = "0.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -61,18 +54,11 @@ class ConfiguredBaseModel(BaseModel): super().__setitem__(i, value) -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - class HERD(Container): """ HDMF External Resources Data Structure. A set of six tables for tracking external resource references in a file or across multiple files. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(tree_root=True), frozen=True) name: str = Field(...) keys: str = Field( ..., @@ -103,7 +89,6 @@ class HERDKeys(Data): A table for storing user terms that are used to refer to external resources. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["keys"] = Field("keys") key: str = Field( ..., @@ -116,7 +101,6 @@ class HERDFiles(Data): A table for storing object ids of files used in external resources. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["files"] = Field("files") file_object_id: str = Field( ..., @@ -129,7 +113,6 @@ class HERDEntities(Data): A table for mapping user terms (i.e., keys) to resource entities. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["entities"] = Field("entities") entity_id: str = Field( ..., @@ -146,7 +129,6 @@ class HERDObjects(Data): A table for identifying which objects in a file contain references to external resources. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["objects"] = Field("objects") files_idx: int = Field( ..., @@ -169,7 +151,6 @@ class HERDObjectKeys(Data): A table for identifying which objects use which keys. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["object_keys"] = Field("object_keys") objects_idx: int = Field( ..., @@ -185,7 +166,6 @@ class HERDEntityKeys(Data): A table for identifying which keys use which entity. """ - linkml_meta: ClassVar[LinkML_Meta] = Field(LinkML_Meta(), frozen=True) name: Literal["entity_keys"] = Field("entity_keys") entities_idx: int = Field( ..., description="""The row index to the entity in the `entities` table.""" @@ -193,14 +173,3 @@ class HERDEntityKeys(Data): keys_idx: int = Field( ..., description="""The row index to the key in the `keys` table.""" ) - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -HERD.model_rebuild() -HERDKeys.model_rebuild() -HERDFiles.model_rebuild() -HERDEntities.model_rebuild() -HERDObjects.model_rebuild() -HERDObjectKeys.model_rebuild() -HERDEntityKeys.model_rebuild() diff --git a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/namespace.py b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/namespace.py index b0570ab..5ca04d2 100644 --- a/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/namespace.py +++ b/nwb_linkml/src/nwb_linkml/models/pydantic/hdmf_experimental/v0_5_0/namespace.py @@ -58,13 +58,6 @@ version = "0.5.0" class ConfiguredBaseModel(BaseModel): - model_config = ConfigDict( - validate_assignment=True, - validate_default=True, - extra="allow", - arbitrary_types_allowed=True, - use_enum_values=True, - ) hdf5_path: Optional[str] = Field( None, description="The absolute path that this object is stored in an NWB file" ) @@ -82,13 +75,3 @@ class ConfiguredBaseModel(BaseModel): self.array[i] = value else: super().__setitem__(i, value) - - -class LinkML_Meta(BaseModel): - """Extra LinkML Metadata stored as a class attribute""" - - tree_root: bool = False - - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model diff --git a/nwb_linkml/src/nwb_linkml/providers/git.py b/nwb_linkml/src/nwb_linkml/providers/git.py index 73525c2..ca16a9c 100644 --- a/nwb_linkml/src/nwb_linkml/providers/git.py +++ b/nwb_linkml/src/nwb_linkml/providers/git.py @@ -7,7 +7,7 @@ import subprocess import tempfile import warnings from pathlib import Path -from typing import List, Optional +from typing import List, Optional, Union from pydantic import BaseModel, DirectoryPath, Field, HttpUrl @@ -25,7 +25,7 @@ class NamespaceRepo(BaseModel): " within a namespaces NWB list)" ) ) - repository: HttpUrl | DirectoryPath = Field( + repository: Union[HttpUrl, DirectoryPath] = Field( description="URL or local absolute path to the root repository" ) path: Path = Field(description="Relative path from the repository root to the namespace file") diff --git a/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py b/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py index d699555..e994608 100644 --- a/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py +++ b/nwb_schema_language/src/nwb_schema_language/datamodel/nwb_schema_pydantic.py @@ -15,14 +15,7 @@ metamodel_version = "None" version = "None" -class ConfiguredBaseModel( - BaseModel, - validate_assignment=True, - validate_default=True, - extra="forbid", - arbitrary_types_allowed=True, - use_enum_values=True, -): +class ConfiguredBaseModel(BaseModel): pass @@ -273,18 +266,3 @@ class Dataset(DtypeMixin): default_factory=list ) - -# Model rebuild -# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model -Namespace.model_rebuild() -Namespaces.model_rebuild() -Schema.model_rebuild() -Group.model_rebuild() -Groups.model_rebuild() -Link.model_rebuild() -Datasets.model_rebuild() -ReferenceDtype.model_rebuild() -CompoundDtype.model_rebuild() -DtypeMixin.model_rebuild() -Attribute.model_rebuild() -Dataset.model_rebuild() diff --git a/scripts/generate_core.py b/scripts/generate_core.py index de270b3..3efbd76 100644 --- a/scripts/generate_core.py +++ b/scripts/generate_core.py @@ -75,82 +75,83 @@ def generate_versions(yaml_path:Path, pydantic_path:Path, dry_run:bool=False): ) panel = Panel(Group(build_progress, overall_progress)) + try: + with Live(panel) as live: + # make pbar tasks + linkml_task = None + pydantic_task = None - with Live(panel) as live: - # make pbar tasks - linkml_task = None - pydantic_task = None + for version in NWB_CORE_REPO.versions: + # build linkml + try: + # check out the version (this should also refresh the hdmf-common schema) + linkml_task = build_progress.add_task('', name=version, action='Checkout Version', total=3) + repo.tag = version + build_progress.update(linkml_task, advance=1, action="Load Namespaces") - for version in NWB_CORE_REPO.versions: - # build linkml - try: - # check out the version (this should also refresh the hdmf-common schema) - linkml_task = build_progress.add_task('', name=version, action='Checkout Version', total=3) - repo.tag = version - build_progress.update(linkml_task, advance=1, action="Load Namespaces") - - # first load the core namespace - core_ns = io.load_namespace_adapter(repo.namespace_file) - # then the hdmf-common namespace - hdmf_common_ns = io.load_namespace_adapter(repo.temp_directory / 'hdmf-common-schema' / 'common' / 'namespace.yaml') - core_ns.imported.append(hdmf_common_ns) - build_progress.update(linkml_task, advance=1, action="Build LinkML") + # first load the core namespace + core_ns = io.load_namespace_adapter(repo.namespace_file) + # then the hdmf-common namespace + hdmf_common_ns = io.load_namespace_adapter(repo.temp_directory / 'hdmf-common-schema' / 'common' / 'namespace.yaml') + core_ns.imported.append(hdmf_common_ns) + build_progress.update(linkml_task, advance=1, action="Build LinkML") - linkml_res = linkml_provider.build(core_ns) - build_progress.update(linkml_task, advance=1, action="Built LinkML") + linkml_res = linkml_provider.build(core_ns) + build_progress.update(linkml_task, advance=1, action="Built LinkML") - # build pydantic - ns_files = [res['namespace'] for res in linkml_res.values()] - all_schema = [] - for ns_file in ns_files: - all_schema.extend(list(ns_file.parent.glob('*.yaml'))) + # build pydantic + ns_files = [res['namespace'] for res in linkml_res.values()] + all_schema = [] + for ns_file in ns_files: + all_schema.extend(list(ns_file.parent.glob('*.yaml'))) - pydantic_task = build_progress.add_task('', name=version, action='', total=len(all_schema)) - for schema in all_schema: - pbar_string = ' - '.join([schema.parts[-3], schema.parts[-2], schema.parts[-1]]) - build_progress.update(pydantic_task, action=pbar_string) - pydantic_provider.build(schema, versions=core_ns.versions, split=True) - build_progress.update(pydantic_task, advance=1) - build_progress.update(pydantic_task, action='Built Pydantic') + pydantic_task = build_progress.add_task('', name=version, action='', total=len(all_schema)) + for schema in all_schema: + pbar_string = ' - '.join([schema.parts[-3], schema.parts[-2], schema.parts[-1]]) + build_progress.update(pydantic_task, action=pbar_string) + pydantic_provider.build(schema, versions=core_ns.versions, split=True) + build_progress.update(pydantic_task, advance=1) + build_progress.update(pydantic_task, action='Built Pydantic') - except Exception as e: - build_progress.stop_task(linkml_task) - if linkml_task is not None: - build_progress.update(linkml_task, action='[bold red]LinkML Build Failed') + except Exception as e: build_progress.stop_task(linkml_task) - if pydantic_task is not None: - build_progress.update(pydantic_task, action='[bold red]LinkML Build Failed') - build_progress.stop_task(pydantic_task) - failed_versions[version] = traceback.format_exception(e) + if linkml_task is not None: + build_progress.update(linkml_task, action='[bold red]LinkML Build Failed') + build_progress.stop_task(linkml_task) + if pydantic_task is not None: + build_progress.update(pydantic_task, action='[bold red]LinkML Build Failed') + build_progress.stop_task(pydantic_task) + failed_versions[version] = traceback.format_exception(e) - finally: - overall_progress.update(overall_task, advance=1) - linkml_task = None - pydantic_task = None + finally: + overall_progress.update(overall_task, advance=1) + linkml_task = None + pydantic_task = None - if not dry_run: - shutil.rmtree(yaml_path / 'linkml') - shutil.rmtree(pydantic_path / 'pydantic') - shutil.move(tmp_dir / 'linkml', yaml_path) - shutil.move(tmp_dir / 'pydantic', pydantic_path) + if not dry_run: + shutil.rmtree(yaml_path / 'linkml') + shutil.rmtree(pydantic_path / 'pydantic') + shutil.move(tmp_dir / 'linkml', yaml_path) + shutil.move(tmp_dir / 'pydantic', pydantic_path) - # import the most recent version of the schemaz we built - latest_version = sorted((pydantic_path / 'pydantic' / 'core').iterdir(), key=os.path.getmtime)[-1] + # import the most recent version of the schemaz we built + latest_version = sorted((pydantic_path / 'pydantic' / 'core').iterdir(), key=os.path.getmtime)[-1] - # make inits to use the schema! we don't usually do this in the - # provider class because we directly import the files there. - with open(pydantic_path / 'pydantic' / '__init__.py', 'w') as initfile: - initfile.write(' ') + # make inits to use the schema! we don't usually do this in the + # provider class because we directly import the files there. + with open(pydantic_path / 'pydantic' / '__init__.py', 'w') as initfile: + initfile.write(' ') - with open(pydantic_path / '__init__.py', 'w') as initfile: - initfile.write(f'from .pydantic.core.{latest_version.name}.namespace import *') + with open(pydantic_path / '__init__.py', 'w') as initfile: + initfile.write(f'from .pydantic.core.{latest_version.name}.namespace import *') - if len(failed_versions) > 0: - print('Failed Building Versions:') - print(failed_versions) + finally: + if len(failed_versions) > 0: + print('Failed Building Versions:') + print(failed_versions)