AttributeError: 'list' object has no attribute 'startswith'

4,786 views
Skip to first unread message

Rune Enger

unread,
Apr 19, 2015, 4:12:51 PM4/19/15
to sima-...@googlegroups.com
Dear Patrick,

First of all, thanks to you and your group for making and updating this great alignment/analysis tool. I've used the SIMA 0.3.1 with some success, but I'm having some trouble with running the alignment scripts after upgrading to SIMA 1.1.1. 

Since my python skills are rather limited I've basically just made some alterations on your example script (workflow.py). Basically I pass folder names to python (containing multiple multipage .tiffs from one experiment) with a bash-script, and change to this working folder by os.chdir() in my .py file. However, I keep on getting the following error message:

"TIFF filenames:

[['analyze/Cycle01_Ch2.tif', 'analyze/Cycle01_Ch3.tif']]

Estimating model parameters.

Estimating displacements for cycle  0

/Users/Rune/Library/Python/2.7/lib/python/site-packages/sima/motion/hmm.py:795: UserWarning: No finite observation probabilities.

  warnings.warn('No finite observation probabilities.')

Traceback (most recent call last):

  File "/Volumes/LaCie/Analyses/analysisworkflow.py", line 76, in <module>

    trim_criterion=0.95)

  File "/Users/Rune/Library/Python/2.7/lib/python/site-packages/sima/motion/motion.py", line 134, in correct

    corrected_sequences, savedir, channel_names=channel_names)

  File "/Users/Rune/Library/Python/2.7/lib/python/site-packages/sima/imaging.py", line 140, in __init__

    self.savedir = savedir

  File "/Users/Rune/Library/Python/2.7/lib/python/site-packages/sima/imaging.py", line 245, in savedir

    savedir = abspath(savedir)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 367, in abspath

    if not isabs(path):

  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 61, in isabs

    return s.startswith('/')

AttributeError: 'list' object has no attribute 'startswith'"


The example dataset works fine with the provided example script (workflow.py), so I'm sure this is a rather trivial error/conflict regarding working directories or filename formats or something like this. Unfortunately we don't have any python expertise in our lab, so I would be very grateful if you had some idea about what's going on.



Best regards,

Rune Enger, MD

PhD student

University of Oslo

Patrick Kaifosh

unread,
Apr 19, 2015, 6:02:46 PM4/19/15
to sima-...@googlegroups.com
Hi Rune,
Can you please send all the code that you ran to produce the error? It looks like the problem might be that the savedir for the dataset is a list rather than a string giving the output path.
Cheers,
Patrick

Rune Enger

unread,
Apr 20, 2015, 4:35:44 AM4/20/15
to sima-...@googlegroups.com
Thanks for the quick reply! 

Basically my imaging data are stored in /Users/Rune/Desktop/analyses/MultipageTIFF/Tseries_date_time_yr/analyze/Cyclexx_Chxx.tif. The attached bash-script basically feeds the root folder (Tseries...) to the .py script (as well as converting the images to multipage tiffs with a matlab script). 

Rune



testshellscript_send.sh
analysisworkflow_send.py

Patrick Kaifosh

unread,
Apr 20, 2015, 9:04:10 AM4/20/15
to sima-...@googlegroups.com
Hi Rune,

The problem is this line:

dataset_path = ['analyze/dataset.sima']

This should be changed to:

dataset_path = 'analyze/dataset.sima'

Best,
Patrick

Rune Enger

unread,
Apr 20, 2015, 3:19:04 PM4/20/15
to sima-...@googlegroups.com
Ah, of course, don't know how and why I put those there. Thanks for sorting it out!

By the way - I have the feeling that the new version of SIMA is quite much slower in motion correction than the 0.3.1. I this something you have experienced? Is the HiddenMarkov2D the same method as was default in the 0.3.1?

Best,
Rune

Patrick Kaifosh

unread,
Apr 20, 2015, 4:44:14 PM4/20/15
to sima-...@googlegroups.com
Hi Rune,
We did make some trade-offs between flexibility and speed. The new code is more flexible (supports 3D and arbitrary scan patterns) but slower as a result. We also haven't yet spent as much time speeding it up as we had with the old code. How much slower do you find it? How problematic is it for your workflows?
Patrick

Rune Enger

unread,
Apr 20, 2015, 5:00:05 PM4/20/15
to sima-...@googlegroups.com
Hi Patrick,

Well, I haven't done any direct comparisons as I don't have the old package installed anymore, but I would say possibly several times slower. Our experiments give rather long T-series, so the files are really quite big. Is the speed dependent on file type on the input - would HDF5-files be quicker? 

Is the SIMA 0.3.1 still available online, and if so is it possible to run both versions on the same system? (for instance one for faster alignment and one for more complex analyses).

Best,

Rune

Patrick Kaifosh

unread,
Apr 20, 2015, 5:45:39 PM4/20/15
to sima-...@googlegroups.com
Yes. Old versions of SIMA are still available online (just change the version number in the urls for PyPI or our documentation). It is possible to install both versions on the same system using virtualenv.

Rune Enger

unread,
Apr 21, 2015, 4:41:54 AM4/21/15
to sima-...@googlegroups.com
Thanks, Patrick, the virtualenv worked well! A 512x512 two channel 5000 frames session takes about 2 hrs with the SIMA1.1.1 vs. 30-35 min with the 0.3.1 on my system. 

Best,
Rune


Reply all
Reply to author
Forward
0 new messages