Skip to content

Commit

Permalink
✨ Add support for UInt8 arrays in Grid3D and Grid4D classes
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Feb 29, 2024
1 parent 900baae commit caf0896
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 12 deletions.
81 changes: 69 additions & 12 deletions src/pyinterp/core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ from .array import (
Array3DFloat32,
Array3DFloat64,
Array3DInt8,
Array3DUInt8,
Array4DFloat32,
Array4DFloat64,
Array4DInt8,
Array4DUInt8,
ArrayFloat32,
ArrayFloat64,
ArrayInt64,
Expand Down Expand Up @@ -694,9 +696,7 @@ class Grid2DFloat64:

class Grid2DInt8:

def __init__(
self, x: Axis, y: Axis,
array: Array2DInt8) -> None:
def __init__(self, x: Axis, y: Axis, array: Array2DInt8) -> None:
...

def __getstate__(self) -> tuple:
Expand All @@ -706,8 +706,7 @@ class Grid2DInt8:
...

@property
def array(
self) -> Array2DInt8:
def array(self) -> Array2DInt8:
...

@property
Expand All @@ -721,9 +720,7 @@ class Grid2DInt8:

class Grid2DUInt8:

def __init__(
self, x: Axis, y: Axis,
array: Array2DUInt8) -> None:
def __init__(self, x: Axis, y: Axis, array: Array2DUInt8) -> None:
...

def __getstate__(self) -> tuple:
Expand All @@ -733,9 +730,7 @@ class Grid2DUInt8:
...

@property
def array(
self
) -> Array2DUInt8:
def array(self) -> Array2DUInt8:
...

@property
Expand Down Expand Up @@ -833,6 +828,34 @@ class Grid3DInt8:
...


class Grid3DUInt8:

def __init__(self, x: Axis, y: Axis, z: Axis, array: Array3DUInt8) -> None:
...

def __getstate__(self) -> tuple:
...

def __setstate__(self, state: tuple) -> None:
...

@property
def array(self) -> Array3DInt8:
...

@property
def x(self) -> Axis:
...

@property
def y(self) -> Axis:
...

@property
def z(self) -> Axis:
...


class Grid4DFloat32:

def __init__(self, x: Axis, y: Axis, z: Axis, u: Axis,
Expand Down Expand Up @@ -932,6 +955,39 @@ class Grid4DInt8:
...


class Grid4DUInt8:

def __init__(self, x: Axis, y: Axis, z: Axis, u: Axis,
array: Array4DUInt8) -> None:
...

def __getstate__(self) -> tuple:
...

def __setstate__(self, state: tuple) -> None:
...

@property
def array(self) -> Array4DUInt8:
...

@property
def u(self) -> Axis:
...

@property
def x(self) -> Axis:
...

@property
def y(self) -> Axis:
...

@property
def z(self) -> Axis:
...


class Histogram2DFloat32:

def __init__(self, x: Axis, y: Axis, bins: Optional[int] = ...) -> None:
Expand Down Expand Up @@ -1175,7 +1231,8 @@ Array1DPeriod = numpy.ndarray[

class PeriodList:

def __init__(self, periods: Array1DPeriod) -> None: # type: ignore[type-var]
def __init__(self,
periods: Array1DPeriod) -> None: # type: ignore[type-var]
...

def are_periods_sorted_and_disjointed(self) -> bool:
Expand Down
2 changes: 2 additions & 0 deletions src/pyinterp/core/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ Array2DUInt8 = numpy.ndarray[_2D, numpy.dtype[numpy.uint8]]
Array3DFloat32 = numpy.ndarray[_3D, numpy.dtype[numpy.float32]]
Array3DFloat64 = numpy.ndarray[_3D, numpy.dtype[numpy.float64]]
Array3DInt8 = numpy.ndarray[_3D, numpy.dtype[numpy.int8]]
Array3DUInt8 = numpy.ndarray[_3D, numpy.dtype[numpy.uint8]]
Array4DFloat32 = numpy.ndarray[_4D, numpy.dtype[numpy.float32]]
Array4DFloat64 = numpy.ndarray[_4D, numpy.dtype[numpy.float64]]
Array4DInt8 = numpy.ndarray[_4D, numpy.dtype[numpy.int8]]
Array4DUInt8 = numpy.ndarray[_4D, numpy.dtype[numpy.uint8]]
ArrayFloat32 = numpy.ndarray[Any, numpy.dtype[numpy.float32]]
ArrayFloat64 = numpy.ndarray[Any, numpy.dtype[numpy.float64]]
ArrayInt64 = numpy.ndarray[Any, numpy.dtype[numpy.int64]]
Expand Down

0 comments on commit caf0896

Please sign in to comment.