-
Notifications
You must be signed in to change notification settings - Fork 532
HDF5 issue with matlab: Large .mat files need to be saved with -v 7.3 #2162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@gladomat these -v 7.3 files are not implemented in we would still want to attempt to open the mat file with |
You mean do I want to add the implementation myself? I can try. It would be an error catcher I suppose. I'll look into it and report how far I've gotten. |
yes, essentially two try/except blocks (one for importing |
I'll do it but it may take a little while. Since I'm the only one using it, I guess it can wait. |
I also ran in to this issue after needing to use v7.3 .mat files (first level analysis, but there was a large number of very long runs). Adding try/except blocks with Is there anything else I should be looking to modify besides the |
@psadil - these are the occurrences i found.
it may be worthwhile to create a def loadmat(filename, **kwargs):
try:
return sio.loadmat(filename, **kwargs)
except NotImplementedError:
import h5py as h5
mat = None
with h5.File(filename, 'r') as f:
...
return mat for specific mappings of MATLAB to HDF5 see this: https://github.com/frejanordsiek/hdf5storage i think for the purpose of these interfaces we also use sio.savemat at different places, but i don't think most of those would end up needing to switch at this point. |
I've implemented a library that can read the https://github.com/skjerns/mat7.3 or install via pip import mat73
data_dict = mat73.loadmat('data.mat') |
I've encountered the same problem, my model is too large, Matlab saves SPM.mat in v7.3 and then nipype cannot handle it. I tried using mat73 but it throws "not a MATLAB datatype" errors for me when trying to read a v7.3 SPM.mat file. |
Summary
I'm running a Bayesian analysis using Per Síden's code using spatial priors and the resulting SPM.mat files are massive for ultra high field data (upwards of 2 GB). I had to change the SPM code to make the saves possible, for example in
spm_contrasts.m
line 313:save('SPM.mat', 'SPM', '-v7.3')
.In nipype, however, I get an error:
Actual behavior
Nipype crashes as it can't open or save -v 7.3 .mat files.
Expected behavior
Nipype should save and open -v 7.3 files natively.
How to replicate the behavior
I changed said line in
spm_contrasts.m
to save -v 7.3 .mat files and ran a second level analysis. At the calculate contrasts step I encounter the above error.Script/Workflow details
Sorry, it's kinda long. I'll shorten the subject list to 1 subject.
Platform details:
Linux 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nipype version: 0.12.1
Execution environment
Native linux with conda installer python 2.7
The text was updated successfully, but these errors were encountered: