From c72b2dce6f365068a369312f434a4ffc1d509177 Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Mon, 18 Nov 2024 13:06:40 -0500 Subject: [PATCH 1/2] Add `coordinate_space` to `Scene.create` --- python-spec/src/somacore/scene.py | 34 +++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/python-spec/src/somacore/scene.py b/python-spec/src/somacore/scene.py index a849bbf..d93ac42 100644 --- a/python-spec/src/somacore/scene.py +++ b/python-spec/src/somacore/scene.py @@ -1,14 +1,15 @@ """Implementation of the SOMA scene collection for spatial data""" import abc -from typing import Generic, Optional, Sequence, TypeVar, Union +from typing import Any, Generic, Optional, Sequence, TypeVar, Union -from typing_extensions import Final +from typing_extensions import Final, Self from . import _mixin from . import base from . import collection from . import coordinates +from . import options from . import spatial _MultiscaleImage = TypeVar("_MultiscaleImage", bound=spatial.MultiscaleImage) @@ -90,6 +91,35 @@ class Scene( Lifecycle: experimental """ + @classmethod + @abc.abstractmethod + def create( + cls, + uri: str, + *, + coordinate_space: Optional[ + Union[Sequence[str], coordinates.CoordinateSpace] + ] = None, + platform_config: Optional[options.PlatformConfig] = None, + context: Optional[Any] = None, + ) -> Self: + """Creates a new collection of this type at the given URI. + + Args: + uri: The URI where the collection will be created. + coordinate_space: Optional coordinate space or the axis names for the + coordinate space the scene is defined on. Defaults to ``None``. + platform_config: platform-specific configuration; keys are SOMA + implementation names. + context: Other implementation-specific configuration. + + Returns: + The newly created collection, opened for writing. + + Lifecycle: experimental + """ + raise NotImplementedError() + @property @abc.abstractmethod def coordinate_space(self) -> Optional[coordinates.CoordinateSpace]: From 2608b1efdff0ad3e341291d1291dff7873a7852c Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Mon, 18 Nov 2024 14:07:56 -0500 Subject: [PATCH 2/2] Update Scene.create docstrings --- python-spec/src/somacore/scene.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python-spec/src/somacore/scene.py b/python-spec/src/somacore/scene.py index d93ac42..3a81e57 100644 --- a/python-spec/src/somacore/scene.py +++ b/python-spec/src/somacore/scene.py @@ -103,12 +103,13 @@ def create( platform_config: Optional[options.PlatformConfig] = None, context: Optional[Any] = None, ) -> Self: - """Creates a new collection of this type at the given URI. + """Creates a new scene at the given URI. Args: uri: The URI where the collection will be created. coordinate_space: Optional coordinate space or the axis names for the - coordinate space the scene is defined on. Defaults to ``None``. + coordinate space the scene is defined on. If ``None`` no coordinate + system will be set at this time. Defaults to ``None``. platform_config: platform-specific configuration; keys are SOMA implementation names. context: Other implementation-specific configuration.