[Matplotlib-users] best way to browse images

2014-10-14 Thread Slavin, Jonathan
Hi all,

In my work lately I have often wanted to browse through a series of
images.  This means displaying the image(s), looking at it/them and then
continuing.  I have coded this in a few different ways, but it is generally
pretty slow -- which is to say that the image display takes more than a
couple seconds (~4) after I tell it to continue to the next image.  I
tested the loop without image display and it was a factor of ~80 times
faster than it was with image display, so it's doesn't have anything to do
with reading the images from disk.  My latest approach is basically:
first = True
fig = plt.figure()
for file in imagefiles:
# read in image data (fits files)
if first:
ax = fig.add_suplot(1,1,1)
im = ax.imshow(image)
else:
im.set_data(image)
ans = raw_input('continue?')
if ans == 'n':
break

Is there a more efficient way to do this?

Regards,
Jon

-- 

Jonathan D. Slavin Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu   60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
fax: (617) 496-7577USA

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Benjamin Root
What is happening is that you are not telling the image to redraw, so you
are only seeing it refresh for other reasons. Try adding a fig.draw() call
prior to the raw_input() call.

Cheers!
Ben Root

On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan jsla...@cfa.harvard.edu
wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Benjamin Root
Also, you aren't updating first after the first call, so it is constantly
making new axes and recalling imshow().

Ben Root

On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu wrote:

 What is happening is that you are not telling the image to redraw, so you
 are only seeing it refresh for other reasons. Try adding a fig.draw() call
 prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Slavin, Jonathan
Hi Ben,

Sorry, in my little example, I left out a few things.  I do update first
after the first call.  And I do call draw() after other calls.  So here is
a more accurate representation of what I do:

first = True
fig = plt.figure()
for file in files:
hdu = fits.open(file)
image = hdu[0].data
hdu.close()
if first:
ax = fig,add_subplot(1,1,1)
im = ax.imshow(image)
plt.show()
first = False
else:
im.set_data(image)
plt.draw()
ans = raw_input('continue?')
if ans == 'n':
break

Jon


On Tue, Oct 14, 2014 at 10:42 AM, Benjamin Root ben.r...@ou.edu wrote:

 Also, you aren't updating first after the first call, so it is
 constantly making new axes and recalling imshow().

 Ben Root

 On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu wrote:

 What is happening is that you are not telling the image to redraw, so you
 are only seeing it refresh for other reasons. Try adding a fig.draw() call
 prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users






-- 

Jonathan D. Slavin Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu   60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
fax: (617) 496-7577USA

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Slavin, Jonathan
Hmm.  I just saw that you suggest fig.draw().  Is there a difference with
plt.draw()?

Jon

On Tue, Oct 14, 2014 at 11:20 AM, Slavin, Jonathan jsla...@cfa.harvard.edu
wrote:

 Hi Ben,

 Sorry, in my little example, I left out a few things.  I do update first
 after the first call.  And I do call draw() after other calls.  So here is
 a more accurate representation of what I do:

 first = True
 fig = plt.figure()
 for file in files:
 hdu = fits.open(file)
 image = hdu[0].data
 hdu.close()
 if first:
 ax = fig,add_subplot(1,1,1)
 im = ax.imshow(image)
 plt.show()
 first = False
 else:
 im.set_data(image)
 plt.draw()
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Jon


 On Tue, Oct 14, 2014 at 10:42 AM, Benjamin Root ben.r...@ou.edu wrote:

 Also, you aren't updating first after the first call, so it is
 constantly making new axes and recalling imshow().

 Ben Root

 On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu wrote:

 What is happening is that you are not telling the image to redraw, so
 you are only seeing it refresh for other reasons. Try adding a fig.draw()
 call prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users






 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 




-- 

Jonathan D. Slavin Harvard-Smithsonian CfA
jsla...@cfa.harvard.edu   60 Garden Street, MS 83
phone: (617) 496-7981   Cambridge, MA 02138-1516
fax: (617) 496-7577USA

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Benjamin Root
Only if there are multiple figures (plt.draw() operates on the current
active figure, while fig.draw() explicitly operates upon that figure).
Another possibility is that the bottleneck truly is the IO. Depending on
exactly how fits work, it might be lazily loading data for you, so the test
without the display of the images might not actually be loading any data
into memory.

Ben Root

On Tue, Oct 14, 2014 at 11:22 AM, Slavin, Jonathan jsla...@cfa.harvard.edu
wrote:

 Hmm.  I just saw that you suggest fig.draw().  Is there a difference with
 plt.draw()?

 Jon

 On Tue, Oct 14, 2014 at 11:20 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi Ben,

 Sorry, in my little example, I left out a few things.  I do update first
 after the first call.  And I do call draw() after other calls.  So here is
 a more accurate representation of what I do:

 first = True
 fig = plt.figure()
 for file in files:
 hdu = fits.open(file)
 image = hdu[0].data
 hdu.close()
 if first:
 ax = fig,add_subplot(1,1,1)
 im = ax.imshow(image)
 plt.show()
 first = False
 else:
 im.set_data(image)
 plt.draw()
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Jon


 On Tue, Oct 14, 2014 at 10:42 AM, Benjamin Root ben.r...@ou.edu wrote:

 Also, you aren't updating first after the first call, so it is
 constantly making new axes and recalling imshow().

 Ben Root

 On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu wrote:

 What is happening is that you are not telling the image to redraw, so
 you are only seeing it refresh for other reasons. Try adding a fig.draw()
 call prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is 
 generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users






 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 




 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Chris Beaumont
I've found that, for big images, the *first* draw is very slow, due to the
intensity scaling of the image, which happens at full resolution. Panning
and zooming afterwards is fast because the intensity scaling is cached, but
changing the data array or updating the norm kwarg is slow again. I made
ModestImage (https://github.com/ChrisBeaumont/mpl-modest-image) to deal
with this -- it dynamically downsamples images to screen resolution. This
makes the first draw after updating the data or norm much faster, while
slowing down subsequent redraws. Perhaps this could help you out?

cheers,
chris

On Tue, Oct 14, 2014 at 12:08 PM, Benjamin Root ben.r...@ou.edu wrote:

 Only if there are multiple figures (plt.draw() operates on the current
 active figure, while fig.draw() explicitly operates upon that figure).
 Another possibility is that the bottleneck truly is the IO. Depending on
 exactly how fits work, it might be lazily loading data for you, so the test
 without the display of the images might not actually be loading any data
 into memory.

 Ben Root

 On Tue, Oct 14, 2014 at 11:22 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hmm.  I just saw that you suggest fig.draw().  Is there a difference with
 plt.draw()?

 Jon

 On Tue, Oct 14, 2014 at 11:20 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi Ben,

 Sorry, in my little example, I left out a few things.  I do update first
 after the first call.  And I do call draw() after other calls.  So here is
 a more accurate representation of what I do:

 first = True
 fig = plt.figure()
 for file in files:
 hdu = fits.open(file)
 image = hdu[0].data
 hdu.close()
 if first:
 ax = fig,add_subplot(1,1,1)
 im = ax.imshow(image)
 plt.show()
 first = False
 else:
 im.set_data(image)
 plt.draw()
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Jon


 On Tue, Oct 14, 2014 at 10:42 AM, Benjamin Root ben.r...@ou.edu wrote:

 Also, you aren't updating first after the first call, so it is
 constantly making new axes and recalling imshow().

 Ben Root

 On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu
 wrote:

 What is happening is that you are not telling the image to redraw, so
 you are only seeing it refresh for other reasons. Try adding a fig.draw()
 call prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is 
 generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to 
 do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users






 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 




 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 




 

[Matplotlib-users] v1.4.1rc1

2014-10-14 Thread Thomas Caswell
I am happy to announce that I have tagged a release candidate for
1.4.1.  This is a bug-fix release which fixes most of the bug that
popped up in 1.4.0 including:

 - setup.py does not die when freetype is not installed
 - reverts the changes to interactive plotting so `ion` will work as expected
 - sundry unicode fixes (looking up user folders, importing
seaborn/pandas/networkx with macosx backend
 - fixed boxplot regressions

The tarball is available from github, sourceforge and can be install via

   pip install matplotlib==1.4.1rc1

Tom



-- 
Thomas Caswell
tcasw...@gmail.com

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best way to browse images

2014-10-14 Thread Slavin, Jonathan
Hi Chris,

Thanks for that tip.  I'll give it a try.  They are big images (2048 x
2048) so it seems like your suggestion should work.

Jon

On Tue, Oct 14, 2014 at 12:18 PM, Chris Beaumont cbeaum...@cfa.harvard.edu
wrote:

 I've found that, for big images, the *first* draw is very slow, due to the
 intensity scaling of the image, which happens at full resolution. Panning
 and zooming afterwards is fast because the intensity scaling is cached, but
 changing the data array or updating the norm kwarg is slow again. I made
 ModestImage (https://github.com/ChrisBeaumont/mpl-modest-image) to deal
 with this -- it dynamically downsamples images to screen resolution. This
 makes the first draw after updating the data or norm much faster, while
 slowing down subsequent redraws. Perhaps this could help you out?

 cheers,
 chris

 On Tue, Oct 14, 2014 at 12:08 PM, Benjamin Root ben.r...@ou.edu wrote:

 Only if there are multiple figures (plt.draw() operates on the current
 active figure, while fig.draw() explicitly operates upon that figure).
 Another possibility is that the bottleneck truly is the IO. Depending on
 exactly how fits work, it might be lazily loading data for you, so the test
 without the display of the images might not actually be loading any data
 into memory.

 Ben Root

 On Tue, Oct 14, 2014 at 11:22 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hmm.  I just saw that you suggest fig.draw().  Is there a difference
 with plt.draw()?

 Jon

 On Tue, Oct 14, 2014 at 11:20 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi Ben,

 Sorry, in my little example, I left out a few things.  I do update
 first after the first call.  And I do call draw() after other calls.  So
 here is a more accurate representation of what I do:

 first = True
 fig = plt.figure()
 for file in files:
 hdu = fits.open(file)
 image = hdu[0].data
 hdu.close()
 if first:
 ax = fig,add_subplot(1,1,1)
 im = ax.imshow(image)
 plt.show()
 first = False
 else:
 im.set_data(image)
 plt.draw()
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Jon


 On Tue, Oct 14, 2014 at 10:42 AM, Benjamin Root ben.r...@ou.edu
 wrote:

 Also, you aren't updating first after the first call, so it is
 constantly making new axes and recalling imshow().

 Ben Root

 On Tue, Oct 14, 2014 at 10:41 AM, Benjamin Root ben.r...@ou.edu
 wrote:

 What is happening is that you are not telling the image to redraw, so
 you are only seeing it refresh for other reasons. Try adding a fig.draw()
 call prior to the raw_input() call.

 Cheers!
 Ben Root

 On Tue, Oct 14, 2014 at 10:03 AM, Slavin, Jonathan 
 jsla...@cfa.harvard.edu wrote:

 Hi all,

 In my work lately I have often wanted to browse through a series of
 images.  This means displaying the image(s), looking at it/them and then
 continuing.  I have coded this in a few different ways, but it is 
 generally
 pretty slow -- which is to say that the image display takes more than a
 couple seconds (~4) after I tell it to continue to the next image.  I
 tested the loop without image display and it was a factor of ~80 times
 faster than it was with image display, so it's doesn't have anything to 
 do
 with reading the images from disk.  My latest approach is basically:
 first = True
 fig = plt.figure()
 for file in imagefiles:
 # read in image data (fits files)
 if first:
 ax = fig.add_suplot(1,1,1)
 im = ax.imshow(image)
 else:
 im.set_data(image)
 ans = raw_input('continue?')
 if ans == 'n':
 break

 Is there a more efficient way to do this?

 Regards,
 Jon

 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 



 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push
 notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users






 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden Street, MS 83
 phone: (617) 496-7981   Cambridge, MA 02138-1516
 fax: (617) 496-7577USA
 




 --
 
 Jonathan D. Slavin Harvard-Smithsonian CfA
 jsla...@cfa.harvard.edu   60 Garden 

Re: [Matplotlib-users] wind vector plot from grb2 files

2014-10-14 Thread Benjamin Root
So, you need to know what tools to use to read in grib2 data? There are two
particular grib readers that I am familiar with: PyNIO and pygrib2. PyNIO
actually isn't a grib reader, as much as a swiss army knife of file
readers. It is very similar to the netcdf4 interface, so if you are
familiar with that, then PyNIO is very nice in that respect. Unfortunately,
PyNIO is not available through pypi. You have to go directly to their
website, sign up and download it directly from them.

Oh, and may god have mercy on your soul if you have to build from source
for either PyNIO or pygrib2... try the binaries if possible.

Ben Root

On Tue, Oct 14, 2014 at 1:09 AM, Sourav Chatterjee srv@gmail.com
wrote:

 Can somebody help me to plot the wind vectors in spstere projection
 reading data from a grb2 file *without using Dataset (netcdf4*)?

 Thanks
 Sourav


 --
 Comprehensive Server Monitoring with Site24x7.
 Monitor 10 servers for $9/Month.
 Get alerted through email, SMS, voice calls or mobile push notifications.
 Take corrective actions from your mobile device.
 http://p.sf.net/sfu/Zoho
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users