Skip to content

Commit

Permalink
MNT: rename indx_data_type to coord_data_type
Browse files Browse the repository at this point in the history
  • Loading branch information
genematx committed Oct 23, 2024
1 parent 3256dcc commit c76e4be
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Write the date in place of the "Unreleased" in the case a new version is release

### Added

- `data_type` and `indx_data_type` properties for sparse arrays in `COOAdapter` and `COOStructure`.
- `data_type` and `coord_data_type` properties for sparse arrays in `COOAdapter` and `COOStructure`.

## v0.1.0b10 (2024-10-11)

Expand Down
4 changes: 2 additions & 2 deletions tiled/adapters/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def from_arrays(
shape=shape,
chunks=tuple((dim,) for dim in shape),
data_type=BuiltinDtype.from_numpy_dtype(data.dtype),
indx_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
coord_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
resizable=False,
)
return cls(
Expand Down Expand Up @@ -137,7 +137,7 @@ def from_global_ref(
shape=shape,
chunks=chunks,
data_type=BuiltinDtype.from_numpy_dtype(data.dtype),
indx_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
coord_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
resizable=False,
)
return cls(
Expand Down
2 changes: 1 addition & 1 deletion tiled/client/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def write_sparse(
chunks=tuple((dim,) for dim in shape),
dims=dims,
data_type=BuiltinDtype.from_numpy_dtype(data.dtype),
indx_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
coord_data_type=BuiltinDtype.from_numpy_dtype(coords.dtype),
)
client = self.new(
StructureFamily.sparse,
Expand Down
2 changes: 1 addition & 1 deletion tiled/server/pydantic_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class COOStructure(pydantic.BaseModel):
shape: Tuple[int, ...] # tuple of ints like (3, 3)
chunks: Tuple[Tuple[int, ...], ...] # tuple-of-tuples-of-ints like ((3,), (3,))
data_type: Optional[Union[BuiltinDtype, StructDtype]] = None
indx_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
coord_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
dims: Optional[Tuple[str, ...]] = None # None or tuple of names like ("x", "y")
resizable: Union[bool, Tuple[bool, ...]] = False
layout: SparseLayout = SparseLayout.COO
Expand Down
6 changes: 3 additions & 3 deletions tiled/structures/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class COOStructure:
chunks: Tuple[Tuple[int, ...], ...] # tuple-of-tuples-of-ints like ((3,), (3,))
shape: Tuple[int, ...] # tuple of ints like (3, 3)
data_type: Optional[Union[BuiltinDtype, StructDtype]] = None
indx_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
coord_data_type: BuiltinDtype = BuiltinDtype(Endianness("little"), Kind("u"), 8) # numpy 'uint' dtype
dims: Optional[Tuple[str, ...]] = None # None or tuple of names like ("x", "y")
resizable: Union[bool, Tuple[bool, ...]] = False
layout: SparseLayout = SparseLayout.COO
Expand All @@ -29,10 +29,10 @@ def from_json(cls, structure):
data_type = StructDtype.from_json(data_type)
else:
data_type = BuiltinDtype.from_json(data_type)
indx_data_type = structure.get("indx_data_type", {"endianness":"little", "kind":"u", "itemsize":8})
coord_data_type = structure.get("coord_data_type", {"endianness":"little", "kind":"u", "itemsize":8})
return cls(
data_type=data_type,
indx_data_type=BuiltinDtype.from_json(indx_data_type),
coord_data_type=BuiltinDtype.from_json(coord_data_type),
chunks=tuple(map(tuple, structure["chunks"])),
shape=tuple(structure["shape"]),
dims=structure["dims"],
Expand Down

0 comments on commit c76e4be

Please sign in to comment.