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 MatVarReader : 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_chars : Py.Object.t -> Py.Object.t

Convert string array to char array

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 get_matfile_version : Py.Object.t -> Py.Object.t * int

Return major, minor tuple depending on apparent mat file type

Where:

#. 0,x -> version 4 format mat files #. 1,x -> version 5 format mat files #. 2,x -> version 7.3 format mat files (HDF format)

Parameters ---------- fileobj : file_like object implementing seek() and read()

Returns ------- major_version :

, 1, 2

major MATLAB File format version minor_version : int minor MATLAB file format version

Raises ------ MatReadError If the file is empty. ValueError The matfile version is unknown.

Notes ----- Has the side effect of setting the file read pointer to 0

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.

OCaml

Innovation. Community. Security.