Skip to content

Commit

Permalink
Dumpreader_ifc inherits high level functions from FieldAnalyzer
Browse files Browse the repository at this point in the history
The Dumpreader_ifc (and thus any Dumpreader) inherits all the high level
functions from the FieldAnalyzer. The Files are still kept separate to
make the diffenrent abstraction levels more obvious. Anyways, there is
no need to call the FieldAnalyzer directly anymore.
  • Loading branch information
skuschel committed Feb 3, 2015
1 parent ff401e3 commit a5d577f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 4 additions & 7 deletions examples/simpleexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
# project name will be prepended to all output names
plotter = pp.plotting.plottercls(dr, outdir=savedir, autosave=True, project='simpleexample')

# create the field analyzer to access field data (E and B fields) easily
fa = pp.analyzer.FieldAnalyzer(dr)

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

Expand All @@ -35,10 +32,10 @@

if True:
# Plot Data from the FieldAnalyzer fa. This is very simple: every line creates one plot
plotter.plotField(fa.Ex()) # plot 0
plotter.plotField(fa.Ey()) # plot 1
plotter.plotField(fa.Ez()) # plot 2
plotter.plotField(fa.energydensityEM()) # plot 3
plotter.plotField(dr.Ex()) # plot 0
plotter.plotField(dr.Ey()) # plot 1
plotter.plotField(dr.Ez()) # plot 2
plotter.plotField(dr.energydensityEM()) # plot 3

# Using the ParticleAnalyzer requires an additional step:
# 1) The ParticleAnalyzer.createField method will be used to create a Field object
Expand Down
4 changes: 3 additions & 1 deletion postpic/analyzer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
Analyzer package provides Classes and functions for analyzing
Particle and Field Data.
"""

from analyzer import *
from particles import ParticleAnalyzer
from fields import FieldAnalyzer

__all__ = ['ParticleAnalyzer', 'FieldAnalyzer', 'identifyspecies']
__all__ += analyzer.__all__

identifyspecies = analyzer.SpeciesIdentifier.identifyspecies
4 changes: 3 additions & 1 deletion postpic/datareader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@
import numpy as np
from .. import _const
from .. import datahandling as dh
from ..analyzer import FieldAnalyzer

# --- Interface ---


class Dumpreader_ifc(object):
class Dumpreader_ifc(FieldAnalyzer):
'''
Interface class for reading a single dump. A dump contains informations
about the simulation at a single timestep (Usually E- and B-Fields on
Expand Down Expand Up @@ -88,6 +89,7 @@ class Dumpreader_ifc(object):
__metaclass__ = abc.ABCMeta

def __init__(self, dumpidentifier, name=None):
super(Dumpreader_ifc, self).__init__(self)
self.dumpidentifier = dumpidentifier
self._name = name

Expand Down

0 comments on commit a5d577f

Please sign in to comment.