Data analysis
pharesee
The data produced by phare is readable with the pharesee python package from the pyphare. Make your PYTHONPATH includes the directory where pyphare is located.
export PYTHONPATH=$PYTHONPATH:/path/to/PHARE/pyphare
Then import the pharesee package should work:
import pyphare.pharesee as pharesee
Reading the data
We will imagine a situation where you have run a simulation for which ElectromagDianostics have been activated and you want to get the magnetic field. Assuming the data is in:
/data/scratch/phare_jobs/run001/
The first step to get the data is to create a Run object, that basically represents your simulation and will let you interact with its data.
Getting data is then done by calling methods of that run instance you just created. Every data getters takes the same form:
run.GetXXX(time)
where XXX is the name of a physical quantity available from pharesee, and time is the time at which you want to get the data.
For example, to get the magnetic field at time 0.0:
B = run.GetB(0.0)
Python Patch Hierarchy
Generalities
The data read from a run most often takes the form of a PatchHierarchy instance. This python object represents the hierarchy of levels of patches where the data lies.
B = run.GetB(0.0) # B is a PatchHierarchy
See section :ref:
Advanced usage
Using the finest field available
The Run methods
- class pyphare.pharesee.run.Run(path, default_time=None)[source]
Bases:
object- GetDl(level='finest', time=None)[source]
gives the ndarray containing the grid sizes at the given time for the hierarchy defined in the given run, and for the given level (default is ‘finest’, but can also be a int)
- Parameters:
level – the level at which get the associated grid size
time – the time because level depends on it
- GetRanks(time, merged=False, interp='nearest', **kwargs)[source]
returns a hierarchy of MPI ranks takes the information from magnetic field diagnostics arbitrarily this fails if the magnetic field is not written and could at some point be replace by a search of any available diag at the requested time.