Closed DowntonCrabby closed 3 years ago
Hmmm...but this does work
>>> from allensdk.brain_observatory.behavior.behavior_ophys_session import BehaviorOphysSession
>>> file = '/allen/programs/braintv/production/visualbehavior/prod4/specimen_962177507/ophys_session_994137503/ophys_experiment_994278291/behavior_ophys_imaging_plane_994278291.nwb'
>>> dataset = BehaviorOphysSession.from_nwb_path(file)
>>> dataset.stimulus_templates
unwarped warped
image_name
im065 [[nan, nan, nan, nan, nan, nan, nan, nan, nan,... [[198, 197, 201, 207, 207, 202, 198, 201, 207,...
im077 [[nan, nan, nan, nan, nan, nan, nan, nan, nan,... [[129, 135, 140, 142, 140, 135, 129, 124, 117,...
...
In fact, even the from_lims() works for me too:
>>> ophys_experiment_id = 994278291
>>> dataset2 = BehaviorOphysSession.from_lims(ophys_experiment_id)
>>> dataset2.stimulus_templates
unwarped warped
image_name
im065 [[nan, nan, nan, nan, nan, nan, nan, nan, nan,... [[198, 197, 201, 207, 207, 202, 198, 201, 207,...
im077 [[nan, nan, nan, nan, nan, nan, nan, nan, nan,... [[129, 135, 140, 142, 140, 135, 129, 124, 117,...
im066 [[nan, nan, nan, nan, nan, nan, nan, nan, nan,... [[83, 85, 82, 78, 78, 81, 84, 84, 82, 82, 84, ...
...
I've just checked this morning and I'm still getting this error.
I am on the master branch of the SDK v2.8.0
@DowntonCrabby Can you independently verify whether or not you can see that file from whatever machine you are using? When I log onto informatics' synapse server, I can see that file. Thanks.
@danielsf well right now it looks like the function is looking to find the warped_grating_0.png on my local computer instead of the network, could that be the issue? Perhaps its a linux vs windows filepath issue?
That is almost certainly what the problem is.
Now to figure out how to automatically learn where /allen/
is mounted on an arbitrary Windows machine....
Do you mind running
from allensdk.internal.core.lims_utilities import safe_system_path
naive_path = '/allen/programs/braintv/production/visualbehavior/prod5/project_VisualBehavior/warped_grating_0.png'
print(safe_system_path(naive_path))
and seeing if the result is the actual path to that file?
(There must be a way to cast linux /allen/
paths to Windows /allen/
paths; we just don't seem to be using it here)
when running the codeblock you just sent I get the following filepath: \allen\programs\braintv\production\visualbehavior\prod5\project_VisualBehavior\warped_grating_0.png
for doing this with future filepaths would it work to just do filepath.replace('/allen', '//allen')
? I believe that works with both windows and linux filepaths
update there are actually 2 slashes before allen. For whatever reason github does not display both of them.
Is that the filepath that gets you to warped_grating_0.png
over the network?
I ask because that safe_system_path()
method is how we cast the path to the pickle file into whatever form is needed for the user's machine. I assume that, if your machine could not find the pickle files, we would have noticed by now.
@DowntonCrabby
I have a possible fix. Do you mind installing branch ticket/1964/dev
, installing and re-running? I'd test it myself, but, as you have probably inferred, I do not have a Windows machine.
Yes I'll check, but please also see the update above. There are actually two slashes before allen to access that image on the network via the windows filepath. It looks like github wont display the second one.
@danielsf
Running it via the ticket/1964/dev
branch worked!
Phew.
Thanks. I'll open a PR so that this will be in 2.9.0 (or is this blocking you such that we need to think about releasing a 2.9.1)?
@DowntonCrabby Small change in the fix due to code review. Do you mind running the test again. I did some forced pushes on the branch, so you won't be able to just pull it. Let me know if I'm speaking gibberish.
I immediately get an error on import
Yeah.... that is because I force pushed to the repository, meaning your history and GitHub's history are out of sync. Sorry. We software types like our code to be aesthetically pleasing.
Do this:
git commit -a -m ''
git checkout master
git branch -D ticket/1964/dev
git pull
git checkout ticket/1964/dev
effectively, you are deleting your local copy of the branch and then pulling the branch back down from GitHub. Should fix the problem (that <<<<<<<<< HEAD
line you are getting a complaint about is something git stuck in there when it could not reconcile your history and mine).
gotcha. Okay I followed those instructions and it looks like I'm back to the original error:
Dan just warned me that pathlib
(the library I used for the new fix) "doesn't work well with //allen".
Good to know.
I'll go back to the fix we know works and call that good.
Thanks for testing this.
Describe the bug the OphysBehaviorSession dataset attribute stimulus_templates fails to load due to a FileNotFoundError for warped_grating_0.png
To Reproduce
Expected behavior the stimulus_templates dictionary to load
Actual Behavior
Environment (please complete the following information):