Giter Club home page Giter Club logo

mat4py's People

Contributors

jcbsv avatar tirkarthi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mat4py's Issues

NameError: name 'mtp' is not defined

  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 461, in loadmat
    mdict[name] = read_var_array(fd_var, endian, hdr)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 368, in read_var_array
    return read_struct_array(fd, endian, header)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 326, in read_struct_array
    data = read_var_array(fd_var, endian, vheader)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 366, in read_var_array
    return read_cell_array(fd, endian, header)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 293, in read_cell_array
    varray = read_var_array(fd_var, endian, vheader)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 364, in read_var_array
    return read_char_array(fd, endian, header)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 342, in read_char_array
    array = read_numeric_array(fd, endian, header, ['miUTF8'])
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 270, in read_numeric_array
    data = read_elements(fd, endian, data_etypes)
  File "C:\ProgramData\Anaconda3\lib\site-packages\mat4py\loadmat.py", line 179, in read_elements
    .format(mtp, etypes[mtp]['n'], mtpn))
NameError: name 'mtp' is not defined

Error

ValueError: Struct field names are too long

Deprecation warning

Hello,
thank you for your library. I would like to ask you for little modification. Nowadays it gives me two Deprecation Warnings. Namely:
loadmat.py:14 /mat4py/loadmat.py:14: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working from collections import Sequence
and
mat4py/savemat.py:15 mat4py/savemat.py:15: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working from collections import Sequence, Mapping

It could be fixed be replacing imports from
from collections import Sequence
to
try: from collections.abc import Sequence except ModuleNotFoundError: from collections import Sequence
and from
from collections import Sequence, Mapping
to
try: from collections.abc import Sequence, Mapping except ModuleNotFoundError: from collections import Sequence, Mapping
Or just check: https://stackoverflow.com/a/53978543
Could you, please, fix this issue and provide new version into pipy?
Thank you.

Numpy arrays are not supported in savemat

As from issue's title. This simple code:

from mat4py import savemat
import numpy as np

data = np.ones((10,1))
savemat('./test.mat', {'data':data})

raises an error. The error arises from numpy arrays not being an instance of Sequence. For the purposes of the library, it doesn't seem that strict Sequence requirements are necessary, so checking for hasattr(array, '__len__') and hasattr(array, '__getitem__') or isinstance(array, Iterable) should be enough to parse simple 2d arrays. What do you think @jcbsv @tirkarthi?

Provide source distribution

It would be nice if you provided the source distribution of your package on pypi.
image
This would make repackaging to conda easier.

Issue loading structs saved by Octave

Saving a simple test struct created in Octave

a.b = 1;
save -v7 test.mat a

and loading with loadmat

loadmat('test.mat') 

returns the error

\temp\loadmat.py in read_struct_array(fd, endian, header)
    315     if field_name_length > 32:
    316         raise ParseError('Unexpected field name length: {}'.format(
--> 317                          field_name_length))
    318
    319     # read field names

ParseError: Unexpected field name length: 64

scalars work fine though, and importing structs from Matlab instead of Octave (as well as loading the test.mat file into Matlab).

Incorporate mat73

This package is great! It provides something so much more usable than the default scipy.io.loadmat. But it does seem to struggle on a lot of newer matlab formats. I noticed there's a mat73 project that works great for reading the HDF5 format for .mat files in version 7.3. But it doesn't write them. At any rate, it would be nice if this project could be updated to handle newer formats and the effort not duplicated too much.

https://github.com/skjerns/mat7.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.