From c7a8ded7c85647624eb9bbfdb0da27d00fd31b39 Mon Sep 17 00:00:00 2001 From: Stephan Kuschel Date: Thu, 11 Dec 2014 18:51:02 +0100 Subject: [PATCH] add example tree a simple example using fake data will be started by the run-tests script. --- .gitignore | 2 ++ doc/getstarted.rst | 2 +- doc/dummyexample.py => examples/simpleexample.py | 7 ++++++- run-tests | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) rename doc/dummyexample.py => examples/simpleexample.py (91%) diff --git a/.gitignore b/.gitignore index 5f66a2db..62918e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ build/ dist/ doc/_build + +*.png diff --git a/doc/getstarted.rst b/doc/getstarted.rst index 645782cb..a4ea4659 100644 --- a/doc/getstarted.rst +++ b/doc/getstarted.rst @@ -5,5 +5,5 @@ Getting started The following script should just show an example how to get started using the postpic postprocessor. This script uses the dummy reader (thus auto generated random data). Thats why there is no input file needed to read the simulation data from. -.. literalinclude:: dummyexample.py +.. literalinclude:: ../examples/simpleexample.py :language: python diff --git a/doc/dummyexample.py b/examples/simpleexample.py similarity index 91% rename from doc/dummyexample.py rename to examples/simpleexample.py index d47719cf..7518f557 100755 --- a/doc/dummyexample.py +++ b/examples/simpleexample.py @@ -7,7 +7,12 @@ pp.datareader.chooseCode('dummy') dr = pp.datareader.readDump(3e5) # Dummyreader takes a float as argument, not a string. -plotter = pp.plotting.plottercls(dr, outdir='', autosave=True) +savedir = '_examplepictures/' +import os +if not os.path.exists(savedir): + os.mkdir(savedir) + +plotter = pp.plotting.plottercls(dr, outdir=savedir, autosave=True) fa = pp.analyzer.FieldAnalyzer(dr) from postpic.analyzer import ParticleAnalyzer as PA diff --git a/run-tests b/run-tests index 2505ccf8..82a3033b 100755 --- a/run-tests +++ b/run-tests @@ -18,6 +18,9 @@ exitonfailure () { nosetests exitonfailure $? +examples/simpleexample.py +exitonfailure $? + pep8 postpic --statistics --count --show-source --ignore=W391,E123,E226,E24 --max-line-length=99 exitonfailure $?