Load data from v7.3 *.mat files.
Project description
Load data from v7.3 *.mat files. Only reading is supported, no writing.
Usage
Provides a class Hdf5Matfile and a convience function load_hdf5mat.
To load all the variables from the file, use Hdf5Matfile.load_file:
with Hdf5Matfile(filename) as file:
data = file.load_file()
To load a specific variable, use Hdf5Matfile.load_variable:
with Hdf5Matfile(filename) as file:
results = file.load_variable('results')
If you’re not using a context manager, make sure to close the file after you’re done:
file = Hdf5Matfile(filename)
data = file.load_file()
file.close()
By default, arrays are not squeezed; since MATLAB represents even scalars as 2-D arrays, this means that something you expect to be a scalar will in fact be a 1-by-1 np.ndarray. You can change this by passing squeeze=True to the constructor:
with Hdf5Matfile(filename, squeeze=True) as file:
data = file.load_file()
Supported data types
Data type support is pretty limited; this isn’t a terribly fancy class. Supported MATLAB data types, and the Python objects or NumPy dtypes they map to:
MATLAB type |
Python object |
NumPy dtype |
---|---|---|
cell |
np.ndarray |
object |
char |
str |
n/a |
double |
np.ndarray |
np.double |
int8 |
np.ndarray |
np.byte |
int16 |
np.ndarray |
np.short |
int32 |
np.ndarray |
np.intc |
int64 |
np.ndarray |
np.int_ |
logical |
np.ndarray |
bool8 |
single |
np.ndarray |
single |
struct (scalar) |
dict |
n/a |
struct (array) |
np.ndarray |
object (dict) |
uint8 |
np.ndarray |
np.ubyte |
uint16 |
np.ndarray |
np.ushort |
uint32 |
np.ndarray |
np.uintc |
uint64 |
np.ndarray |
np.uint |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hdf5matfile-0.2.2.tar.gz
.
File metadata
- Download URL: hdf5matfile-0.2.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8737186a76e8ecfad1b05a6f485412013afbe438123f3616a60ae2c529324772 |
|
MD5 | 9561958f5be61503b3f7228e4f0fa60c |
|
BLAKE2b-256 | cee87eba1917ffe23fa65a5b4a28bbeb29b1c04e042edc10aba81f5719f4899a |
File details
Details for the file hdf5matfile-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: hdf5matfile-0.2.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e00d9b87f8bdca72b6e8f2a5f8b6828a975480925c26a687b0655c0804710fbd |
|
MD5 | 668acc45f6020626ad71324894e8e3b7 |
|
BLAKE2b-256 | 538fef5355f0ac72cecc9b26ffa84e7f41e877c15bd7759cdafbba21ac2c185f |