_contourpy.pyi 6.9 KB

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