Skip to content

Commit

Permalink
in progress (will fail tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishavlin committed Jun 26, 2023
1 parent 0eb1719 commit 5083d62
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 3 deletions.
25 changes: 24 additions & 1 deletion src/yt_napari/_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,34 @@ class SelectionObject(BaseModel):
)


class ytWidth(BaseModel):
value: float = Field(None, description="The value for the width.")
unit: str = Field("code_length", description="The length unit of the width value.")


class Slice(BaseModel):
fields: List[ytField] = Field(
None, description="list of fields to load for this selection"
)
normal: Union[int, str] = Field(None, description="the normal axis of the slice")
center: Optional[Tuple[float, float, float]] = Field(
None, description="The center point of the slice"
)
width: Optional[ytWidth] = Field(
None, description="The slice width, defaults to full domain"
)
resolution: Optional[Tuple[int, int]] = Field(
(400, 400),
description="the resolution at which to sample the slice",
)


class DataContainer(BaseModel):
filename: str = Field(None, description="the filename for the dataset")
selections: List[SelectionObject] = Field(
None, description="list of selections to load in this dataset"
None, description="list of 3D selections to load in this dataset"
)
slices: List[Slice] = Field(None, description="list of 2D slices to load.")
edge_units: Optional[str] = Field(
"code_length",
description="the units to use for left_edge and right_edge in the selections",
Expand Down
101 changes: 99 additions & 2 deletions src/yt_napari/schemas/yt-napari_0.0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,95 @@
}
}
},
"ytWidth": {
"title": "ytWidth",
"type": "object",
"properties": {
"value": {
"title": "Value",
"description": "The value for the width.",
"type": "number"
},
"unit": {
"title": "Unit",
"description": "The length unit of the width value.",
"default": "code_length",
"type": "string"
}
}
},
"Slice": {
"title": "Slice",
"type": "object",
"properties": {
"fields": {
"title": "Fields",
"description": "list of fields to load for this selection",
"type": "array",
"items": {
"$ref": "#/definitions/ytField"
}
},
"normal": {
"title": "Normal",
"description": "the normal axis of the slice",
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"center": {
"title": "Center",
"description": "The center point of the slice",
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "number"
}
]
},
"width": {
"title": "Width",
"description": "The slice width, defaults to full domain",
"allOf": [
{
"$ref": "#/definitions/ytWidth"
}
]
},
"resolution": {
"title": "Resolution",
"description": "the resolution at which to sample the slice",
"default": [
400,
400
],
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "integer"
},
{
"type": "integer"
}
]
}
}
},
"DataContainer": {
"title": "DataContainer",
"type": "object",
Expand All @@ -128,12 +217,20 @@
},
"selections": {
"title": "Selections",
"description": "list of selections to load in this dataset",
"description": "list of 3D selections to load in this dataset",
"type": "array",
"items": {
"$ref": "#/definitions/SelectionObject"
}
},
"slices": {
"title": "Slices",
"description": "list of 2D slices to load.",
"type": "array",
"items": {
"$ref": "#/definitions/Slice"
}
},
"edge_units": {
"title": "Edge Units",
"description": "the units to use for left_edge and right_edge in the selections",
Expand All @@ -142,7 +239,7 @@
},
"store_in_cache": {
"title": "Store In Cache",
"description": "if enabled, will store references to yt datasets to avoid reloading.",
"description": "if enabled, will store references to yt datasets.",
"default": true,
"type": "boolean"
}
Expand Down

0 comments on commit 5083d62

Please sign in to comment.