mne-tools / mne-connectivity

Connectivity algorithms that leverage the MNE-Python API.
https://mne.tools/mne-connectivity/dev/index.html
BSD 3-Clause "New" or "Revised" License
68 stars 34 forks source link

[WIP] Enable save/read, simplify "combine" kwarg and allow symmetric RAM optimization #20

Closed adam2392 closed 3 years ago

adam2392 commented 3 years ago

PR Description

Closes: #16 Closes: #18 Closes: #10

Merge checklist

Maintainer, please confirm the following before merging:

adam2392 commented 3 years ago

Looks like I'm getting hit by an error that I can't reproduce locally, but only on Ubuntu and some Mac distros:

mne_connectivity/tests/test_connectivity.py:177: in test_io
270
    conn.save(fname)
271
mne_connectivity/base.py:481: in save
272
    self.xarray.to_netcdf(fname, mode='w')
273
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/xarray/core/dataarray.py:2778: in to_netcdf
274
    return dataset.to_netcdf(*args, **kwargs)
275
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/xarray/core/dataset.py:1799: in to_netcdf
276
    return to_netcdf(
277
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/xarray/backends/api.py:1092: in to_netcdf
278
    store.close()
279
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/xarray/backends/scipy_.py:237: in close
280
    self._manager.close()
281
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/xarray/backends/file_manager.py:222: in close
282
    file.close()
283
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:294: in close
284
    self.flush()
285
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:404: in flush
286
    self._write()
287
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:416: in _write
288
    self._write_var_array()
289
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:464: in _write_var_array
290
    self._write_var_metadata(name)
291
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:485: in _write_var_metadata
292
    self._write_att_array(var._attributes)
293
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:445: in _write_att_array
294
    self._write_att_values(values)
295
../../../hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/scipy/io/netcdf.py:557: in _write_att_values
296
    nc_type = REVERSE[values.dtype.char, values.dtype.itemsize]
297
E   KeyError: ('U', 4)

Will need to do some googling...

adam2392 commented 3 years ago

Regarding the error: looks like the attributes are making trouble?

Ah looks like "netcdf4" library needs to be added into the requirements files :p