_contourpy.pyi 7.0 KB

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