_contourpy.pyi 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. from __future__ import annotations
  2. from typing import ClassVar, NoReturn
  3. import numpy as np
  4. import numpy.typing as npt
  5. from typing_extensions import TypeAlias
  6. import contourpy._contourpy as cpy
  7. # Input numpy array types, the same as in common.h
  8. CoordinateArray: TypeAlias = npt.NDArray[np.float64]
  9. MaskArray: TypeAlias = npt.NDArray[np.bool_]
  10. # Output numpy array types, the same as in common.h
  11. PointArray: TypeAlias = npt.NDArray[np.float64]
  12. CodeArray: TypeAlias = npt.NDArray[np.uint8]
  13. OffsetArray: TypeAlias = npt.NDArray[np.uint32]
  14. # Types returned from filled()
  15. FillReturn_OuterCode: TypeAlias = tuple[list[PointArray], list[CodeArray]]
  16. FillReturn_OuterOffset: TypeAlias = tuple[list[PointArray], list[OffsetArray]]
  17. FillReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]]
  18. FillReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]]
  19. FillReturn_ChunkCombinedCodeOffset: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None], list[OffsetArray | None]]
  20. FillReturn_ChunkCombinedOffsetOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None], list[OffsetArray | None]]
  21. FillReturn: TypeAlias = FillReturn_OuterCode | FillReturn_OuterOffset | FillReturn_ChunkCombinedCode | FillReturn_ChunkCombinedOffset | FillReturn_ChunkCombinedCodeOffset | FillReturn_ChunkCombinedOffsetOffset
  22. # Types returned from lines()
  23. LineReturn_Separate: TypeAlias = list[PointArray]
  24. LineReturn_SeparateCode: TypeAlias = tuple[list[PointArray], list[CodeArray]]
  25. LineReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]]
  26. LineReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]]
  27. LineReturn: TypeAlias = LineReturn_Separate | LineReturn_SeparateCode | LineReturn_ChunkCombinedCode | LineReturn_ChunkCombinedOffset
  28. NDEBUG: int
  29. __version__: str
  30. class FillType:
  31. ChunkCombinedCode: ClassVar[cpy.FillType]
  32. ChunkCombinedCodeOffset: ClassVar[cpy.FillType]
  33. ChunkCombinedOffset: ClassVar[cpy.FillType]
  34. ChunkCombinedOffsetOffset: ClassVar[cpy.FillType]
  35. OuterCode: ClassVar[cpy.FillType]
  36. OuterOffset: ClassVar[cpy.FillType]
  37. __members__: ClassVar[dict[str, cpy.FillType]]
  38. def __eq__(self, other: object) -> bool: ...
  39. def __getstate__(self) -> int: ...
  40. def __hash__(self) -> int: ...
  41. def __index__(self) -> int: ...
  42. def __init__(self, value: int) -> None: ...
  43. def __int__(self) -> int: ...
  44. def __ne__(self, other: object) -> bool: ...
  45. def __repr__(self) -> str: ...
  46. def __setstate__(self, state: int) -> NoReturn: ...
  47. @property
  48. def name(self) -> str: ...
  49. @property
  50. def value(self) -> int: ...
  51. class LineType:
  52. ChunkCombinedCode: ClassVar[cpy.LineType]
  53. ChunkCombinedOffset: ClassVar[cpy.LineType]
  54. Separate: ClassVar[cpy.LineType]
  55. SeparateCode: ClassVar[cpy.LineType]
  56. __members__: ClassVar[dict[str, cpy.LineType]]
  57. def __eq__(self, other: object) -> bool: ...
  58. def __getstate__(self) -> int: ...
  59. def __hash__(self) -> int: ...
  60. def __index__(self) -> int: ...
  61. def __init__(self, value: int) -> None: ...
  62. def __int__(self) -> int: ...
  63. def __ne__(self, other: object) -> bool: ...
  64. def __repr__(self) -> str: ...
  65. def __setstate__(self, state: int) -> NoReturn: ...
  66. @property
  67. def name(self) -> str: ...
  68. @property
  69. def value(self) -> int: ...
  70. class ZInterp:
  71. Linear: ClassVar[cpy.ZInterp]
  72. Log: ClassVar[cpy.ZInterp]
  73. __members__: ClassVar[dict[str, cpy.ZInterp]]
  74. def __eq__(self, other: object) -> bool: ...
  75. def __getstate__(self) -> int: ...
  76. def __hash__(self) -> int: ...
  77. def __index__(self) -> int: ...
  78. def __init__(self, value: int) -> None: ...
  79. def __int__(self) -> int: ...
  80. def __ne__(self, other: object) -> bool: ...
  81. def __repr__(self) -> str: ...
  82. def __setstate__(self, state: int) -> NoReturn: ...
  83. @property
  84. def name(self) -> str: ...
  85. @property
  86. def value(self) -> int: ...
  87. def max_threads() -> int: ...
  88. class ContourGenerator:
  89. def create_contour(self, level: float) -> LineReturn: ...
  90. def create_filled_contour(self, lower_level: float, upper_level: float) -> FillReturn: ...
  91. def filled(self, lower_level: float, upper_level: float) -> FillReturn: ...
  92. def lines(self, level: float) -> LineReturn: ...
  93. @staticmethod
  94. def supports_corner_mask() -> bool: ...
  95. @staticmethod
  96. def supports_fill_type(fill_type: FillType) -> bool: ...
  97. @staticmethod
  98. def supports_line_type(line_type: LineType) -> bool: ...
  99. @staticmethod
  100. def supports_quad_as_tri() -> bool: ...
  101. @staticmethod
  102. def supports_threads() -> bool: ...
  103. @staticmethod
  104. def supports_z_interp() -> bool: ...
  105. @property
  106. def chunk_count(self) -> tuple[int, int]: ...
  107. @property
  108. def chunk_size(self) -> tuple[int, int]: ...
  109. @property
  110. def corner_mask(self) -> bool: ...
  111. @property
  112. def fill_type(self) -> FillType: ...
  113. @property
  114. def line_type(self) -> LineType: ...
  115. @property
  116. def quad_as_tri(self) -> bool: ...
  117. @property
  118. def thread_count(self) -> int: ...
  119. @property
  120. def z_interp(self) -> ZInterp: ...
  121. default_fill_type: cpy.FillType
  122. default_line_type: cpy.LineType
  123. class Mpl2005ContourGenerator(ContourGenerator):
  124. def __init__(
  125. self,
  126. x: CoordinateArray,
  127. y: CoordinateArray,
  128. z: CoordinateArray,
  129. mask: MaskArray,
  130. *,
  131. x_chunk_size: int = 0,
  132. y_chunk_size: int = 0,
  133. ) -> None: ...
  134. class Mpl2014ContourGenerator(ContourGenerator):
  135. def __init__(
  136. self,
  137. x: CoordinateArray,
  138. y: CoordinateArray,
  139. z: CoordinateArray,
  140. mask: MaskArray,
  141. *,
  142. corner_mask: bool,
  143. x_chunk_size: int = 0,
  144. y_chunk_size: int = 0,
  145. ) -> None: ...
  146. class SerialContourGenerator(ContourGenerator):
  147. def __init__(
  148. self,
  149. x: CoordinateArray,
  150. y: CoordinateArray,
  151. z: CoordinateArray,
  152. mask: MaskArray,
  153. *,
  154. corner_mask: bool,
  155. line_type: LineType,
  156. fill_type: FillType,
  157. quad_as_tri: bool,
  158. z_interp: ZInterp,
  159. x_chunk_size: int = 0,
  160. y_chunk_size: int = 0,
  161. ) -> None: ...
  162. def _write_cache(self) -> NoReturn: ...
  163. class ThreadedContourGenerator(ContourGenerator):
  164. def __init__(
  165. self,
  166. x: CoordinateArray,
  167. y: CoordinateArray,
  168. z: CoordinateArray,
  169. mask: MaskArray,
  170. *,
  171. corner_mask: bool,
  172. line_type: LineType,
  173. fill_type: FillType,
  174. quad_as_tri: bool,
  175. z_interp: ZInterp,
  176. x_chunk_size: int = 0,
  177. y_chunk_size: int = 0,
  178. thread_count: int = 0,
  179. ) -> None: ...
  180. def _write_cache(self) -> None: ...