soft-matter / trackpy-examples

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

show image command is missing #10

Closed kedmond closed 9 years ago

kedmond commented 9 years ago

In the walkthrough, at In [6]:, you simply write "frames[0]" when I think that you meant to write plt.imshow(frames[0]) or Image.fromarray(frames[0]).show(). You need a function to show the image.

danielballan commented 9 years ago

Hi @kedmond, thanks for the note.

The walkthrough takes advantage of some nice display features unique to the IPython notebook. In a notebook, the last expression in an input cell is automatically displayed as output. And in the case of frames[0], that output should be automatically represented as an embedded PNG image. (The code Image.fromarray ... that generates that PNG is included in Frame's _repr_png_ method, which IPython knows to look for.)

If you are not working in the notebook and you want to see frames[0] as an image then, yes, you will need to make the plot or the Image yourself.

Does this address your issue? Are you working in the notebook but not seeing the expected output from frames[0]?

kedmond commented 9 years ago

Woah....I get it now. Yeah, I was surprised that you'd make a mistake like that. So this makes more sense. I'm using the notebook viewer here: http://nbviewer.ipython.org/github/soft-matter/trackpy-examples/blob/master/notebooks/walkthrough.ipynb

I am new to notebooks, so I don't know how else to view them. :-)

But yeah, the PNG image definitely showed up for me. But yeah, in the python console, you need to execute a function, as you said.

Thanks for the explanation!

On Thu Nov 06 2014 at 17:13:59 Dan Allan notifications@github.com wrote:

Hi @kedmond https://github.com/kedmond, thanks for the note.

The walkthrough takes advantage of some nice display features unique to the IPython notebook. In a notebook, the last expression in an input cell is automatically displayed as output. And in the case of frames[0], that output should be automatically represented as an embedded PNG image. (The code Image.fromarray ... that generates that PNG is included in Frame's _reprpng method, which IPython knows to look for.)

If you are not working in the notebook and you want to see frames[0] as an image then, yes, you will need to make the plot or the Image yourself.

Does this address your issue? Are you working in the notebook but not seeing the expected output from frames[0]?

— Reply to this email directly or view it on GitHub https://github.com/soft-matter/trackpy-examples/issues/10#issuecomment-62014936 .

danielballan commented 9 years ago

Great. FYI, you can create and view your own notebooks by typing ipython notebook into a command prompt or Terminal; that will launch a web browser.