incf-nidash / nidmresults-fsl

A python library to export FSL's feat results to NIDM-Results
http://nidm.nidash.org/specs/nidm-results.html
MIT License
3 stars 10 forks source link

bug: nidm-results_fsl command fails after install #39

Closed nicholsn closed 9 years ago

nicholsn commented 9 years ago

I'm getting the following error when I call the script - looks like a hard coding to the python dir

(test)12:21:15 ~/Downloads$ nidm-results_fsl -h
bash: /Users/nolan/miniconda/envs/test/bin/nidm-results_fsl: /Users/cmaumet/anaconda/bin/python: bad interpreter: No such file or directory
cmaumet commented 9 years ago

Weird... I am not sure where this reference to cmaumet is coming from... Thanks for pointing this out, I will have a look!

The script should actually be called with:

nidmfsl PATH_TO_FEAT_DIRECTORY

(i.e. nidmfsl instead of nidm-results_fsl)

Could you try that and let me know if you get the same error?

Also did you do the install with pip install? Did that part work fine?

Thank you for the feedback.

nicholsn commented 9 years ago

​pip install worked great!

Although running 'nidmfsl -h' results in:

(test)01:20:50 ~/Downloads$ nidmfsl -h
Traceback (most recent call last):
  File "/Users/nolan/miniconda/envs/test/bin/nidmfsl", line 12, in <module>
    from nidmfsl.fsl_exporter.fsl_exporter import FSLtoNIDMExporter
  File
"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl/fsl_exporter/fsl_exporter.py",
line 28, in <module>
    from nidmresults.exporter import NIDMExporter
  File
"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/exporter.py",
line 18, in <module>
    from nidmresults.objects.inference import *
  File
"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/objects/inference.py",
line 15, in <module>
    from scipy.stats import norm
ImportError: No module named scipy.stats

So may need to add scipy as a requirement.

Do you have a example feat directory I can download​?

On Mon, Jun 1, 2015 at 12:38 PM, Camille Maumet notifications@github.com wrote:

Weird... I am not sure where this reference to cmaumet is coming from... Thanks for pointing this out, I will have a look!

The script should actually be called with:

nidmfsl PATH_TO_FEAT_DIRECTORY

(i.e. nidmfsl instead of nidm-results_fsl)

Could you try that and let me know if you get the same error?

Also did you do the install with pip install? Did that part work fine?

Thank you for the feedback.

— Reply to this email directly or view it on GitHub https://github.com/incf-nidash/nidm-results_fsl/issues/39#issuecomment-107680304 .

nicholst commented 9 years ago

I have some that I can send... Nolan I'll send you the links directly... anyone can ask me for them... it's 6 fMRI feat studies of my brain...

On Mon, Jun 1, 2015 at 9:24 PM, Nolan Nichols notifications@github.com wrote:

​pip install worked great!

Although running 'nidmfsl -h' results in:

(test)01:20:50 ~/Downloads$ nidmfsl -h
Traceback (most recent call last):
File "/Users/nolan/miniconda/envs/test/bin/nidmfsl", line 12, in <module>
from nidmfsl.fsl_exporter.fsl_exporter import FSLtoNIDMExporter
File

"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl/fsl_exporter/fsl_exporter.py",
line 28, in <module>
from nidmresults.exporter import NIDMExporter
File

"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/exporter.py",
line 18, in <module>
from nidmresults.objects.inference import *
File

"/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/objects/inference.py",
line 15, in <module>
from scipy.stats import norm
ImportError: No module named scipy.stats

So may need to add scipy as a requirement.

Do you have a example feat directory I can download​?

On Mon, Jun 1, 2015 at 12:38 PM, Camille Maumet notifications@github.com wrote:

Weird... I am not sure where this reference to cmaumet is coming from... Thanks for pointing this out, I will have a look!

The script should actually be called with:

nidmfsl PATH_TO_FEAT_DIRECTORY

(i.e. nidmfsl instead of nidm-results_fsl)

Could you try that and let me know if you get the same error?

Also did you do the install with pip install? Did that part work fine?

Thank you for the feedback.

— Reply to this email directly or view it on GitHub < https://github.com/incf-nidash/nidm-results_fsl/issues/39#issuecomment-107680304

.

— Reply to this email directly or view it on GitHub https://github.com/incf-nidash/nidm-results_fsl/issues/39#issuecomment-107696177 .


Thomas Nichols, PhD Professor, Head of Neuroimaging Statistics Department of Statistics & Warwick Manufacturing Group University of Warwick, Coventry CV4 7AL, United Kingdom

Web: http://warwick.ac.uk/tenichols Email: t.e.nichols@warwick.ac.uk Tel, Stats: +44 24761 51086, WMG: +44 24761 50752 Fx, +44 24 7652 4532

dbkeator commented 9 years ago

Hi,

I installed the export tool as well and it seems to work for me. I will track down some FSL analyses and test…

Dave

cmaumet commented 9 years ago

Just for info, the FSL tutorials also include some examples of feat directories, for example in this archive under fmri/ptt.

cmaumet commented 9 years ago

@nicholsn: thank you for pointing out the missing import of scipy: #42 is now open to check for missing requirements.

nicholsn commented 9 years ago

ok, so I used a feat dir from @nicholst and it looks like the base path is extracted from the feat directory rather than from my local system (i.e., I didn't run this feat on my laptop and it gets confused)

(test)02:36:48 ~/Downloads$ nidmfsl VerbalFluency_NoSm.feat
VerbalFluency_NoSm.feat
Traceback (most recent call last):
  File "/Users/nolan/miniconda/envs/test/bin/nidmfsl", line 4, in <module>
    __import__('pkg_resources').run_script('nidmfsl==0.1.0', 'nidmfsl')
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/__init__.py", line 729, in run_script

  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/__init__.py", line 1642, in run_script

  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/EGG-INFO/scripts/nidmfsl", line 27, in <module>
    fslnidm.parse()
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 110, in parse
    super(FSLtoNIDMExporter, self).parse()
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/exporter.py", line 70, in parse
    self.model_fittings = self._find_model_fitting()
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 141, in _find_model_fitting
    design_matrix = self._get_design_matrix(analysis_dir)
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 489, in _get_design_matrix
    aa = np.loadtxt(onset['file'])
  File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/numpy/lib/npyio.py", line 738, in loadtxt
    fh = iter(open(fname, 'U'))
IOError: [Errno 2] No such file or directory: '/Users/nichols/UW/UHCW/PilotStudy/fMRI_2011_11_27-7/BEHAVIOR/VerbFlu_Generate.dat'
nicholst commented 9 years ago

Ah... That's the path to the onsets from the design.fsf... Ug... Not sure what we can do about that aside from assume they are in the right place. I don't think FSL copies them into the feat directory.

Anyway, I'll recreate these examples tomorrow with relative paths to the onsets in design.fsf (& include them in the tarball).

On Jun 2, 2015, at 10:39 PM, Nolan Nichols notifications@github.com wrote:

ok, so I used a feat dir from @nicholst and it looks like the base path is extracted from the feat directory rather than from my local system (i.e., I didn't run this feat on my laptop and it gets confused)

(test)02:36:48 ~/Downloads$ nidmfsl VerbalFluency_NoSm.feat VerbalFluency_NoSm.feat Traceback (most recent call last): File "/Users/nolan/miniconda/envs/test/bin/nidmfsl", line 4, in import('pkg_resources').run_script('nidmfsl==0.1.0', 'nidmfsl') File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/init.py", line 729, in run_script

File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/init.py", line 1642, in run_script

File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/EGG-INFO/scripts/nidmfsl", line 27, in fslnidm.parse() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 110, in parse super(FSLtoNIDMExporter, self).parse() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/exporter.py", line 70, in parse self.model_fittings = self._find_model_fitting() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 141, in _find_model_fitting design_matrix = self._get_design_matrix(analysis_dir) File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 489, in _get_design_matrix aa = np.loadtxt(onset['file']) File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/numpy/lib/npyio.py", line 738, in loadtxt fh = iter(open(fname, 'U')) IOError: [Errno 2] No such file or directory: '/Users/nichols/UW/UHCW/PilotStudy/fMRI_2011_11_27-7/BEHAVIOR/VerbFlu_Generate.dat' — Reply to this email directly or view it on GitHub.

nicholsn commented 9 years ago

sounds like a plan

On Tue, Jun 2, 2015 at 3:25 PM, Thomas Nichols notifications@github.com wrote:

Ah... That's the path to the onsets from the design.fsf... Ug... Not sure what we can do about that aside from assume they are in the right place. I don't think FSL copies them into the feat directory.

Anyway, I'll recreate these examples tomorrow with relative paths to the onsets in design.fsf (& include them in the tarball).

On Jun 2, 2015, at 10:39 PM, Nolan Nichols notifications@github.com wrote:

ok, so I used a feat dir from @nicholst and it looks like the base path is extracted from the feat directory rather than from my local system (i.e., I didn't run this feat on my laptop and it gets confused)

(test)02:36:48 ~/Downloads$ nidmfsl VerbalFluency_NoSm.feat VerbalFluency_NoSm.feat Traceback (most recent call last): File "/Users/nolan/miniconda/envs/test/bin/nidmfsl", line 4, in import('pkg_resources').run_script('nidmfsl==0.1.0', 'nidmfsl') File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/init.py", line 729, in run_script

File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/setuptools-17.0-py2.7.egg/pkg_resources/init.py", line 1642, in run_script

File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/EGG-INFO/scripts/nidmfsl", line 27, in fslnidm.parse() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 110, in parse super(FSLtoNIDMExporter, self).parse() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmresults/exporter.py", line 70, in parse self.model_fittings = self._find_model_fitting() File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 141, in _find_model_fitting design_matrix = self._get_design_matrix(analysis_dir) File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/nidmfsl-0.1.0-py2.7.egg/nidmfsl/fsl_exporter/fsl_exporter.py", line 489, in _get_design_matrix aa = np.loadtxt(onset['file']) File "/Users/nolan/miniconda/envs/test/lib/python2.7/site-packages/numpy/lib/npyio.py", line 738, in loadtxt fh = iter(open(fname, 'U')) IOError: [Errno 2] No such file or directory: '/Users/nichols/UW/UHCW/PilotStudy/fMRI_2011_11_27-7/BEHAVIOR/VerbFlu_Generate.dat'

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/incf-nidash/nidm-results_fsl/issues/39#issuecomment-108115815 .

nicholst commented 9 years ago

OK! Here is a patch that supplies the missing onset (3 column) files, placed in each analysis directory, and updated design.fsf files that delete the absolute paths for these specific files. I hesitated whether to make the path "./" or "AnalysisDir.feat/", but in the end used none ("").

https://www.dropbox.com/s/p567ngs0mr58yzv/patch.tgz?dl=0

cmaumet commented 9 years ago

I concur with Tom: the absolute path must be used because the design files are not copied over in the feat directory. And unless I missed something, accessing the onset file is the only way to find out if the design is event-related/block-based or mixed... A workaround would be to not fill in this information if the file is not accessible... But I am not sure if that's what we want to do... I have open #44 to report this issue.

Can you open separate issues if you find more bugs? Thank you!

nicholsn commented 9 years ago

Can you open separate issues if you find more bugs? Thank you! Sure, hopefully its ok that I briefly continue the onsets discussion here.

@nicholst, thanks for the patch. I started working off of the VerbalFluency_NoSm.feat but the patch you sent only includes the updated fsf and I still receive the same error due to absolute paths to the onset files.

In #44, I see that @cmaumet suggested adding a warning. Perhaps there could be a nidm:UnknownDesignType that simply points to the absolute path, but we can continue the discussion there.

cmaumet commented 9 years ago

The issue regarding the nidm-results_fsl script mentioning "cmaumet" is resolved in nidmfsl 0.2.0 now available on pypi.