info.py 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. """
  2. Basic functions used by several sub-packages and
  3. useful to have in the main name-space.
  4. Type Handling
  5. -------------
  6. ================ ===================
  7. iscomplexobj Test for complex object, scalar result
  8. isrealobj Test for real object, scalar result
  9. iscomplex Test for complex elements, array result
  10. isreal Test for real elements, array result
  11. imag Imaginary part
  12. real Real part
  13. real_if_close Turns complex number with tiny imaginary part to real
  14. isneginf Tests for negative infinity, array result
  15. isposinf Tests for positive infinity, array result
  16. isnan Tests for nans, array result
  17. isinf Tests for infinity, array result
  18. isfinite Tests for finite numbers, array result
  19. isscalar True if argument is a scalar
  20. nan_to_num Replaces NaN's with 0 and infinities with large numbers
  21. cast Dictionary of functions to force cast to each type
  22. common_type Determine the minimum common type code for a group
  23. of arrays
  24. mintypecode Return minimal allowed common typecode.
  25. ================ ===================
  26. Index Tricks
  27. ------------
  28. ================ ===================
  29. mgrid Method which allows easy construction of N-d
  30. 'mesh-grids'
  31. ``r_`` Append and construct arrays: turns slice objects into
  32. ranges and concatenates them, for 2d arrays appends rows.
  33. index_exp Konrad Hinsen's index_expression class instance which
  34. can be useful for building complicated slicing syntax.
  35. ================ ===================
  36. Useful Functions
  37. ----------------
  38. ================ ===================
  39. select Extension of where to multiple conditions and choices
  40. extract Extract 1d array from flattened array according to mask
  41. insert Insert 1d array of values into Nd array according to mask
  42. linspace Evenly spaced samples in linear space
  43. logspace Evenly spaced samples in logarithmic space
  44. fix Round x to nearest integer towards zero
  45. mod Modulo mod(x,y) = x % y except keeps sign of y
  46. amax Array maximum along axis
  47. amin Array minimum along axis
  48. ptp Array max-min along axis
  49. cumsum Cumulative sum along axis
  50. prod Product of elements along axis
  51. cumprod Cumluative product along axis
  52. diff Discrete differences along axis
  53. angle Returns angle of complex argument
  54. unwrap Unwrap phase along given axis (1-d algorithm)
  55. sort_complex Sort a complex-array (based on real, then imaginary)
  56. trim_zeros Trim the leading and trailing zeros from 1D array.
  57. vectorize A class that wraps a Python function taking scalar
  58. arguments into a generalized function which can handle
  59. arrays of arguments using the broadcast rules of
  60. numerix Python.
  61. ================ ===================
  62. Shape Manipulation
  63. ------------------
  64. ================ ===================
  65. squeeze Return a with length-one dimensions removed.
  66. atleast_1d Force arrays to be >= 1D
  67. atleast_2d Force arrays to be >= 2D
  68. atleast_3d Force arrays to be >= 3D
  69. vstack Stack arrays vertically (row on row)
  70. hstack Stack arrays horizontally (column on column)
  71. column_stack Stack 1D arrays as columns into 2D array
  72. dstack Stack arrays depthwise (along third dimension)
  73. stack Stack arrays along a new axis
  74. split Divide array into a list of sub-arrays
  75. hsplit Split into columns
  76. vsplit Split into rows
  77. dsplit Split along third dimension
  78. ================ ===================
  79. Matrix (2D Array) Manipulations
  80. -------------------------------
  81. ================ ===================
  82. fliplr 2D array with columns flipped
  83. flipud 2D array with rows flipped
  84. rot90 Rotate a 2D array a multiple of 90 degrees
  85. eye Return a 2D array with ones down a given diagonal
  86. diag Construct a 2D array from a vector, or return a given
  87. diagonal from a 2D array.
  88. mat Construct a Matrix
  89. bmat Build a Matrix from blocks
  90. ================ ===================
  91. Polynomials
  92. -----------
  93. ================ ===================
  94. poly1d A one-dimensional polynomial class
  95. poly Return polynomial coefficients from roots
  96. roots Find roots of polynomial given coefficients
  97. polyint Integrate polynomial
  98. polyder Differentiate polynomial
  99. polyadd Add polynomials
  100. polysub Subtract polynomials
  101. polymul Multiply polynomials
  102. polydiv Divide polynomials
  103. polyval Evaluate polynomial at given argument
  104. ================ ===================
  105. Iterators
  106. ---------
  107. ================ ===================
  108. Arrayterator A buffered iterator for big arrays.
  109. ================ ===================
  110. Import Tricks
  111. -------------
  112. ================ ===================
  113. ppimport Postpone module import until trying to use it
  114. ppimport_attr Postpone module import until trying to use its attribute
  115. ppresolve Import postponed module and return it.
  116. ================ ===================
  117. Machine Arithmetics
  118. -------------------
  119. ================ ===================
  120. machar_single Single precision floating point arithmetic parameters
  121. machar_double Double precision floating point arithmetic parameters
  122. ================ ===================
  123. Threading Tricks
  124. ----------------
  125. ================ ===================
  126. ParallelExec Execute commands in parallel thread.
  127. ================ ===================
  128. Array Set Operations
  129. -----------------------
  130. Set operations for numeric arrays based on sort() function.
  131. ================ ===================
  132. unique Unique elements of an array.
  133. isin Test whether each element of an ND array is present
  134. anywhere within a second array.
  135. ediff1d Array difference (auxiliary function).
  136. intersect1d Intersection of 1D arrays with unique elements.
  137. setxor1d Set exclusive-or of 1D arrays with unique elements.
  138. in1d Test whether elements in a 1D array are also present in
  139. another array.
  140. union1d Union of 1D arrays with unique elements.
  141. setdiff1d Set difference of 1D arrays with unique elements.
  142. ================ ===================
  143. """
  144. from __future__ import division, absolute_import, print_function
  145. depends = ['core', 'testing']
  146. global_symbols = ['*']