soft-matter / trackpy-examples

sample images, examples, and speed tests for trackpy
Other
21 stars 42 forks source link

bulk_water #47

Closed swarnak25 closed 6 years ago

swarnak25 commented 6 years ago

frames = pims.ImageSequence('../sample_data/bulk_water/.png', as_grey=True) When I try to run this the following error shows- File "", line 1, in frames = pims.ImageSequence('(F:)/Trackpy-examoles-master/sample_data/bulk_water/.png', as_grey=True)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")

OSError: No files were found matching that path.

nkeim commented 6 years ago

Hi! First things first: are there .png files in the directory (F:)/Trackpy-examoles-master/sample_data/bulk_water/?

swarnak25 commented 6 years ago

No I made a mistake.It should be (F:)/Trackpy-examples-master/Trackpy-examples-master/sample_data/bulk_water/.How do I set this new path?

swarnak25 commented 6 years ago

import pims

frames = pims.ImageSequence('(F:)/Trackpy-examoles-master/Trackpy-examoles-master/sample_data/bulk_water/*.png', as_grey=True) Traceback (most recent call last):

File "", line 1, in frames = pims.ImageSequence('(F:)/Trackpy-examoles-master/Trackpy-examoles-master/sample_data/bulk_water/*.png', as_grey=True)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")

OSError: No files were found matching that path.

swarnak25 commented 6 years ago

For some reason examples turned into examoles . I correceted that and ran the command but still the same errors are there.

nkeim commented 6 years ago

Thanks. I am still confused. What directory are you in when you run the command? (Use %pwd.) And in what directory is the walkthrough notebook located? I ask because this looks like more of a problem with where the files are (and where you are) in your own computer's filesystem.

swarnak25 commented 6 years ago

I get what you are saying.But I am unable to fix it.I ran %pwd.I got this. In[22]: %pwd Out[22]: 'C:\Users\swarnak\TrackingWithPython\trackpy-examples-master\sample_data\bulk_water' I have checked and put it in that folder.

swarnak25 commented 6 years ago

frames = pims.ImageSequence('(C:)/Users/swarnak/TrackingWithPython/trackpy-examples-master/sample_data/bulk_water/*.png', as_grey=True) Traceback (most recent call last):

File "", line 1, in frames = pims.ImageSequence('(C:)/Users/swarnak/TrackingWithPython/trackpy-examples-master/sample_data/bulk_water/*.png', as_grey=True)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 95, in init self._get_files(path_spec)

File "C:\Users\swarnak\Anaconda4\lib\site-packages\pims\image_sequence.py", line 165, in _get_files raise IOError("No files were found matching that path.")

OSError: **No files were found matching that path.**


This was supposed to be simple.What am I missing?

swarnak25 commented 6 years ago

Thanks for trying to help me out.

nkeim commented 6 years ago

No problem! pims just uses glob() to find the files, which is a standard part of Python. So you should be able to do

from glob import glob print(len(glob(your_pattern)))

where your_pattern is a path ending in *.png like the ones you’ve been using. If you can get something other than zero length, then pims.open(your_pattern)) will work.

I am not a Windows user so I can’t help much with that. But I can say that this doesn’t look like a pims problem; you need to research how to specify paths in Python on Windows.

On Mar 4, 2018, 3:09 AM -0800, swarnak25 notifications@github.com, wrote:

Thanks for trying to help me out.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/soft-matter/trackpy-examples/issues/47#issuecomment-370220462, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AC2NbarmVrq0Khy-Y0oNywvb36ZdFd8Rks5ta8t6gaJpZM4SSIRR.

swarnak25 commented 6 years ago
  1. I reinstalled anaconda setting Add Anaconda to my PATH environment variable. But to no avail.
  2. Should working directory be the same as which my files are in?
swarnak25 commented 6 years ago

from glob import glob

print(len(glob('(C:)/Users/swarnak/TrackingWithPython/trackpy-examples-master/sample_data/bulk_water/*.png'))) 0

tacaswell commented 6 years ago

If you look in the file browser do the pngs exist?

I suggest starting from (C:)/Users and using os.path.exists (https://docs.python.org/2/library/os.path.html#os.path.exists) or Path.exists (https://docs.python.org/3/library/pathlib.html#pathlib.Path.exists) if you are on python3 to make sure each layer of the path is correct and exists.

swarnak25 commented 6 years ago

Hello Nathan,I have fixed the problem by putting a small r in front of the string representing the file name.

nkeim commented 6 years ago

That’s great! Sorry we don’t have more experience with the basics on Windows.