mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-14 10:44:28 +00:00
omfg working serialization (with forthcoming updates to numpydantic)
This commit is contained in:
parent
4672f54630
commit
af53ee1ea9
2 changed files with 10 additions and 4 deletions
|
@ -73,8 +73,14 @@ def test_nwbfile_dump(read_nwbfile):
|
||||||
electrodes = read_nwbfile.general.extracellular_ephys.electrodes.model_dump_json(
|
electrodes = read_nwbfile.general.extracellular_ephys.electrodes.model_dump_json(
|
||||||
round_trip=True
|
round_trip=True
|
||||||
)
|
)
|
||||||
|
data = read_nwbfile.general.model_dump_json(round_trip=True)
|
||||||
|
|
||||||
|
file = read_nwbfile.model_dump_json(
|
||||||
|
round_trip=True, exclude_none=True, exclude_unset=True, exclude_defaults=True
|
||||||
|
)
|
||||||
|
|
||||||
# data = read_nwbfile.model_dump_json(round_trip=True, serialize_as_any=True)
|
# data = read_nwbfile.model_dump_json(round_trip=True, serialize_as_any=True)
|
||||||
# pdb.set_trace()
|
pdb.set_trace()
|
||||||
|
|
||||||
|
|
||||||
def test_timeseries(read_nwbfile, read_pynwb):
|
def test_timeseries(read_nwbfile, read_pynwb):
|
||||||
|
|
|
@ -17,10 +17,10 @@ from typing import (
|
||||||
Optional,
|
Optional,
|
||||||
Tuple,
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
TypeVar,
|
|
||||||
Union,
|
Union,
|
||||||
overload,
|
overload,
|
||||||
)
|
)
|
||||||
|
from typing_extensions import TypeVar
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpydantic import NDArray, Shape
|
from numpydantic import NDArray, Shape
|
||||||
|
@ -154,7 +154,7 @@ class LinkMLMeta(RootModel):
|
||||||
|
|
||||||
NUMPYDANTIC_VERSION = "1.2.1"
|
NUMPYDANTIC_VERSION = "1.2.1"
|
||||||
|
|
||||||
T = TypeVar("T", bound=NDArray)
|
T = TypeVar("T", default=NDArray)
|
||||||
|
|
||||||
|
|
||||||
class VectorDataMixin(ConfiguredBaseModel, Generic[T]):
|
class VectorDataMixin(ConfiguredBaseModel, Generic[T]):
|
||||||
|
@ -364,7 +364,7 @@ class TimeSeriesReferenceVectorData(TimeSeriesReferenceVectorDataMixin, VectorDa
|
||||||
description="""Number of data samples available in this time series, during this epoch""",
|
description="""Number of data samples available in this time series, during this epoch""",
|
||||||
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},
|
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},
|
||||||
)
|
)
|
||||||
timeseries: NDArray[Shape["*"], TimeSeries] = Field(
|
timeseries: List[TimeSeries] = Field(
|
||||||
...,
|
...,
|
||||||
description="""The TimeSeries that this index applies to""",
|
description="""The TimeSeries that this index applies to""",
|
||||||
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},
|
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},
|
||||||
|
|
Loading…
Reference in a new issue