Skip to content

Commit

Permalink
shortcut frequently used functions and classes
Browse files Browse the repository at this point in the history
ParticleAnalyzer, identifyspecies, chooseCode, readDump and readSim are
now directly accessible from postpic (no need to point to the sub
packages).
  • Loading branch information
skuschel committed Feb 3, 2015
1 parent a5d577f commit 992d286
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/simpleexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@


# choose the dummy reader. This reader will create fake data for testing.
pp.datareader.chooseCode('dummy')
pp.chooseCode('dummy')

dr = pp.datareader.readDump(3e5) # Dummyreader takes a float as argument, not a string.
dr = pp.readDump(3e5) # Dummyreader takes a float as argument, not a string.
# set and create directory for pictures.
savedir = '_examplepictures/'
import os
Expand All @@ -25,7 +25,7 @@
plotter = pp.plotting.plottercls(dr, outdir=savedir, autosave=True, project='simpleexample')

# we will need a refrence to the ParticleAnalyzer quite often
from postpic.analyzer import ParticleAnalyzer as PA
from postpic import ParticleAnalyzer as PA

# create ParticleAnalyzer for every particle species that exists.
pas = [PA(dr, s) for s in dr.listSpecies()]
Expand Down
7 changes: 7 additions & 0 deletions postpic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@

__all__ = ['datareader', 'analyzer', 'plotting']

# high level functions
from analyzer import ParticleAnalyzer, identifyspecies
__all__ += ['ParticleAnalyzer', 'identifyspecies']

from datareader import chooseCode, readDump, readSim
__all__ += ['chooseCode', 'readDump', 'readSim']

# read version from installed metadata
from pkg_resources import get_distribution, DistributionNotFound
try:
Expand Down

0 comments on commit 992d286

Please sign in to comment.