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

access local files via matlab #171

Open
cagjony opened this issue Dec 16, 2023 · 8 comments
Open

access local files via matlab #171

cagjony opened this issue Dec 16, 2023 · 8 comments

Comments

@cagjony
Copy link

cagjony commented Dec 16, 2023

Hi everyone,

For teaching purposes, I would like to download some nwb files to the external folder and use the getSession function to load files. Whenever I want to run the code below, even though there is a file in the desired location, it tries to download it.


% obtain all sessions in the ephys dataset
sessions = bot.listSessions('ephys');

% obtain all sessions with the desired session_type and then select the first one
desiredSessions = sessions(sessions.session_type == 'brain_observatory_1.1', :);
sess = bot.getSessions(desiredSessions(1, :));

My main motivation is to have a classroom with many computers without internet access. Is there any way to reach the local files and use the same code environment?

@ehennestad
Copy link
Collaborator

Hi,

To understand better what is going on, I'd like to ask for some more information.

  1. Are you using one of the release versions or are you using any of the branches of this repository?
  2. Which operating system / platform are you using?
  3. What is your external folder?

This toolbox will create a local folder on your computer (typically in Documents/MATLAB/Brain Observatory Toolbox Cache) and this is were files will be saved. In addition to the downloaded NWB files, there will also be a OC_Manifest.mat and CC_Manifest.mat. Are these files also present in your external folder when you run the code above and the NWB file is re-downloaded?

@cagjony
Copy link
Author

cagjony commented Dec 16, 2023

Hi,

Thank you for the prompt response,

Answers to the questions,

1- I am using the official toolbox from Matlab 2021
2- I am using 2012 r2 windows server edition
3- external folder is generated automatically when the nwb files are downloaded locally

yes indeed, CC_Manifest.mat and OC_Manifest.mat are downloaded and present in the higher folder
2023-12-16 21_39_58-Clipboard

@ehennestad
Copy link
Collaborator

ehennestad commented Dec 16, 2023

  1. Does the Brain Observatory Toolbox show up with a version if you run the ver() command in MATLAB
  2. Do you receive any error messages or warnings when the file is redownloaded?

@cagjony
Copy link
Author

cagjony commented Dec 16, 2023

Yes, I got the error related to my security settings, but I wondered if the file was already in the external folder. Is there a function that allows me to fetch an already downloaded file?

2023-12-16 22_32_59-Clipboard

@ehennestad
Copy link
Collaborator

I still do not understand fully what is going on, but did the file download complete before? It is possible that the file is there, but if the download did not complete till the end, it will try to re-download.

Also, I have a suspicion:

if you would type open bot.internal.CloudCacher/websave

And comment out the following line:
https://github.com/emeyers/Brain-Observatory-Toolbox/blob/44056406914d69107fb7d3fae494a7ae8839f69e/%2Bbot/%2Binternal/CloudCacher.m#L144

Would it work then?

@ehennestad
Copy link
Collaborator

I realize I did not answer this question directly:

I wondered if the file was already in the external folder. Is there a function that allows me to fetch an already downloaded file?

This is the intention of how the toolbox should work, but it seems that in your case something either prevented the file from being downloaded completely, or prevented it from being properly registered as available offline

@cagjony
Copy link
Author

cagjony commented Dec 18, 2023

I tried commenting our 144 and I also added some breakpoint inside of that function. It turns out, it crashes in cache.m function.

I think it is related to my server's security settings and is there any way to download 1 example dataset where I can have an access to the all optional fields and with using bot.getSessions function I can access it and use the rest of the +bot functions/scripts.

@ehennestad
Copy link
Collaborator

Unless I know exactly where the code fails, I am not sure how to advice you best.

If the download is successful, the cache should be updated and the data should be available for later access. If this does not happen, there might be a bug and this should be investigated.

However, if the download is interrupted somehow, then it will be impossible to access the file.

It is possible to download the data directly from the Allen Brain Observatory S3 bucket, but there is no good solution in the Brain Observatory Toolbox for updating the cache to specify that the file is present.

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

2 participants