package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

module MatFileReader : sig ... end
module VarHeader4 : sig ... end
module VarReader4 : sig ... end
module VarWriter4 : sig ... end
val arr_dtype_number : arr:Py.Object.t -> num:Py.Object.t -> unit -> Py.Object.t

Return dtype for given number of items per element

val arr_to_2d : ?oned_as:Py.Object.t -> arr:[> `Ndarray ] Np.Obj.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Make ``arr`` exactly two dimensional

If `arr` has more than 2 dimensions, raise a ValueError

Parameters ---------- arr : array oned_as : 'row', 'column', optional Whether to reshape 1-D vectors as row vectors or column vectors. See documentation for ``matdims`` for more detail

Returns ------- arr2d : array 2-D version of the array

val arr_to_chars : Py.Object.t -> Py.Object.t

Convert string array to char array

val asbytes : Py.Object.t -> Py.Object.t

None

val asstr : Py.Object.t -> Py.Object.t

None

val convert_dtypes : dtype_template:Py.Object.t -> order_code:string -> unit -> Py.Object.t

Convert dtypes in mapping to given order

Parameters ---------- dtype_template : mapping mapping with values returning numpy dtype from ``np.dtype(val)`` order_code : str an order code suitable for using in ``dtype.newbyteorder()``

Returns ------- dtypes : mapping mapping where values have been replaced by ``np.dtype(val).newbyteorder(order_code)``

val docfiller : Py.Object.t -> Py.Object.t

None

val matdims : ?oned_as:[ `Column | `Row ] -> arr:[> `Ndarray ] Np.Obj.t -> unit -> Py.Object.t

Determine equivalent MATLAB dimensions for given array

Parameters ---------- arr : ndarray Input array oned_as : 'column', 'row', optional Whether 1-D arrays are returned as MATLAB row or column matrices. Default is 'column'.

Returns ------- dims : tuple Shape tuple, in the form MATLAB expects it.

Notes ----- We had to decide what shape a 1 dimensional array would be by default. ``np.atleast_2d`` thinks it is a row vector. The default for a vector in MATLAB (e.g., ``>> 1:12``) is a row vector.

Versions of scipy up to and including 0.11 resulted (accidentally) in 1-D arrays being read as column vectors. For the moment, we maintain the same tradition here.

Examples -------- >>> matdims(np.array(1)) # NumPy scalar (1, 1) >>> matdims(np.array(1)) # 1-D array, 1 element (1, 1) >>> matdims(np.array(1,2)) # 1-D array, 2 elements (2, 1) >>> matdims(np.array([2],[3])) # 2-D array, column vector (2, 1) >>> matdims(np.array([2,3])) # 2-D array, row vector (1, 2) >>> matdims(np.array([[2,3]])) # 3-D array, rowish vector (1, 1, 2) >>> matdims(np.array()) # empty 1-D array (0, 0) >>> matdims(np.array([])) # empty 2-D array (0, 0) >>> matdims(np.array([[]])) # empty 3-D array (0, 0, 0)

Optional argument flips 1-D shape behavior.

>>> matdims(np.array(1,2), 'row') # 1-D array, 2 elements (1, 2)

The argument has to make sense though

>>> matdims(np.array(1,2), 'bizarre') Traceback (most recent call last): ... ValueError: 1-D option 'bizarre' is strange

val read_dtype : mat_stream:Py.Object.t -> a_dtype:Np.Dtype.t -> unit -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Generic get of byte stream data of known type

Parameters ---------- mat_stream : file_like object MATLAB (tm) mat file stream a_dtype : dtype dtype of array to read. `a_dtype` is assumed to be correct endianness.

Returns ------- arr : ndarray Array of dtype `a_dtype` read from stream.

val reduce : ?initial:Py.Object.t -> function_:Py.Object.t -> sequence:Py.Object.t -> unit -> Py.Object.t

reduce(function, sequence, initial) -> value

Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. For example, reduce(lambda x, y: x+y, 1, 2, 3, 4, 5) calculates ((((1+2)+3)+4)+5). If initial is present, it is placed before the items of the sequence in the calculation, and serves as a default when the sequence is empty.

OCaml

Innovation. Community. Security.