Problematic
When you deal with phase space analysis, the philosophy is often the same :
Import data from a file or generate it with defined laws
Make calculations with this raw data (kinetic energy, divergence, …)
Filter some of it (divergence with a condition on energy, …)
Make histograms
Make fits
Plot results
Format the axes
It is often long and leads to many programmation errors, and when there is a need to compare several set of datas, it become more and more complicated.
p2sat objective is to unify a set of phase space data in a single object, and give all the needed methods to manipulate and analyse these datas.
This way the analysis and comparison of several sources need much less efforts and physicists can do what they like to do : physics.
Package Structure
All the package structure relies on one single object : PhaseSpace.
This object is a “box” containing all the informations about a given particle phase space, and all the methods to interact with it (make histograms, statistics or plots).
Once you create such object, the data it contains are isolated from the rest of your script (see examples below to show how to acess data), so there is no risk of confuse between different data sources. This object-oriented approach is so completely coherent when you need to compare data from several simulation files for examples : the methods you use are the same, only the instances names are changing.
Particle phase space
The phase space of a set of particles gives the most complete description of a dynamical system (assuming particles are independant), and all the needed informations can be reconstructed from it.
This phase space contains informations such as particles positions, momentum and time. There is also given a statistical weight to each configuration. The phase space is then a 7D space (3 for momentum, 3 for space, 1 for time). If it is discretized, this represent a tremendous amount of possible configurations, so give a statistical weight to EACH of them is not the good approach. The p2sat approach is to save only the informations on configurations that have a non-zero statistical weight, and list them, one configuration per line. To have access to a given configuration, there is only the need of knowing its index.
Informations about units can be found in the _Data object (access via PhaseSpace.data)
Quick example
Assuming p2sat is imported, you can instanciate a PhaseSpace object for, let say, electrons, and import a simulation file containing the phase space informations.
>>> eps = p2sat.PhaseSpace(particle="electron")
>>> eps.extract.txt("example.csv",sep=",")
All the data in you simulation file can now be found at eps.data
>>> # List of all the statistical weights >>> print(eps.data.w) [1456.0, 1233.0 , 756.0, ... ] >>> # List of all the x position >>> print(eps.data.x) [10.0, 50.0, 30.0, ... ] >>> # List of all the kinetic energies >>> print(eps.data.ekin) [1.58, 4.61, 3.28, ... ]
This means that at the first index, there is an electron at position x=10.0 um with 1.58 MeV of kinetic energy and with statistical weight of 1456.0.
You can now do statistics with this data, for example get the standard deviation of theta angle for all the electrons
>>> theta_std = eps.stat.standard_deviation('theta')
and get an histogram (Number/degree, bin width = 1 degree) of this quantity
>>> theta,Ntheta = eps.hist.h1('theta', bwidth=0.1)
It is also possible to make simple or complicated plot in a elegant way
>>> eps.plot.figure(0)
>>> eps.plot.h1('theta', log=True, bwidth=0.1)
>>> eps.plot.figure(1)
>>> eps.plot.h2('theta','ekin',
... log=True, polar=True
... bwidth1=1.0,bwidth2=0.1,
... select={'x':10.0,'t':[0.0,100.0]})
Other examples and a more complete documentation can be found at : https://github.com/lesnat/p2sat
Metadata
Release files for p2sat 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| p2sat-1.4.1.tar.gz | 85.1 kB | Without provenance | Details for p2sat-1.4.1.tar.gz |
Release files / p2sat-1.4.1.tar.gz
| Download URL | p2sat-1.4.1.tar.gz |
|---|---|
| Size | 85.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
302751c0cf0fd97303fd678a4a24606df454abfa69965970bad58353b8b320be
|
|
BLAKE2b-256 checksum How to use checksums |
509958497f5e0035cf6447d5465946e2b9b9a159c095862f721940856b154892
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.6
|
Security for p2sat 1.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.