data#
import pawian.data
Data module of Pawian Tools.
This module allows you to parse and analyze ASCII data files of momentum tuples. The files have the following form:
0.99407
-0.00357645 0.0962561 0.0181079 0.170545
0.224019 0.623156 0.215051 1.99057
-0.174404 -0.719412 -0.233159 2.0243
0.990748
-0.0328198 0.0524406 0.0310079 0.155783
-0.619592 0.141315 0.32135 1.99619
0.698477 -0.193756 -0.352357 2.03593
The lines with single values are weights, but do not have to be present. Whitespaces are arbitrary.
The allows you to import the ASCII file to a nicely formatted
DataFrame
that has additional PWA methods in the form of
DataFrame
accessors.
- class PwaAccessor(pandas_object: PandasObject)[source]#
Bases:
object
PWA-specific accessor for a
DataFrame
.Additional namespace to interpret DataFrame as Pawian style dataframe, see Extending pandas.
- create_skeleton_frame(particle_names: Iterable[str] | None = None, number_of_rows: int | None = None) DataFrame [source]#
Create skeleton
DataFrame
.Create an empty
DataFrame
that complies with the standards of the registeredPwaAccessor
.
- read_ascii(filename: str, particles: list[str] | int | None = None, **kwargs: Any) DataFrame [source]#
Import from a Pawian-like ASCII file.
- Parameters:
filename – The name of the file to read.
particles – A list of particles to read. If
None
, all particles are read. Ifint
, column names for the particles are numbered.kwargs – Additional keyword arguments to pass to
pandas.read_table()
.