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.

from pyphare.pharesee.run import Run

path = "/data/scratch/phare_jobs/run001/"
run = Run(path)

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

FindPrimaryXPoint(Az, xn, yn)[source]
GetB(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetCharge(pop_name, **kwargs)[source]
GetChargeFlux(time, merged=False, interp='nearest', **kwargs)[source]
GetDivB(time, merged=False, interp='nearest', **kwargs)[source]
GetDl(level=0)[source]

gives the ndarray containing the grid sizes for the given level

Parameters:

level – the level at which get the associated grid size

GetDomainSize(**kwargs)[source]
GetE(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetFlux(time, pop_name, merged=False, interp='nearest', **kwargs)[source]
GetJ(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMHDEtot(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMHDP(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMHDV(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMHDrho(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMHDrhoV(time, merged=False, interp='nearest', all_primal=True, **kwargs)[source]
GetMagneticFlux(time, interp='nearest', xn=None, yn=None, Xn=None, Yn=None)[source]
GetMass(pop_name, **kwargs)[source]
GetMassDensity(time, merged=False, interp='nearest', **kwargs)[source]
GetN(time, pop_name, merged=False, interp='nearest', **kwargs)[source]
GetNi(time, merged=False, interp='nearest', **kwargs)[source]
GetParticleCount(time, **kwargs)[source]
GetParticles(time, pop_name, hier=None, **kwargs)[source]
GetPe(time, merged=False, interp='nearest', all_primal=True)[source]
GetPi(time, merged=False, interp='nearest', **kwargs)[source]
GetPressure(time, pop_name, merged=False, interp='nearest', **kwargs)[source]
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.

GetReconnectionRate(times, interp='nearest')[source]
GetTags(time, merged=False, **kwargs)[source]
GetVi(time, merged=False, interp='nearest', **kwargs)[source]
all_times()[source]
times(qty)[source]