New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #979 : No figures in DKI example - Add new line after figure #981

Merged
merged 1 commit into from Apr 6, 2016

Conversation

Projects
None yet
5 participants
@sahmed95
Contributor

sahmed95 commented Mar 20, 2016

Edit: New line required after figure word directive in examples.
Commenting out savefig() in the example should render the plots in sphinx.

@sahmed95 sahmed95 referenced this pull request Mar 20, 2016

Closed

No figures in DKI example #979

@arokem

This comment has been minimized.

Member

arokem commented Mar 20, 2016

Did you run the makefile to make sure the html renders properly with this fix?

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 20, 2016

Hi, I was building the docs using sphinx. But the datasets are taking a long time to download. Maybe someone who's working on the website can take a look and this can be resolved faster. @ghoshbishakh ?

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Mar 20, 2016

You can comment (using #) the examples that you do not need in dipy/doc/examples/valid_examples.txt and cd doc; make clean; make html
In this way it will be much faster to check how the tutorial that you are interested is renderered.

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 20, 2016

Thanks. I will run the makefile and see if the plots are rendering fine. 😄

@arokem arokem referenced this pull request Mar 21, 2016

Closed

No figures in DKI example #990

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

Any update on this?

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 23, 2016

Hi, I commented and ran the make file. But I get stuck everytime at "Downloading "HARDI150.nii.gz" to /home/shahnawaz/.dipy/stanford_hardi"

I am trying to figure out if its an issue with my connection or something to do with the large file size. I tried to separately download the file from the link but it shows that file doesn't exist. I am also not able to download sherbrooke_3shell. So I went to the site from fetcher

Again ran into a 404 in dropbox

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

Using just the links on these lines shouldn't work. The links should be used like this:

"https://stacks.stanford.edu/file/druid:yx282xq2090/dwi.nii.gz"
"https://stacks.stanford.edu/file/druid:yx282xq2090/dwi.bvals"
"https://stacks.stanford.edu/file/druid:yx282xq2090/dwi.bvecs"
"https://dl.dropboxusercontent.com/u/2481924/sherbrooke_data/3shells-1000-2000-3500-N193.nii.gz"

etc.

That said, I do think there's a problem with the recent changes to the fetcher. I'm looking into that right now.

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

I hope the progressbar change did not break anything here

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

Alas, I think it has. I am getting this:

In [2]: ans = dpd.read_stanford_hardi()
Creating new folder /Users/arokem/.dipy/stanford_hardi
Downloading "HARDI150.bval" to /Users/arokem/.dipy/stanford_hardi
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-bc0742ca9134> in <module>()
----> 1 ans = dpd.read_stanford_hardi()

/Users/arokem/source/dipy/dipy/data/fetcher.py in read_stanford_hardi()
    466         GradientTable
    467     """
--> 468     files, folder = fetch_stanford_hardi()
    469     fraw = pjoin(folder, 'HARDI150.nii.gz')
    470     fbval = pjoin(folder, 'HARDI150.bval')

/Users/arokem/source/dipy/dipy/data/fetcher.py in fetcher()
    207             files[n] = (baseurl + f, md5_list[i] if
    208                         md5_list is not None else None)
--> 209         fetch_data(files, folder)
    210 
    211         if msg is not None:

/Users/arokem/source/dipy/dipy/data/fetcher.py in fetch_data(files, folder)
    159         all_skip = False
    160         _log('Downloading "%s" to %s' % (f, folder))
--> 161         _get_file_data(fullpath, url)
    162         check_md5(fullpath, md5)
    163     if all_skip:

/Users/arokem/source/dipy/dipy/data/fetcher.py in _get_file_data(fname, url)
    118     with contextlib.closing(urlopen(url)) as opener:
    119         if sys.version_info[0] < 3:
--> 120             response_size = opener.headers['content-length']
    121         else:
    122             # python3.x

/Users/arokem/anaconda/envs/py2/lib/python2.7/rfc822.pyc in __getitem__(self, name)
    391     def __getitem__(self, name):
    392         """Get a specific header, as from a dictionary."""
--> 393         return self.dict[name.lower()]
    394 
    395     def __setitem__(self, name, value):

KeyError: 'content-length'
@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 23, 2016

Might just be a connection issue on my side. I will try to manually
download the files and see. The progress bar is a great feature btw... I
have been staring at the blank line on my terminal for the last 30 mins. :-(
On 23-Mar-2016 11:59 PM, "Bishakh Ghosh" notifications@github.com wrote:

I hope the progressbar change did not break anything here


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#981 (comment)

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

aaah looking into it!!

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

steps to regenerate the issue?

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

On Python2 (might that be the issue?), move the data folder out of the way. Then:

import dipy.data as dpd
ans = dpd.read_stanford_hardi()
@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 23, 2016

Yeah. I was running it in Python2.7. Another point to be noted is I can
download the bvalue file. So it might be something with the file headers in
the .nii file.
On 24-Mar-2016 12:13 AM, "Ariel Rokem" notifications@github.com wrote:

On Python2 (might that be the issue?), move the data folder out of the
way. Then:

import dipy.data as dpd
ans = dpd.read_stanford_hardi()


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#981 (comment)

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

ok got the problem. trying to fix it asap! seems sometimes http headers dont have the content-length

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

so downloading:
https://stacks.stanford.edu/file/druid:yx282xq2090/dwi.nii.gz
from the browser also does not show the size.

@arokem what do you recommend doing here.

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

So this would never work for this data, correct? What data-set does it work well for?

@ghoshbishakh

This comment has been minimized.

Member

ghoshbishakh commented Mar 23, 2016

So it depends on the server from which it is being served. Simply if we try to download the dataset from the browser using the link and the browser cannot predict the size of the download then it will also not work here, i.e the content-length header is missing.

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 23, 2016

Should we open a new issue for this ?

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

Yes - let's move this conversation to #1014

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 23, 2016

I ran into one more issue in reconst_dti.py. By commenting all the other files as suggested by @Garyfallidis I got this when I run make html for only reconst_dti.py

Computing anisotropy measures (FA, MD, RGB)
Computing tensor ellipsoids in a part of the splenium of the CC
Traceback (most recent call last):
  File "../tools/make_examples.py", line 123, in <module>
    execfile(script, namespace)
  File "reconst_dti.py", line 219, in <module>
    ren = fvtk.ren()
AttributeError: 'module' object has no attribute 'ren'
make: *** [rstexamples-stamp] Error 1

The issues arises from

ren = fvtk.ren 

and the corresponding import is found here

have_fvtk comes from the optional package

@arokem

This comment has been minimized.

Member

arokem commented Mar 23, 2016

Do you have VTK installed? That error often get's thrown when you don't
have VTK: https://neurostars.org/p/3724/#3726

On Wed, Mar 23, 2016 at 4:08 PM, Shahnawaz Ahmed notifications@github.com
wrote:

I ran into one more issue in reconst_dti.py. By commenting all the other
files as suggested by @Garyfallidis https://github.com/Garyfallidis I
got this when I run make html for only reconst_dti.py

Computing anisotropy measures (FA, MD, RGB)
Computing tensor ellipsoids in a part of the splenium of the CC
Traceback (most recent call last):
File "../tools/make_examples.py", line 123, in
execfile(script, namespace)
File "reconst_dti.py", line 219, in
ren = fvtk.ren()AttributeError: 'module' object has no attribute 'ren'
make: *** [rstexamples-stamp] Error 1

The issues arises from python ren = fvtk.ren and the corresponding import
is found here
https://github.com/nipy/dipy/blob/master/dipy/viz/fvtk.py#L68

have_fvtk comes from the optional package
https://github.com/nipy/dipy/blob/master/dipy/viz/fvtk.py#L33


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#981 (comment)

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 24, 2016

I tried "make html" but the images are not rendering with plt.show() and commenting savefig(). So I went to the other examples reconst.dti and saw that fvtk is used for rendering plots. Why is the case different here?

@arokem @Garyfallidis Any suggestions? Should this example be rewritten along the lines of other examples with fvtk?

@sahmed95 sahmed95 changed the title from Fixes 979, commented savefig() to Fixes #979 : No figures in DKI example - commented savefig() Mar 26, 2016

@arokem

This comment has been minimized.

Member

arokem commented Mar 28, 2016

There are several examples that use matplotlib, without a hitch. For example: http://nipy.org/dipy/examples_built/brain_extraction_dwi.html#example-brain-extraction-dwi

@arokem

This comment has been minimized.

Member

arokem commented Mar 28, 2016

So no - I wouldn't change this to use fvtk. We can certainly use matplotlib here as well.

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Mar 28, 2016

Ok. Thanks. I will see why it is not rendering here with matplotlib.

@sahmed95 sahmed95 force-pushed the sahmed95:issue-979 branch from 5ad1e2f to 09de8a1 Apr 6, 2016

@sahmed95

This comment has been minimized.

Contributor

sahmed95 commented Apr 6, 2016

@arokem @Garyfallidis Solved the plotting issue. I didn't have to remove savefig(). It was just a matter of incorrect syntax for rst files. According to the documentation, after the figure directive, there should be a new line before image description. I tried make html and got the plots.

The power of a "\n" !! Got a good nice intro to sphinx 😄

@arokem

This comment has been minimized.

Member

arokem commented Apr 6, 2016

Fantastic! They don't call it "sphinx" for nothing - cryptic, mysterious and powerful! @Garyfallidis : do we have a plan for merging upstream fixes into the current web-page? Do we cherry pick these fixes into maint/0.11.x and build the website from that?

@arokem arokem merged commit 1fbb7ae into nipy:master Apr 6, 2016

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@manu-tej

This comment has been minimized.

Contributor

manu-tej commented Apr 6, 2016

That was the same problem for #1024

@arokem

This comment has been minimized.

Member

arokem commented Apr 6, 2016

Also white-space, but seems to be in a different part of the file...

@sahmed95 sahmed95 changed the title from Fixes #979 : No figures in DKI example - commented savefig() to Fixes #979 : No figures in DKI example - ~~commented savefig()~~ Add new line Apr 7, 2016

@sahmed95 sahmed95 changed the title from Fixes #979 : No figures in DKI example - ~~commented savefig()~~ Add new line to Fixes #979 : No figures in DKI example - Add new line after figure Apr 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment