soft-matter / trackpy-examples

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

ValueError: invalid literal for int() with base 10: '2K Fra' #20

Closed Jumpet closed 9 years ago

Jumpet commented 9 years ago

I'm having trouble going through the tutorial for trackpy. I have unistalled the other versions I had installed and installed everything using anaconda. I'm trying to locate across multiple frames using tp.batch but I am getting this error reiterating through each frame.

Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\baseshell.py", line 285, in write_output
    self.shell.write(self.get_stdout(), flush=True)
  File "C:\Anaconda\lib\site-packages\spyderlib\widgets\shell.py", line 572, in write
    self.flush(error=error, prompt=prompt)
  File "C:\Anaconda\lib\site-packages\spyderlib\widgets\shell.py", line 583, in flush
    self.insert_text(text, at_end=True, error=error, prompt=prompt)
  File "C:\Anaconda\lib\site-packages\spyderlib\widgets\shell.py", line 598, in insert_text
    self.append_text_to_shell(text, error, prompt)
  File "C:\Anaconda\lib\site-packages\spyderlib\widgets\sourcecode\base.py", line 1236, in append_text_to_shell
    for code in str([int(_c) for _c in match.group(1).split(';')]):
ValueError: invalid literal for int() with base 10: '2K Fra'

here is the code I am running

import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rc('figure',  figsize=(10, 6))
mpl.rc('image', cmap='gray')

import numpy as np
import pandas as pd
from pandas import DataFrame, Series  # for convenience

import pims
import trackpy as tp

frames = pims.ImageSequence('C:/Users/Zach/Desktop/nanoparticles/*.png', as_grey=True)

f = tp.locate(frames[0], 11, invert=False, minmass=4000)
tp.annotate(f, frames[0])

ax = f['mass'].hist()
ax.set(xlabel='mass', ylabel='count')
f = tp.batch(frames[:11], 11, minmass=4000, invert=False)

any advice?

[TAC added markup]

Jumpet commented 9 years ago

@tacaswell and @danielballan

it looks like you've solved this issue before.... any advice?

tacaswell commented 9 years ago

What are your files named?

It looks like the exception is coming out of spyderlib, not pims or trackpy.

It is also not clear from your traceback which line in your code is causing the problem as it all looks like it is coming out of spyder's internal stack.

Jumpet commented 9 years ago

C:/Users/Zach/Desktop/nanoparticles/*.png is the input...the files names in that folder are o_e8af539be08c690b-0.... 0-749

Jumpet commented 9 years ago

(thanks for your response)!

tacaswell commented 9 years ago

I would start by trying to reproduce this in a clean conda env (conda create -n clean_trackpy trackpy pims, working in the 'base 'conda environment for anything but creating new environments is a bad idea) and running the code as a script python my_script.py to eliminate issues with possible cross installations and spyder issues.

Also make sure that there is nothing installed into $HOME/.local/lib/pythonx.y/site-packages/ pip install --user can dump stuff there which is always first in the python search path which can, in turn, lead to great pain if you do not know stuff is there.

Jumpet commented 9 years ago

I took a page from the other thread that I found that mentioned the issue and I uninstalled all the python environments, I'm in the middle of installing conda, updates and trackpy. For the next iteration I'll change the script to something other then the temp file i was using.

Jumpet commented 9 years ago

reinstalled, running,.... conda create -n clean_trackpy trackpy pims...... trying code again as python my_script

well! that did the trick? I cannot explain it myself but tp.batch through the frames without error! I'll be going on with the rest of the walkthrough now! Thanks for your help @tacaswell

tacaswell commented 9 years ago

Great, closing this issue.