Skip to main content

No project description provided

Project description

中文 English

背景

Python 中始终没有一个一站式读取 mat 文件的库,mat5 总是依赖 scipy.io, mat7.3 总是依赖 h5py,h5py 直接读取 mat 文件又需要很多手动转换,有一个 mat73 转换,但是核心逻辑是纯 Python 写的,又非常慢。

恰巧 C 中有一个库 matio,我就想用 pybind11 做一个绑定。

路线

  • 完成基本函数的绑定
  • 使用 xmake 在 Windows 和 Linux 上编译通过
  • 打包为 whl 文件
  • 添加关于构建成功的基本测试
  • 添加 cibuildwheel 和 Github Action
  • 吸取 https://github.com/pybind/scikit_build_example 中的优势
  • 编译扩展时自动处理虚拟环境
  • 添加更 Pythonic 的调用接口
  • 添加 benchmark
  • 导入 scio 的测试和 mat73 的测试

使用

当前还没有打包到 whl,如需试用需安装 xmake,这是一个基于 lua 的构建系统,非常轻量。

git clone https://github.com/myuanz/pymatio
xmake

之后即可在build目录下见对应平台的 Python 扩展,hdf5 和 matio 之依赖会自动处理。

样例

import pymatio as pm

print(pm.get_library_version())
print(pm.log_init('pymatio'))
print(pm.set_debug(1))
pm.critical("abcdefg%d,%d\n" % (234, 456,))
mat = pm.create_ver('test.mat', None, pm.MatFt.MAT73)

var1 = pm.var_create('var1', pm.MatioClasses.DOUBLE, pm.MatioTypes.DOUBLE, 2, (2, 3,), (1, 2, 3, 4, 5, 6,), 0)
pm.var_write(mat, var1, pm.MatioCompression.NONE)
pm.var_free(var1)
print(mat.filename, mat.version, mat.fp, mat.header, mat.byte_swap, mat.mode, mat.bof, mat.next_index, mat.num_datasets, mat.refs_id, mat.dir)

输出:

(1, 5, 26)
0
None
-E- abcdefg234,456
: abcdefg234,456

test.mat 512 <capsule object NULL at 0x7f85197b3fc0> MATLAB 7.3 MAT-file, Platform: x86_64-pc-Linux, Created by: libmatio v1.5.26 on Tue Dec 26 15:49:00 2023
 HDF5 sche 0 MatAcc.RDWR 128 0 1 -1 []

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

pymatio-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distributions

pymatio-0.1.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12 Windows x86-64

pymatio-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

pymatio-0.1.0-cp312-cp312-manylinux_2_40_x86_64.whl (434.2 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.40+ x86-64

pymatio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

pymatio-0.1.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11 Windows x86-64

pymatio-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

pymatio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pymatio-0.1.0-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10 Windows x86-64

pymatio-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

pymatio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pymatio-0.1.0-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9 Windows x86-64

pymatio-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

pymatio-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

File details

Details for the file pymatio-0.1.0.tar.gz.

File metadata

  • Download URL: pymatio-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.6.47-1-MANJARO

File hashes

Hashes for pymatio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2c3df65a2d92b86f3f60a69988dd1c852c41ee512ef725f77630d7e81e66cd70
MD5 d23007072186fd4adab3961f4364a0ef
BLAKE2b-256 756ea6ffec98622518427c6aa4d3015daaf09988f35727a192234b036aa5ad26

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pymatio-0.1.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pymatio-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4623ca1c764ae9a5c6ce89ca7cb7b308588887e13f49600e12887cffb8dfbb8c
MD5 9a83cf01183d859aa66248ba82f1047f
BLAKE2b-256 2d7cdf9e47dfa6d1ca94ddeac0876cbff92bfa3755ba18a972fda7282aa27429

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5afeaa8b362f64e879cbc5e35f6474bcca4fad440cda546ed4f23818412380dc
MD5 811b3baec7099670f1608ecde543a1a1
BLAKE2b-256 891c64593e6bd4cc95ed8147b067d41ecfa0006d42e2fe9620e097bd65d0e444

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp312-cp312-manylinux_2_40_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp312-cp312-manylinux_2_40_x86_64.whl
Algorithm Hash digest
SHA256 92147f3bcca40eab8ec1d1a4a1891bac0d7d3e860addbff41784fa027aa31098
MD5 cdcde035796388f24c6f29d1d86e6d89
BLAKE2b-256 15ed9a5f4667c8c944ef34f7a30526cb3e11259e641b3f4af74af1a55fe6fe15

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 015001d7432e9f1605c43dc72de7a6a14944066c2dba2fb2c4a319ba5f1f9876
MD5 4a22afd58f7bda38d75c3bd6c8a71939
BLAKE2b-256 2524791c07985c386099654ba8049c93b5c52350933c9ddde1cbff91d856d1ff

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pymatio-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pymatio-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 feb7f740a16a057d0a32e1106bd5acd8687a1925dcdb72c2d0da486bba1bdbce
MD5 11be10deedf7153224b46a6a28ce15b1
BLAKE2b-256 f50d3f46cecadd23d81a1c14ad79208271b36a53d2e91c58d082fadd89e4a80a

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d8e6ed0e53e50827dc6b4c39a1ccec2551f4fb4cd0ff5f59c0480c31ac2d2de3
MD5 4d9ab6caad2b8a7f7d8a18104b98d849
BLAKE2b-256 99e60a627eb78e1eb4ba2f4881ddded96d41265ab56ebf69576f00f2333389f3

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e9f4a2c7d43f3ddc428d6d88d1bc2ff35572f92c37a82e683f440f8a36a408c
MD5 bd8bb732d8965afe065cbc79d5af216c
BLAKE2b-256 b1f0e695648530a1323d79c0147cfcc6c92b8aec707cde39c68ed2607f9c1ec6

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pymatio-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pymatio-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 049abf69cfd368763b5f7120714387fddbe0e1bd2b5600637e50fd6f5a918d77
MD5 dc2ce1641ea65db24d2f352b27146851
BLAKE2b-256 67db124da4f65bed9b60cdbae5346d36d6e95e6ca727644c4288a37e42b5c6c8

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 365ddad954fc928eb7ead9a86c650043df9c1751ae28ab9040adaf149878a864
MD5 bdec34837e709c63cd5578c9b56f6d97
BLAKE2b-256 10ee0e6e0d07cfb96c9baa78776e2b3a060193204ab9257ece607f3e36feedeb

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b2e3b9c2a3bd878ae17cd25af89774dde2e40e8025194d7de1305e6ea3ee359
MD5 793b1b53a2f4fe2e4c238c58eae6b2c6
BLAKE2b-256 6985c499b0a45f7fe9670c448b723a4a2096fb0a138aa534908efd34eb769e18

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pymatio-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pymatio-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 da7889ce7fe8350e2afe81b601e7c88da2d73fb9f9ebb3b12955d5cb387decd0
MD5 102b7e84cd3a622dc4a3085230a99384
BLAKE2b-256 e784950222af20b6efddc0d39e1ddbe9323c3940a408d3590366b8384b6c2906

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b2ea22d59c178818218121daeef32a2436484b376ad12d3213acd2237d64f71b
MD5 66614eb0c9ca7dcbbeb9c8659a360cde
BLAKE2b-256 ee3eff3226c5a342a82acfa04bb1d7e748369742fc87d617ee7b22c6e9dcea06

See more details on using hashes here.

File details

Details for the file pymatio-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pymatio-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 53215928ada56287efde2025b3acbd8e923ee13700e271f74d0f288272ff30f5
MD5 45eee389cff704b20fc07fd87115dff2
BLAKE2b-256 7d39fd8c4081dd1d7ec77af836e537a731cfe640a844a8319c7ddaa0f92e3a67

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page