nii-yamagishilab / project-CURRENNT-public

CURRENNNT codes and scripts
GNU General Public License v3.0
77 stars 11 forks source link

No work with numpy 1.17.x or later #5

Closed misumisumi closed 3 years ago

misumisumi commented 4 years ago

Problem

If I use numpy 1.17.x or later, ioTools have FutureWarning in np.dtype((format,1)) and not work. This problem not happen using numpy 1.16.4.

Solve

I change

def write_raw_mat(data,filename,format='f4',end='l'):
...
    if len(format)>0:
        if end=='l':
            format = '<'+format
        elif end=='b':
            format = '>'+format
        else:
            format = '='+format
        datatype = np.dtype((format,1))
...

to


def write_raw_mat(data,filename,format='f4',end='l'):
...
  if len(format)>0:
        if end=='l':
            format = '<'+format
        elif end=='b':
            format = '>'+format
        else:
            format = '='+format
        datatype = np.dtype(format)
...

After I also change similar places, this problem not happen using 1.17.x or later.(I check in numpy 1.18.4)