postpic.particles package

class postpic.particles.ScalarProperty(expr, name=None, unit=None, symbol=None)[source]

Bases: object

__iter__()[source]
evaluate(vars)[source]

vars must be a dictionary containing variables used within the expression “expr”.

expr
input_names

The list of variables used within this expression.

name
symbol
unit
class postpic.particles.MultiSpecies(dumpreader, *speciess, **kwargs)[source]

Bases: object

The MultiSpecies class. Different MultiSpecies can be added together to create a combined collection.

ignore_missing_species = False
set to true to ignore missing species.

The MultiSpecies class will return a list of values for every particle property.

Ekin()[source]

Deprecated since version unknown: The function Ekin is deprecated. Use self(“Ekin”) instead.

Ekin_MeV()[source]

Deprecated since version unknown: The function Ekin_MeV is deprecated. Use self(“Ekin_MeV”) instead.

Ekin_MeV_amu()[source]

Deprecated since version unknown: The function Ekin_MeV_amu is deprecated. Use self(“Ekin_MeV_amu”) instead.

Ekin_MeV_qm()[source]

Deprecated since version unknown: The function Ekin_MeV_qm is deprecated. Use self(“Ekin_MeV_qm”) instead.

Ekin_keV()[source]

Deprecated since version unknown: The function Ekin_keV is deprecated. Use self(“Ekin_keV”) instead.

Ekin_keV_amu()[source]

Deprecated since version unknown: The function Ekin_keV_amu is deprecated. Use self(“Ekin_keV_amu”) instead.

Ekin_keV_qm()[source]

Deprecated since version unknown: The function Ekin_keV_qm is deprecated. Use self(“Ekin_keV_qm”) instead.

Eruhe()[source]

Deprecated since version unknown: The function Eruhe is deprecated. Use self(“Eruhe”) instead.

ID()[source]

Deprecated since version unknown: The function ID is deprecated. Use self(“id”) instead.

P()[source]

Deprecated since version unknown: The function P is deprecated. Use self(“p”) instead.

Px()[source]

Deprecated since version unknown: The function Px is deprecated. Use self(“px”) instead.

Py()[source]

Deprecated since version unknown: The function Py is deprecated. Use self(“py”) instead.

Pz()[source]

Deprecated since version unknown: The function Pz is deprecated. Use self(“pz”) instead.

V()[source]

Deprecated since version unknown: The function V is deprecated. Use self(“v”) instead.

Vx()[source]

Deprecated since version unknown: The function Vx is deprecated. Use self(“vx”) instead.

Vy()[source]

Deprecated since version unknown: The function Vy is deprecated. Use self(“vy”) instead.

Vz()[source]

Deprecated since version unknown: The function Vz is deprecated. Use self(“vz”) instead.

X()[source]

Deprecated since version unknown: The function X is deprecated. Use self(“x”) instead.

X_um()[source]

Deprecated since version unknown: The function X_um is deprecated. Use self(“x_um”) instead.

Y()[source]

Deprecated since version unknown: The function Y is deprecated. Use self(“y”) instead.

Y_um()[source]

Deprecated since version unknown: The function Y_um is deprecated. Use self(“Y_mu”) instead.

Z()[source]

Deprecated since version unknown: The function Z is deprecated. Use self(“z”) instead.

Z_um()[source]

Deprecated since version unknown: The function Z_um is deprecated. Use self(“z_um”) instead.

__add__(other)[source]

Operator overloading for the + operator.

Returns:A new MultiSpecies object containing the combined collection of particles.

Note

Particles present in self and other will be present twice in the returned object!

__call__(expr)[source]

Access to particle properties via the expression, which is used to calculate them.

This is only function to actually access the data. Every other function which allows data access must call this one internally!

Supported types
  • ScalarProperty
  • str: will be converted to a ScalarProperty by particle_scalars.__call__. Therefore known quantities will be recognized
  • callable, which acts on the MultiSpecies object. This will work, but maybe removed in a future release.

The list of known particle scalars can be accessed by postpic.particle_scalars.

Examples
  • self('x')
  • self('sqrt(px**2 + py**2 + pz**2)')
Variable resolution order
  1. try to find the value as a atomic particle property.
  2. try to find the value as a defined particle property in particle_scalars.
  3. if not found look for an equally named attribute in scipy.constants.
__copy__()[source]

returns a shallow copy of the object. This method is called by copy.copy(obj).

__iadd__(other)[source]

Operator overloading for the += operator. Adding MultiSpecies should give the feeling as if you were adding their particle lists. That is why there is no append function. Compare those outputs (numpy.array handles that differently!):

>>> a=[1,2,3]; a.append([4,5]); print a
>>> [1,2,3,[4,5]]
>>> a=[1,2,3]; a += [4,5]; print a
>>> [1,2,3,4,5]

This function modifies the current object. Same behaviour as

>>> a = [1,2]; b = a; b+=[7,8]; print(a,b)
>>> [1, 2, 7, 8] [1, 2, 7, 8]

See also

__add__()

__invert__()[source]

invert the selection of particles.

add(dumpreader, species, ignore_missing_species=False)[source]

adds a species to this MultiSpecies. This function modifies the current Object and always returns None.

species can be a single species name

or a reserved name for collection of species, such as ions adds all available particles that are ions nonions adds all available particles that are not ions ejected noejected all

Optional arguments
--------
ignore_missing_species = False

set to True to ignore if the species is missing.

angle_xaxis()[source]

Deprecated since version unknown: The function angle_xaxis is deprecated. Use self(“angle_xaxis”) instead.

angle_xy()[source]

Deprecated since version unknown: The function angle_xy is deprecated. Use self(“angle_xy”) instead.

angle_xz()[source]

Deprecated since version unknown: The function angle_xz is deprecated. Use self(“angle_xz”) instead.

angle_yx()[source]

Deprecated since version unknown: The function angle_yx is deprecated. Use self(“angle_yx”) instead.

angle_yz()[source]

Deprecated since version unknown: The function angle_yz is deprecated. Use self(“angle_yz”) instead.

angle_zx()[source]

Deprecated since version unknown: The function angle_zx is deprecated. Use self(“angle_zx”) instead.

angle_zy()[source]

Deprecated since version unknown: The function angle_zy is deprecated. Use self(“angle_zy”) instead.

beta()[source]

Deprecated since version unknown: The function beta is deprecated. Use self(“beta”) instead.

betax()[source]

Deprecated since version unknown: The function betax is deprecated. Use self(“betax”) instead.

betay()[source]

Deprecated since version unknown: The function betay is deprecated. Use self(“betay”) instead.

betaz()[source]

Deprecated since version unknown: The function betaz is deprecated. Use self(“betaz”) instead.

charge()[source]

Deprecated since version unknown: The function charge is deprecated. Use self(“charge”) instead.

charge_e()[source]

Deprecated since version unknown: The function charge_e is deprecated. Use self(“charge_e”) instead.

compress(condition, name='unknown condition')[source]

works like numpy.compress. Additionaly you can specify a name, that gets saved in the compresslog. Returns a new MultiSpecies instance. compress gives you a lot of control, but in most cases filter() will be sufficient and keeps your code more readable.

Parameters:
  • condition (1D numpy array) –

    Condition can be one out of two choices:

    • condition = [True, False, True, True, … , True, False]

      condition is a list of length N, specifing which particles to keep. The length of the list must be equal to the length of the MultiSpecies instance, otherwise a ValueError is raised. Example:

      >>> cfintospectrometer = lambda ms: ms('abs(angle_xaxis) < 30e-3')
      >>> ms2 = ms.compress(cfintospectrometer(ms), name='< 30mrad offaxis')
      

      Consider using filter() instead.

    • condtition = [7, 2000, 4, 5, 91, … , 765, 809]

      condition can be a list of arbitraty length. Only the particles with the ids listed here will be kept.

  • name (str, optional) – an optional name of the condition. This can later be reviewed by calling ‘self.compresslog()’
compressfn(conditionf, name='unknown condition')[source]

like compress(), but accepts a function.

Returns a new MultiSpecies instance.

createField(*sps, **kwargs)[source]

Creates an n-d Histogram enclosed in a Field object.

Parameters:
  • *sps – list of scalarfunctions/strings/scalar-properties, that will be evaluated to data for each axis. the number of args given determins the dimensionality of the field returned by this function (maximum 3)
  • name (string, optional) – addes a name. usually used for generating savenames. Defaults to “distfn”.
  • title (string, options) – overrides the title. Autocreated if title==None. Defaults to None.
  • simgrid (boolean, optional) – enforces the same grid as used in the simulation. Implies simextent=True. Defaults to False.
  • simextent (boolean, optional) – enforces, that the axis show the same extent as used in the simulation. Defaults to False.
  • weights (function, optional) – applies additional weights to the macroparticles, for example ‘gamma’ or ‘q’ to weight the particle by its charge. Defaults to ‘1’ (no additional weight).
  • rangex (list of two values, optional) – the xrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • rangey (list of two values, optional) – the yrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • rangez (list of two values, optional) – the zrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • bins (sequence or int) – The number of bins to use for each dimension
  • shape (int) – possible choices are: * 0 - use nearest grid point (NGP) * 1 - use tophat shape of width 1 bin * 2 - triangular shape (default) * 3 - spline 3 shape
dumpreader

returns the dumpreader if the dumpreader of all species are pointing to the same dump. This should be mostly the case.

Otherwise returns None.

filter(condition, name=None)[source]

like compress(), but takes a ScalarProperty object instead which is required to evalute to a boolean list. Example:

>>> ms2 = ms.filter('gamma > 12')
Parameters:condition (str) – A string, which can also be used at ms(condition) and evaluates
gamma()[source]

Deprecated since version unknown: The function gamma is deprecated. Use self(“gamma”) instead.

gamma_m1()[source]

Deprecated since version unknown: The function gamma_m1 is deprecated. Use self(“gamma_m1”) instead.

getcompresslog()[source]
initial_npart

Original number of particles (before the use of compression or filter).

mass()[source]

Deprecated since version unknown: The function mass is deprecated. Use self(“mass”) instead.

mass_u()[source]

Deprecated since version unknown: The function mass_u is deprecated. Use self(“mass_u”) instead.

mean(expr, weights=None)[source]

The mean of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

median(expr, weights=None)[source]

The median of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

name

an alias to self.species

npart

Number of Particles.

nspecies

Number of species.

quantile(expr, q, weights=None)[source]

The qth-quantile of the distribution of a value given by the expression expr. q can be a scalar or a list of quantiles to be calculated simultaneously. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

r_xy()[source]

Deprecated since version unknown: The function r_xy is deprecated. Use self(“r_xy”) instead.

r_xyz()[source]

Deprecated since version unknown: The function r_xyz is deprecated. Use self(“r_xyz”) instead.

r_yz()[source]

Deprecated since version unknown: The function r_yz is deprecated. Use self(“r_yz”) instead.

r_zx()[source]

Deprecated since version unknown: The function r_zx is deprecated. Use self(“r_zx”) instead.

simextent(axis)[source]

the combined simextent for all species and dumps included in this MultiSpecies object.

simgridpoints(axis)[source]

this function is for convenience only and is likely to be removed in the future. Particlarly it is impossible to define the grid of the simulation if the MultiSpecies object consists of multiple dumps from different simulations.

species

returns an string name for the species involved. Basically only returns unique names from all species (used for plotting and labeling purposes – not for completeness). May be overwritten.

speciess

a complete list of all species involved.

time()[source]

Deprecated since version unknown: The function time is deprecated. Use self(“time”) instead.

uncompress()[source]

Returns a new MultiSpecies instance, with all previous calls of compress() or filter() undone.

var(expr, weights='1')[source]

The variance of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

weight()[source]

Deprecated since version unknown: The function weight is deprecated. Use self(“weight”) instead.

class postpic.particles.ParticleHistory(sr, speciess, ids=None)[source]

Bases: object

Represents a list of particles including their history that can be found in all the dumps defined by the simulation reader sr.

Parameters:
  • sr (iterable of datareader) – a collection of datareader to use. Usually a Simulationreader object
  • speciess (string or iterable of strings) – a species name or a list of species names. Those particles can be included into the history.
  • ids (iterable of int) – list of ids to use (default: None). If this is None all particles in speciess will be tracked. If a list of ids is given, these ids will be serached in speciess only.
__copy__()[source]

returns a shallow copy of the object. This method is called by copy.copy(obj).

collect(*scalarfs)[source]

Collects the given particle properties for all particles for all times.

*scalarfs: the scalarfunction(s) defining the particle property

numpy.ndarray holding the different particles in the same order as the list of self.ids, meaning the particle on position particle_idx has the ID self.ids[particle_idx]. every array element holds the history for a single particle. Indexorder of returned array: [particle_idx][scalarf_idx, collection_idx]

skip(n)[source]

takes only everth (n+1)-th particle

postpic.particles.histogramdd(data, **kwargs)[source]

Creates a histogram of the data. This function has the similar signature and return values as numpy.histogramdd. In addition this function supports the shape keyword argument to choose the particle shape used. If used with shape=0 the results of this function and the numpy.histogramdd are identical, however, this function is approx. factor 2 or 3 faster.

Parameters:
  • data (sequence of ndarray or ndarray (1D or 2D)) –
    The input (particle) data for the histogram.
    • A 1D numpy array (for 1D histogram).
    • A sequence providing the data for the different axis, i.e. (datax, datay, dataz) (preferred).
    • A (N, D)-array, i.e. [[x1, y1, z1], [x2, y2, z2]] – must be a numpy array!
  • bins (sequence or int) – The number of bins to use for each dimension
  • range (sequence, optional) – A sequence of lower and upper bin edges to be used if the edges are not given explicitly in bins. Defaults to the minimum and maximum values along each dimension.
  • weights (1D numpy array) – The weights to be used for each data point
  • shape (int) –
    possible choices are:
    • 0 - use nearest grid point (NGP)
    • 1 - use tophat shape of width 1 bin
    • 2 - triangular shape (default)
    • 3 - spline 3 shape
Returns:

  • H (ndarray) – the final histogram
  • edges (list) – A list of D arrays describing the edges for each dimension

class postpic.particles.SpeciesIdentifier[source]

Bases: postpic.helper.PhysicalConstants

This Class provides static methods for deriving particle properties from species Names. The only reason for this to be a class is that it can be used as a mixin.

classmethod identifyspecies(species)[source]

Returns a dictionary containing particle informations deduced from the species name. The following keys in the dictionary will always be present: name species name string mass kg (SI) charge C (SI) tracer boolean ejected boolean

Valid Examples: Periodic Table symbol + charge state: c6, F2, H1, C6b ionm#c# defining mass and charge: ionm12c2, ionc20m110 advanced examples: ejected_tracer_ionc5m20b, ejected_tracer_electronx, ejected_c6b, tracer_proton, protonb

static isejected(species)[source]
classmethod ision(species)[source]

Submodules

postpic.particles.particles module

Particle related routines.

class postpic.particles.particles.MultiSpecies(dumpreader, *speciess, **kwargs)[source]

Bases: object

The MultiSpecies class. Different MultiSpecies can be added together to create a combined collection.

ignore_missing_species = False
set to true to ignore missing species.

The MultiSpecies class will return a list of values for every particle property.

Ekin()[source]

Deprecated since version unknown: The function Ekin is deprecated. Use self(“Ekin”) instead.

Ekin_MeV()[source]

Deprecated since version unknown: The function Ekin_MeV is deprecated. Use self(“Ekin_MeV”) instead.

Ekin_MeV_amu()[source]

Deprecated since version unknown: The function Ekin_MeV_amu is deprecated. Use self(“Ekin_MeV_amu”) instead.

Ekin_MeV_qm()[source]

Deprecated since version unknown: The function Ekin_MeV_qm is deprecated. Use self(“Ekin_MeV_qm”) instead.

Ekin_keV()[source]

Deprecated since version unknown: The function Ekin_keV is deprecated. Use self(“Ekin_keV”) instead.

Ekin_keV_amu()[source]

Deprecated since version unknown: The function Ekin_keV_amu is deprecated. Use self(“Ekin_keV_amu”) instead.

Ekin_keV_qm()[source]

Deprecated since version unknown: The function Ekin_keV_qm is deprecated. Use self(“Ekin_keV_qm”) instead.

Eruhe()[source]

Deprecated since version unknown: The function Eruhe is deprecated. Use self(“Eruhe”) instead.

ID()[source]

Deprecated since version unknown: The function ID is deprecated. Use self(“id”) instead.

P()[source]

Deprecated since version unknown: The function P is deprecated. Use self(“p”) instead.

Px()[source]

Deprecated since version unknown: The function Px is deprecated. Use self(“px”) instead.

Py()[source]

Deprecated since version unknown: The function Py is deprecated. Use self(“py”) instead.

Pz()[source]

Deprecated since version unknown: The function Pz is deprecated. Use self(“pz”) instead.

V()[source]

Deprecated since version unknown: The function V is deprecated. Use self(“v”) instead.

Vx()[source]

Deprecated since version unknown: The function Vx is deprecated. Use self(“vx”) instead.

Vy()[source]

Deprecated since version unknown: The function Vy is deprecated. Use self(“vy”) instead.

Vz()[source]

Deprecated since version unknown: The function Vz is deprecated. Use self(“vz”) instead.

X()[source]

Deprecated since version unknown: The function X is deprecated. Use self(“x”) instead.

X_um()[source]

Deprecated since version unknown: The function X_um is deprecated. Use self(“x_um”) instead.

Y()[source]

Deprecated since version unknown: The function Y is deprecated. Use self(“y”) instead.

Y_um()[source]

Deprecated since version unknown: The function Y_um is deprecated. Use self(“Y_mu”) instead.

Z()[source]

Deprecated since version unknown: The function Z is deprecated. Use self(“z”) instead.

Z_um()[source]

Deprecated since version unknown: The function Z_um is deprecated. Use self(“z_um”) instead.

__add__(other)[source]

Operator overloading for the + operator.

Returns:A new MultiSpecies object containing the combined collection of particles.

Note

Particles present in self and other will be present twice in the returned object!

__call__(expr)[source]

Access to particle properties via the expression, which is used to calculate them.

This is only function to actually access the data. Every other function which allows data access must call this one internally!

Supported types
  • ScalarProperty
  • str: will be converted to a ScalarProperty by particle_scalars.__call__. Therefore known quantities will be recognized
  • callable, which acts on the MultiSpecies object. This will work, but maybe removed in a future release.

The list of known particle scalars can be accessed by postpic.particle_scalars.

Examples
  • self('x')
  • self('sqrt(px**2 + py**2 + pz**2)')
Variable resolution order
  1. try to find the value as a atomic particle property.
  2. try to find the value as a defined particle property in particle_scalars.
  3. if not found look for an equally named attribute in scipy.constants.
__copy__()[source]

returns a shallow copy of the object. This method is called by copy.copy(obj).

__iadd__(other)[source]

Operator overloading for the += operator. Adding MultiSpecies should give the feeling as if you were adding their particle lists. That is why there is no append function. Compare those outputs (numpy.array handles that differently!):

>>> a=[1,2,3]; a.append([4,5]); print a
>>> [1,2,3,[4,5]]
>>> a=[1,2,3]; a += [4,5]; print a
>>> [1,2,3,4,5]

This function modifies the current object. Same behaviour as

>>> a = [1,2]; b = a; b+=[7,8]; print(a,b)
>>> [1, 2, 7, 8] [1, 2, 7, 8]

See also

__add__()

__invert__()[source]

invert the selection of particles.

add(dumpreader, species, ignore_missing_species=False)[source]

adds a species to this MultiSpecies. This function modifies the current Object and always returns None.

species can be a single species name

or a reserved name for collection of species, such as ions adds all available particles that are ions nonions adds all available particles that are not ions ejected noejected all

Optional arguments
--------
ignore_missing_species = False

set to True to ignore if the species is missing.

angle_xaxis()[source]

Deprecated since version unknown: The function angle_xaxis is deprecated. Use self(“angle_xaxis”) instead.

angle_xy()[source]

Deprecated since version unknown: The function angle_xy is deprecated. Use self(“angle_xy”) instead.

angle_xz()[source]

Deprecated since version unknown: The function angle_xz is deprecated. Use self(“angle_xz”) instead.

angle_yx()[source]

Deprecated since version unknown: The function angle_yx is deprecated. Use self(“angle_yx”) instead.

angle_yz()[source]

Deprecated since version unknown: The function angle_yz is deprecated. Use self(“angle_yz”) instead.

angle_zx()[source]

Deprecated since version unknown: The function angle_zx is deprecated. Use self(“angle_zx”) instead.

angle_zy()[source]

Deprecated since version unknown: The function angle_zy is deprecated. Use self(“angle_zy”) instead.

beta()[source]

Deprecated since version unknown: The function beta is deprecated. Use self(“beta”) instead.

betax()[source]

Deprecated since version unknown: The function betax is deprecated. Use self(“betax”) instead.

betay()[source]

Deprecated since version unknown: The function betay is deprecated. Use self(“betay”) instead.

betaz()[source]

Deprecated since version unknown: The function betaz is deprecated. Use self(“betaz”) instead.

charge()[source]

Deprecated since version unknown: The function charge is deprecated. Use self(“charge”) instead.

charge_e()[source]

Deprecated since version unknown: The function charge_e is deprecated. Use self(“charge_e”) instead.

compress(condition, name='unknown condition')[source]

works like numpy.compress. Additionaly you can specify a name, that gets saved in the compresslog. Returns a new MultiSpecies instance. compress gives you a lot of control, but in most cases filter() will be sufficient and keeps your code more readable.

Parameters:
  • condition (1D numpy array) –

    Condition can be one out of two choices:

    • condition = [True, False, True, True, … , True, False]

      condition is a list of length N, specifing which particles to keep. The length of the list must be equal to the length of the MultiSpecies instance, otherwise a ValueError is raised. Example:

      >>> cfintospectrometer = lambda ms: ms('abs(angle_xaxis) < 30e-3')
      >>> ms2 = ms.compress(cfintospectrometer(ms), name='< 30mrad offaxis')
      

      Consider using filter() instead.

    • condtition = [7, 2000, 4, 5, 91, … , 765, 809]

      condition can be a list of arbitraty length. Only the particles with the ids listed here will be kept.

  • name (str, optional) – an optional name of the condition. This can later be reviewed by calling ‘self.compresslog()’
compressfn(conditionf, name='unknown condition')[source]

like compress(), but accepts a function.

Returns a new MultiSpecies instance.

createField(*sps, **kwargs)[source]

Creates an n-d Histogram enclosed in a Field object.

Parameters:
  • *sps – list of scalarfunctions/strings/scalar-properties, that will be evaluated to data for each axis. the number of args given determins the dimensionality of the field returned by this function (maximum 3)
  • name (string, optional) – addes a name. usually used for generating savenames. Defaults to “distfn”.
  • title (string, options) – overrides the title. Autocreated if title==None. Defaults to None.
  • simgrid (boolean, optional) – enforces the same grid as used in the simulation. Implies simextent=True. Defaults to False.
  • simextent (boolean, optional) – enforces, that the axis show the same extent as used in the simulation. Defaults to False.
  • weights (function, optional) – applies additional weights to the macroparticles, for example ‘gamma’ or ‘q’ to weight the particle by its charge. Defaults to ‘1’ (no additional weight).
  • rangex (list of two values, optional) – the xrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • rangey (list of two values, optional) – the yrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • rangez (list of two values, optional) – the zrange to include into the histogram. Defaults to None, determins the range by the range of scalars given.
  • bins (sequence or int) – The number of bins to use for each dimension
  • shape (int) – possible choices are: * 0 - use nearest grid point (NGP) * 1 - use tophat shape of width 1 bin * 2 - triangular shape (default) * 3 - spline 3 shape
dumpreader

returns the dumpreader if the dumpreader of all species are pointing to the same dump. This should be mostly the case.

Otherwise returns None.

filter(condition, name=None)[source]

like compress(), but takes a ScalarProperty object instead which is required to evalute to a boolean list. Example:

>>> ms2 = ms.filter('gamma > 12')
Parameters:condition (str) – A string, which can also be used at ms(condition) and evaluates
gamma()[source]

Deprecated since version unknown: The function gamma is deprecated. Use self(“gamma”) instead.

gamma_m1()[source]

Deprecated since version unknown: The function gamma_m1 is deprecated. Use self(“gamma_m1”) instead.

getcompresslog()[source]
initial_npart

Original number of particles (before the use of compression or filter).

mass()[source]

Deprecated since version unknown: The function mass is deprecated. Use self(“mass”) instead.

mass_u()[source]

Deprecated since version unknown: The function mass_u is deprecated. Use self(“mass_u”) instead.

mean(expr, weights=None)[source]

The mean of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

median(expr, weights=None)[source]

The median of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

name

an alias to self.species

npart

Number of Particles.

nspecies

Number of species.

quantile(expr, q, weights=None)[source]

The qth-quantile of the distribution of a value given by the expression expr. q can be a scalar or a list of quantiles to be calculated simultaneously. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

r_xy()[source]

Deprecated since version unknown: The function r_xy is deprecated. Use self(“r_xy”) instead.

r_xyz()[source]

Deprecated since version unknown: The function r_xyz is deprecated. Use self(“r_xyz”) instead.

r_yz()[source]

Deprecated since version unknown: The function r_yz is deprecated. Use self(“r_yz”) instead.

r_zx()[source]

Deprecated since version unknown: The function r_zx is deprecated. Use self(“r_zx”) instead.

simextent(axis)[source]

the combined simextent for all species and dumps included in this MultiSpecies object.

simgridpoints(axis)[source]

this function is for convenience only and is likely to be removed in the future. Particlarly it is impossible to define the grid of the simulation if the MultiSpecies object consists of multiple dumps from different simulations.

species

returns an string name for the species involved. Basically only returns unique names from all species (used for plotting and labeling purposes – not for completeness). May be overwritten.

speciess

a complete list of all species involved.

time()[source]

Deprecated since version unknown: The function time is deprecated. Use self(“time”) instead.

uncompress()[source]

Returns a new MultiSpecies instance, with all previous calls of compress() or filter() undone.

var(expr, weights='1')[source]

The variance of a value given by the expression expr. The particle weight of the individual particles will be automatically included in the calculation. An additional weight can be given using the keyword weights.

weight()[source]

Deprecated since version unknown: The function weight is deprecated. Use self(“weight”) instead.

class postpic.particles.particles.ParticleHistory(sr, speciess, ids=None)[source]

Bases: object

Represents a list of particles including their history that can be found in all the dumps defined by the simulation reader sr.

Parameters:
  • sr (iterable of datareader) – a collection of datareader to use. Usually a Simulationreader object
  • speciess (string or iterable of strings) – a species name or a list of species names. Those particles can be included into the history.
  • ids (iterable of int) – list of ids to use (default: None). If this is None all particles in speciess will be tracked. If a list of ids is given, these ids will be serached in speciess only.
__copy__()[source]

returns a shallow copy of the object. This method is called by copy.copy(obj).

collect(*scalarfs)[source]

Collects the given particle properties for all particles for all times.

*scalarfs: the scalarfunction(s) defining the particle property

numpy.ndarray holding the different particles in the same order as the list of self.ids, meaning the particle on position particle_idx has the ID self.ids[particle_idx]. every array element holds the history for a single particle. Indexorder of returned array: [particle_idx][scalarf_idx, collection_idx]

skip(n)[source]

takes only everth (n+1)-th particle

postpic.particles.scalarproperties module

class postpic.particles.scalarproperties.ScalarProperty(expr, name=None, unit=None, symbol=None)[source]

Bases: object

__iter__()[source]
evaluate(vars)[source]

vars must be a dictionary containing variables used within the expression “expr”.

expr
input_names

The list of variables used within this expression.

name
symbol
unit