mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-12 17:54:29 +00:00
model update
This commit is contained in:
parent
676d42d4f5
commit
cd3d7ca78e
201 changed files with 4394 additions and 881 deletions
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_2_0.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -24,7 +24,12 @@ from ...core.v2_2_0.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_2_0.core_nwb_misc import Units
|
||||
from ...core.v2_2_0.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_2_0.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -35,7 +40,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -54,6 +59,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -505,7 +525,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_2_0.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_2_0.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -897,7 +917,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -84,17 +99,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -107,17 +121,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -130,17 +151,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_2_0.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_1_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -443,7 +459,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -557,7 +573,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -39,7 +39,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -58,6 +58,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +50,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -166,17 +181,16 @@ class RetinotopyImage(GrayscaleImage):
|
|||
)
|
||||
field_of_view: List[float] = Field(..., description="""Size of viewing area, in meters.""")
|
||||
format: str = Field(..., description="""Format of image. Right now only 'raw' is supported.""")
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImagingRetinotopy(NWBDataInterface):
|
||||
|
@ -306,17 +320,16 @@ class ImagingRetinotopyFocalDepthImage(RetinotopyImage):
|
|||
)
|
||||
field_of_view: List[float] = Field(..., description="""Size of viewing area, in meters.""")
|
||||
format: str = Field(..., description="""Format of image. Right now only 'raw' is supported.""")
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
# Model rebuild
|
||||
|
|
|
@ -149,7 +149,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -168,6 +168,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_2_1.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -24,7 +24,12 @@ from ...core.v2_2_1.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_2_1.core_nwb_misc import Units
|
||||
from ...core.v2_2_1.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_2_1.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -35,7 +40,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -54,6 +59,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -505,7 +525,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_2_1.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_2_1.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_2.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -897,7 +917,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -84,17 +99,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -107,17 +121,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -130,17 +151,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_2_1.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_1_2.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -443,7 +459,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -557,7 +573,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -39,7 +39,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -58,6 +58,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,7 +31,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +50,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -166,17 +181,16 @@ class RetinotopyImage(GrayscaleImage):
|
|||
)
|
||||
field_of_view: List[float] = Field(..., description="""Size of viewing area, in meters.""")
|
||||
format: str = Field(..., description="""Format of image. Right now only 'raw' is supported.""")
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImagingRetinotopy(NWBDataInterface):
|
||||
|
@ -306,17 +320,16 @@ class ImagingRetinotopyFocalDepthImage(RetinotopyImage):
|
|||
)
|
||||
field_of_view: List[float] = Field(..., description="""Size of viewing area, in meters.""")
|
||||
format: str = Field(..., description="""Format of image. Right now only 'raw' is supported.""")
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
# Model rebuild
|
||||
|
|
|
@ -149,7 +149,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -168,6 +168,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_2_2.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -24,7 +24,12 @@ from ...core.v2_2_2.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_2_2.core_nwb_misc import Units
|
||||
from ...core.v2_2_2.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_2_2.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -35,7 +40,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -54,6 +59,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -505,7 +525,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_2_2.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_2_2.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -897,7 +917,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -84,17 +99,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -107,17 +121,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -130,17 +151,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_2_2.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -443,7 +459,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -557,7 +573,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -39,7 +39,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -58,6 +58,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -152,7 +152,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -171,6 +171,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_2_4.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -25,7 +25,12 @@ from ...core.v2_2_4.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_2_4.core_nwb_misc import Units
|
||||
from ...core.v2_2_4.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_2_4.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -36,7 +41,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -55,6 +60,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -481,7 +501,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_2_4.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_2_4.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -897,7 +917,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -84,17 +99,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -107,17 +121,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -130,17 +151,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_2_4.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -443,7 +459,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -557,7 +573,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...core.v2_2_4.core_nwb_image import ImageSeries, ImageSeriesExternalFile
|
|||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -373,7 +389,7 @@ class PlaneSegmentation(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -159,7 +159,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -178,6 +178,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_2_5.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -25,7 +25,12 @@ from ...core.v2_2_5.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_2_5.core_nwb_misc import Units
|
||||
from ...core.v2_2_5.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_2_5.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -36,7 +41,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -55,6 +60,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -481,7 +501,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_2_5.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_2_5.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -897,7 +917,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -84,17 +99,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -107,17 +121,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -130,17 +151,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_2_5.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -443,7 +459,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -557,7 +573,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...core.v2_2_5.core_nwb_image import ImageSeries, ImageSeriesExternalFile
|
|||
from ...hdmf_common.v1_1_3.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -375,7 +391,7 @@ class PlaneSegmentation(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -159,7 +159,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -178,6 +178,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -42,6 +42,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_3_0.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -25,7 +25,7 @@ from ...core.v2_3_0.core_nwb_icephys import IntracellularElectrode, SweepTable
|
|||
from ...core.v2_3_0.core_nwb_misc import Units
|
||||
from ...core.v2_3_0.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_3_0.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, ElementIdentifiers, VectorData
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -36,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -55,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -481,7 +496,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -26,7 +26,12 @@ from ...core.v2_3_0.core_nwb_base import (
|
|||
TimeSeriesSync,
|
||||
)
|
||||
from ...core.v2_3_0.core_nwb_device import Device
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -37,7 +42,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +61,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -899,7 +919,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -42,6 +42,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -85,17 +100,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -108,17 +122,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -131,17 +152,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_3_0.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -455,7 +471,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -601,7 +617,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...core.v2_3_0.core_nwb_image import ImageSeries, ImageSeriesExternalFile
|
|||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -384,7 +400,7 @@ class PlaneSegmentation(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -162,7 +162,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -181,6 +181,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -36,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -55,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_4_0.core_nwb_base import TimeSeries
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -168,7 +188,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -33,7 +33,7 @@ from ...core.v2_4_0.core_nwb_icephys import (
|
|||
from ...core.v2_4_0.core_nwb_misc import Units
|
||||
from ...core.v2_4_0.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_4_0.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, ElementIdentifiers, VectorData
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -44,7 +44,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +63,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -489,7 +504,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
|||
AlignedDynamicTable,
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -906,7 +922,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -943,7 +959,7 @@ class IntracellularElectrodesTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -989,7 +1005,7 @@ class IntracellularStimuliTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1035,7 +1051,7 @@ class IntracellularResponsesTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1101,7 +1117,7 @@ class IntracellularRecordingsTable(AlignedDynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1150,7 +1166,7 @@ class SimultaneousRecordingsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1238,7 +1254,7 @@ class SequentialRecordingsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1317,7 +1333,7 @@ class RepetitionsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1398,7 +1414,7 @@ class ExperimentalConditionsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -42,6 +42,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -85,17 +100,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -108,17 +122,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -131,17 +152,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_4_0.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -455,7 +471,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -601,7 +617,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...core.v2_4_0.core_nwb_image import ImageSeries, ImageSeriesExternalFile
|
|||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -384,7 +400,7 @@ class PlaneSegmentation(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -22,7 +22,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -41,6 +41,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -175,7 +175,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -194,6 +194,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -47,7 +47,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -66,6 +66,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -47,6 +47,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -40,6 +40,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -57,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
|
|
@ -20,7 +20,12 @@ from pydantic import (
|
|||
)
|
||||
|
||||
from ...core.v2_5_0.core_nwb_base import TimeSeriesReferenceVectorData
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData, VectorIndex
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -31,7 +36,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -50,6 +55,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -177,7 +197,7 @@ class TimeIntervals(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -34,7 +34,7 @@ from ...core.v2_5_0.core_nwb_icephys import (
|
|||
from ...core.v2_5_0.core_nwb_misc import Units
|
||||
from ...core.v2_5_0.core_nwb_ogen import OptogeneticStimulusSite
|
||||
from ...core.v2_5_0.core_nwb_ophys import ImagingPlane
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, VectorData
|
||||
from ...hdmf_common.v1_5_0.hdmf_common_table import DynamicTable, ElementIdentifiers, VectorData
|
||||
|
||||
|
||||
metamodel_version = "None"
|
||||
|
@ -45,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -64,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -492,7 +507,7 @@ class ExtracellularEphysElectrodes(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -31,6 +31,7 @@ from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
|||
AlignedDynamicTable,
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -44,7 +45,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -63,6 +64,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -907,7 +923,7 @@ class SweepTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -944,7 +960,7 @@ class IntracellularElectrodesTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -990,7 +1006,7 @@ class IntracellularStimuliTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1036,7 +1052,7 @@ class IntracellularResponsesTable(DynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1102,7 +1118,7 @@ class IntracellularRecordingsTable(AlignedDynamicTable):
|
|||
...,
|
||||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1151,7 +1167,7 @@ class SimultaneousRecordingsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1239,7 +1255,7 @@ class SequentialRecordingsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1318,7 +1334,7 @@ class RepetitionsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -1399,7 +1415,7 @@ class ExperimentalConditionsTable(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
|
@ -29,7 +29,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -48,6 +48,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -91,17 +106,16 @@ class GrayscaleImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {"array": {"dimensions": [{"alias": "x"}, {"alias": "y"}]}}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBImage(Image):
|
||||
|
@ -114,17 +128,24 @@ class RGBImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 3 r_g_b"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b", "exact_cardinality": 3},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class RGBAImage(Image):
|
||||
|
@ -137,17 +158,24 @@ class RGBAImage(Image):
|
|||
)
|
||||
|
||||
name: str = Field(...)
|
||||
value: Optional[NDArray[Shape["* x, * y, 4 r_g_b_a"], float]] = Field(
|
||||
None,
|
||||
json_schema_extra={
|
||||
"linkml_meta": {
|
||||
"array": {
|
||||
"dimensions": [
|
||||
{"alias": "x"},
|
||||
{"alias": "y"},
|
||||
{"alias": "r_g_b_a", "exact_cardinality": 4},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
resolution: Optional[float] = Field(
|
||||
None, description="""Pixel resolution of the image, in pixels per centimeter."""
|
||||
)
|
||||
description: Optional[str] = Field(None, description="""Description of the image.""")
|
||||
value: Optional[
|
||||
Union[
|
||||
NDArray[Shape["* x, * y"], float],
|
||||
NDArray[Shape["* x, * y, 3 r_g_b"], float],
|
||||
NDArray[Shape["* x, * y, 4 r_g_b_a"], float],
|
||||
]
|
||||
] = Field(None)
|
||||
|
||||
|
||||
class ImageSeries(TimeSeries):
|
||||
|
|
|
@ -24,6 +24,7 @@ from ...core.v2_5_0.core_nwb_ecephys import ElectrodeGroup
|
|||
from ...hdmf_common.v1_5_0.hdmf_common_table import (
|
||||
DynamicTable,
|
||||
DynamicTableRegion,
|
||||
ElementIdentifiers,
|
||||
VectorData,
|
||||
VectorIndex,
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ class ConfiguredBaseModel(BaseModel):
|
|||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
validate_default=True,
|
||||
extra="forbid",
|
||||
extra="allow",
|
||||
arbitrary_types_allowed=True,
|
||||
use_enum_values=True,
|
||||
strict=False,
|
||||
|
@ -56,6 +57,21 @@ class ConfiguredBaseModel(BaseModel):
|
|||
else:
|
||||
raise KeyError("No value or data field to index from")
|
||||
|
||||
@field_validator("*", mode="wrap")
|
||||
@classmethod
|
||||
def coerce_value(cls, v: Any, handler) -> Any:
|
||||
"""Try to rescue instantiation by using the value field"""
|
||||
try:
|
||||
return handler(v)
|
||||
except Exception as e1:
|
||||
try:
|
||||
if hasattr(v, "value"):
|
||||
return handler(v.value)
|
||||
else:
|
||||
return handler(v["value"])
|
||||
except Exception as e2:
|
||||
raise e2 from e1
|
||||
|
||||
|
||||
class LinkMLMeta(RootModel):
|
||||
root: Dict[str, Any] = {}
|
||||
|
@ -455,7 +471,7 @@ class DecompositionSeriesBands(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
@ -601,7 +617,7 @@ class Units(DynamicTable):
|
|||
description="""The names of the columns in this table. This should be used to specify an order to the columns.""",
|
||||
)
|
||||
description: str = Field(..., description="""Description of what is in this dynamic table.""")
|
||||
id: VectorData[NDArray[Shape["* num_rows"], int]] = Field(
|
||||
id: ElementIdentifiers = Field(
|
||||
...,
|
||||
description="""Array of unique identifiers for the rows of this dynamic table.""",
|
||||
json_schema_extra={"linkml_meta": {"array": {"dimensions": [{"alias": "num_rows"}]}}},
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue