You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
since the file doesn't exist for the client yet, it will always save to a subdirectory
Problem: Older analysis files not stored in a subdirectory have a datajoint filepath in the database without the subdirectory as well
This means that in the remote client, the datajoint filepath used to find the file during fetch_nwb does not have the subdirectory in it
This is a different place than where their file was downloaded by kachery, raising a file not found error
Solution? @CBroz1, do you know if the datajoint filepath for an entry can be determined without raising a file not found error? If so we can use this to define where the files should be saved to when downloading from kachery to ensure consistency with the source database.
To Reproduce
On a remote clien connected to the franklab databaset:
One solution is to catch this error and move the downloaded file to the correct location if so. Here's an example:
importosimportshutiltable=IntervalLinearizedPosition&lin_pos_keytry:
(table).fetch_nwb()
exceptFileNotFoundErrorase:
# get the location stored as a datajoint filepathdj_path=str(e).split(': ')[1].replace("'","")
print(dj_path)
# get the location where AnalysisNwbfile.kachery would have stored itanalysis_file= (table).fetch1('analysis_file_name')
current_path=AnalysisNwbfile().get_abs_path(analysis_file)
assertos.path.exists(current_path)
# move the file to the datajoint location# this will change the output of future calls to AnalysisNwbfile().get_abs_path(analysis_file)shutil.move(current_path,dj_path)
table.fetch_nwb()
Once this has executed once, future calls of fetch_nwb for the analysis file will work fine. One option would to put a version of this check in AnalysisNwbfileKachery to solve it in the background when the file is downloaded.
@edeno, do you have a sense if this will show up often enough that we should put this into spyglass or should this issue just be the solution for people on a case-by-case basis?
I think it would be okay to have in AnalysisNwbfileKachery for now. It would be good to have it pretty well documented in the code why the check is happening.
Came up with a cleaner solution in the PR above. Fixing the abs_path returned by AnalysisNwb.get_abs_path() to agree with datajoint entries. Since this is what's used to define where kachery saves the file to in the first place it fixes the issue before it happens
Describe the bug
When sharing with kachery in spyglass the receiving client downloads analysis nwb files in the location returned by
AnalysisNwbfile.get_abs_path()
.Problem: Older analysis files not stored in a subdirectory have a datajoint filepath in the database without the subdirectory as well
filepath
used to find the file duringfetch_nwb
does not have the subdirectory in itSolution?
@CBroz1, do you know if the datajoint filepath for an entry can be determined without raising a file not found error? If so we can use this to define where the files should be saved to when downloading from kachery to ensure consistency with the source database.
To Reproduce
On a remote clien connected to the franklab databaset:
Additional context
Add any other context about the problem here.
Note that the file is downloaded in a subdirectory. After running the above this statement executes
The text was updated successfully, but these errors were encountered: