Using SMOP to convert matlab files to python files

Viewed 400

I'm using smop to convert some matlab files to python (I donwloaded numpy and scipy to support this). It successfully generated output files, but I am running into some errors when running these .py files. The first one is encountered in the libsmop.py (a file in the smop package):

    375     import pdb
    376     pdb.set_trace()
--> 377     t = [matlabarray(a) for a in args]
    378     return np.concatenate(t)
ipdb> (space for user input)

I read online that I should just run it again. I did and the ipdb> thing disappears but then it just stalls for hours. Just fyi, the purpose of my function is to take an image (.jpg) and derive its topological indices.

The second one is from scipy (scipy/io/matlab/miobase.py):

~/opt/anaconda3/envs/Biofilm_research/lib/python3.8/site-packages/scipy/io/matlab/miobase.py in get_matfile_version(fileobj)
    229     if maj_val in (1, 2):
    230         return ret
--> 231     raise ValueError('Unknown mat file type, version %s, %s' % ret)
    232 
    233 

ValueError: Unknown mat file type, version 49, 48

I don't know why it's asking for a mat file since the purpose of my function is to take a text file containing a column of data and determine a threshold from it.

The third one is from numpy (numpy/core/fromnumeric.py):

~/opt/anaconda3/envs/Biofilm_research/lib/python3.8/site-packages/numpy/core/fromnumeric.py in _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs)
     85                 return reduction(axis=axis, out=out, **passkwargs)
     86 
---> 87     return ufunc.reduce(obj, axis, dtype=int, out, **passkwargs)
     88 
     89 

TypeError: cannot perform reduce with flexible type 

The purpose of my function here is to take a .jpg file and display 3D grayscale images in slice by slice fashion with mouse based slice browsing and window and level adjustment control. I have absolutely no idea what type is going in/being outputed but I guess it's the flexible type- I don't know at what point to fix this.

If anyone can help with anything at all I would greatly appreciate it!!!

0 Answers
Related