{ } Raw JSON

bundles / scipy latest / scipy / io / matlab / _byteordercodes / to_numpy_code

function

scipy.io.matlab._byteordercodes:to_numpy_code

source: /scipy/io/matlab/_byteordercodes.py :25

Signature

def   to_numpy_code ( code )

Summary

Convert various order codings to NumPy format.

Parameters

code : str

The code to convert. It is converted to lower case before parsing. Legal values are: 'little', 'big', 'l', 'b', 'le', 'be', '<', '>', 'native', '=', 'swapped', 's'.

Returns

out_code : {'<', '>'}

Here '<' is the numpy dtype code for little endian, and '>' is the code for big endian.

Examples

import sys
from scipy.io.matlab._byteordercodes import to_numpy_code
sys_is_le = (sys.byteorder == 'little')
sys_is_le
to_numpy_code('big')
to_numpy_code('little')
nc = to_numpy_code('native')
nc == '<' if sys_is_le else nc == '>'
sc = to_numpy_code('swapped')
sc == '>' if sys_is_le else sc == '<'

Aliases

  • scipy.io.matlab._byteordercodes.to_numpy_code