Skip to content
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

Loading sofa file fails #16

Closed
xnoreq opened this issue Oct 11, 2018 · 12 comments
Closed

Loading sofa file fails #16

xnoreq opened this issue Oct 11, 2018 · 12 comments

Comments

@xnoreq
Copy link

xnoreq commented Oct 11, 2018

Loading e.g. hrtf_ci1.sofa from ari (bte) fails:

 h = SOFAload('D:\temp\sofa\hrtf_ci1.sofa')
    file: 'C:\Program Files\MATLAB\R2018a\toolbox\matlab\imagesci\+netcdf\getVar.m'
    name: 'getVar'
    line: 136

    file: 'C:\Users\<user>\Documents\MATLAB\API_MO\netcdf\NETCDFload.m'
    name: 'NETCDFload'
    line: 104

    file: 'C:\Users\<user>\Documents\MATLAB\API_MO\SOFAload.m'
    name: 'SOFAload'
    line: 118

Error using SOFAload (line 123)
Error loading the file: D:\temp\sofa\hrtf_ci1.sofa
@xnoreq
Copy link
Author

xnoreq commented Oct 11, 2018

The exception caught in NETCDFload.m has the following message:
The NetCDF library encountered an error during execution of 'getVaraDouble' function - 'HDF error (NC_EHDFERR)'.

The error seems to happen in line 104 when it wants to read the Obj.Data.IR:
Obj.Data.(var(6:end))=permute(netcdf.getVar(ncid,varids(ii+1),startp(vardimids+1),countp(vardimids+1)), length(dim):-1:1);

@petibub
Copy link
Member

petibub commented Oct 12, 2018

Dear xnoreq,

When I do the following:

SOFAstart; 
X=SOFAload(fullfile(SOFAdbPath,'database','ari (bte)','hrtf_ci1.sofa'));

then HRTFs of CI1 are successfully downloaded from the internet and loaded to Matlab (2016a).

It might be that your downloaded file is corrupted. Could you try again? Maybe even directly using the commands from above?
Good luck,
Piotr

@xnoreq
Copy link
Author

xnoreq commented Oct 12, 2018

Same error:

K>> SOFAstart;
SOFA Matlab/Octave API version 1.0.4. Copyright 2013 Acoustics Research Institute (piotr@majdak.com).
This API implements SOFA version 1.0.
Available SOFA Conventions: GeneralFIR, GeneralFIRE, GeneralString, GeneralTF, MultiSpeakerBRIR, SimpleFreeFieldHRIR, SimpleFreeFieldSOS, SimpleFreeFieldTF, SimpleHeadphoneIR, SingleRoomDRIR
SOFAdbPath (local HRTF database): C:\Users\<user>\Documents\MATLAB\API_MO\HRTFs\SOFA
SOFAdbURL (internet repository): http://www.sofacoustics.org/data
K>> X=SOFAload(fullfile(SOFAdbPath,'database','ari (bte)','hrtf_ci1.sofa'));
    file: 'C:\Program Files\MATLAB\R2018a\toolbox\matlab\imagesci\+netcdf\getVar.m'
    name: 'getVar'
    line: 136

    file: 'C:\Users\<user>\Documents\MATLAB\API_MO\API_MO\netcdf\NETCDFload.m'
    name: 'NETCDFload'
    line: 104

    file: 'C:\Users\<user>\Documents\MATLAB\API_MO\API_MO\SOFAload.m'
    name: 'SOFAload'
    line: 118

Error using SOFAload (line 123)
Error loading the file: C:\Users\<user>\Documents\MATLAB\API_MO\HRTFs\SOFA\database\ari (bte)\hrtf_ci1.sofa
 
K>>

Maybe something changed in Matlab2018 or 2017 in the netcdf functions?

@petibub
Copy link
Member

petibub commented Oct 12, 2018

Hmm, that's weird. Yeah, maybe the netcdf implementation changed with Matlab.
Could you try to load other files? For example, by doing:
demo_baumgartner2014
This will download around 20 HRTFs and load them...

@xnoreq
Copy link
Author

xnoreq commented Oct 12, 2018

I don't have a demo_baumgartner2014.

@slawek-zielinski
Copy link

I’ve got a very similar problem. There are some sofa files which I fail to open. The error messages I get are the same as those provided by xnoreq:

Loading E:\HRTF Database\ari artificial\hrtf b_nh172.sofa
file: 'C:\Program Files\MATLAB\R2018a\toolbox\matlab\imagesci+netcdf\getVar.m'
name: 'getVar'
line: 136

file: 'C:\Users\Slawomir\Documents\Software\SOFA\API_MO\netcdf\NETCDFload.m'
name: 'NETCDFload'
line: 104

file: 'C:\Users\Slawomir\Documents\Software\SOFA\API_MO\SOFAload.m'
name: 'SOFAload'
line: 118

Example of such problematic files include hrtf b_nh172.sofa, ClubFritz1.sofa, ClubFritz3.sofa, ClubFritz4.sofa, ClubFritz5.sofa, ClubFritz6.sofa, ClubFritz7.sofa, ClubFritz9.sofa, ClubFritz10.sofa, ClubFritz11.sofa, ClubFritz12.sofa. It works fine with the remaining artificial HRTF sofa files published on the main SOFA repository.

@petibub
Copy link
Member

petibub commented Oct 12, 2018

Thanks, Slawek. I can do
X=SOFAload(fullfile(SOFAdbPath,'database','ari (artificial)','hrtf b_nh172.sofa'));
without any errors. So I need to look more deeply into that. What's your Matlab version?

@xnoreq : sorry, I confused it with an other toolbox. But since Slawek posted which files work, we don't need the test anymore.

Guys, it might be that the server did not provide the files correctly. Could you delete your local SOFA file, download exactly the same file again, and then try again? Thanks...

@xnoreq
Copy link
Author

xnoreq commented Oct 12, 2018

Some files work for me as well, but some don't:
http://sofacoustics.org/data/database/ari%20(bte)/dtf%20b_nh10.sofa

Has the following checksum after download:
SHA256: 7C8ECDE3DC325088ABF572ABE1332DB6168B7932C31248E7A3AF3CA36F534B04

and fails with the above error.

@xnoreq
Copy link
Author

xnoreq commented Oct 12, 2018

With https, same file:
https://sofacoustics.org/data/database/ari%20(bte)/dtf%20b_nh10.sofa
SHA256: 692DA2ABA7A325C0985FA6B31B3C9E1714C3C3B195015854C17225D7EFCBF9D5

Compare to:
http://sofacoustics.org/data/database/ari%20(bte)/dtf%20b_nh10.sofa
SHA256: 7C8ECDE3DC325088ABF572ABE1332DB6168B7932C31248E7A3AF3CA36F534B04

It looks like the webserver is misconfigured and mangles the files...

@petibub
Copy link
Member

petibub commented Oct 12, 2018

That's actually a good news, xnoreq. I'll check the webserver next week...
Thanks for the debugging!

@slawek-zielinski
Copy link

Thank you for looking into this issue (I am assuming it was due to the server/file transfer problem).

It seems that everything is working now. I downloaded the ‘problematic’ files again and I can load them using the SOFAload command without any problem.

@petibub
Copy link
Member

petibub commented Oct 15, 2018

Our IT has changed some settings in their servers and a test with 10000 downloads was successful (no errors). Unfortunately, we do not know what has changed and created this error. If it happens again, I'll forward the problem again to the IT. Thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants