Re: [Matplotlib-users] Spooling up on matplotlib .... run all the examples

2014-04-20 Thread Eric Firing
On 2014/04/17 11:07 AM, Elden Crom wrote:
>
> matplotlib is impressive in its capabilities, I didn't realize how much so
> until I download from the git, and made a little script to run all of the
> examples.
>

Thank you.

It's hidden away, but a script to do this type of thing exists.  For a 
long time it was effectively our testing mechanism--run all the examples 
and scan the results to see if they looked right.  It is 
examples/tests/backend_driver.py.

Eric

> I'm way too much of a newbie here to check anything in, but I thought
> someone may find this trinket useful.  As written, it should be in the
> 'matplotlib/examples' directory named 'runAll.py', if someone is so inclined
> to check it in.  Feel free to edit or eviscerate it or whatever.
>
> --
> #!/usr/bin/python
> ###
> ##
> ##  REVISION HISTORY
> ##DateNameSCR#Description
> ##    --
> 
> ##  2014-04-17  Elden CromN#A Initial Release
> ###
>
> import subprocess, os
>
> ###To make the demos work that needed sample data I had to
> ### 'cp /etc/matplotlibrc ~/.matplotlib/'  and edit the examples.directory
> ###  entry to not have the extra tick marks ie
> ### """examples.directory : /usr/share/matplotlib/sampledata"""
> ### but I think this was because of a version issue
>
> dirs = [root for root, dir, files in os.walk(".")]
> #dirs = ['./showcase', './widgets']  #to only run a directory or two
>
> excluded = ['./runAll.py','./tests/backend_driver.py']
> def myfilter(d,f):
>  fpth = os.path.join(d,f)
>  return (os.path.isfile(fpth) and
>  f.endswith('.py') and
>  not fpth in excluded)
> pyfiles =[]
> for d in dirs:
>  pyfiles.extend([ (d,f) for f in os.listdir(d) if myfilter(d,f) ])
>
> #there are over 400 examples in the git repository
> #[git clone git://github.com/matplotlib/matplotlib.git]/matplotlib/examples
> #so you might not want to see them all in one setting!
> #pyfiles=pyfiles[100+100:]
>
> for i,(d,f) in enumerate(pyfiles):
>  print "Executing 'python %s'--(%d of
> %d)--"%(os.path.join(d,f),i,len(pyfiles))
>  subprocess.Popen(["python", f],cwd=d).wait()
>
>
>
>
>
>
>
> --
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Spooling up on matplotlib .... run all the examples

2014-04-17 Thread Elden Crom

matplotlib is impressive in its capabilities, I didn't realize how much so
until I download from the git, and made a little script to run all of the
examples.

I'm way too much of a newbie here to check anything in, but I thought
someone may find this trinket useful.  As written, it should be in the
'matplotlib/examples' directory named 'runAll.py', if someone is so inclined
to check it in.  Feel free to edit or eviscerate it or whatever.

--
#!/usr/bin/python
###
##
##  REVISION HISTORY
##DateNameSCR#Description
##    -- 

##  2014-04-17  Elden CromN#A Initial Release
###

import subprocess, os

###To make the demos work that needed sample data I had to 
### 'cp /etc/matplotlibrc ~/.matplotlib/'  and edit the examples.directory 
###  entry to not have the extra tick marks ie
### """examples.directory : /usr/share/matplotlib/sampledata"""
### but I think this was because of a version issue

dirs = [root for root, dir, files in os.walk(".")] 
#dirs = ['./showcase', './widgets']  #to only run a directory or two
 
excluded = ['./runAll.py','./tests/backend_driver.py']
def myfilter(d,f):
fpth = os.path.join(d,f)
return (os.path.isfile(fpth) and 
f.endswith('.py') and
not fpth in excluded)
pyfiles =[]
for d in dirs: 
pyfiles.extend([ (d,f) for f in os.listdir(d) if myfilter(d,f) ])

#there are over 400 examples in the git repository
#[git clone git://github.com/matplotlib/matplotlib.git]/matplotlib/examples
#so you might not want to see them all in one setting!
#pyfiles=pyfiles[100+100:]  

for i,(d,f) in enumerate(pyfiles):
print "Executing 'python %s'--(%d of
%d)--"%(os.path.join(d,f),i,len(pyfiles))
subprocess.Popen(["python", f],cwd=d).wait()







--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users