Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pyphare/pyphare/pharein/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def wrapper(diagnostics_object, name, **kwargs):

accepted_keywords = [
"path",
"compute_timestamps",
"population_name",
"flush_every",
]
Expand Down Expand Up @@ -117,9 +116,11 @@ def __init__(self, name, **kwargs):
self.write_timestamps = validate_timestamps(
self.__class__.__name__, "write_timestamps", **kwargs
)
self.compute_timestamps = validate_timestamps(
self.__class__.__name__, "compute_timestamps", **kwargs
)
# for now every diagnostics needing computation (like momentum tensor)
# is computing at the same time as written.
# later this parameter can evolve to allow for different timestamps
# that will depend on the type of diagnostics.
self.compute_timestamps = self.write_timestamps

self.attributes = kwargs.get("attributes", {})

Expand Down
6 changes: 1 addition & 5 deletions pyphare/pyphare_tests/test_pharesee/test_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,7 @@ def vthz(x, y):
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
12 changes: 2 additions & 10 deletions src/phare/phare_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,11 @@ def vthz(x):


for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)


for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

pops = [
"protons",
Expand Down
12 changes: 2 additions & 10 deletions src/phare/phare_init_small.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,11 @@ def vthz(x):


for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)


for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

pops = [
"protons",
Expand Down
13 changes: 2 additions & 11 deletions tests/diagnostic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,18 @@ def dump_all_diags(pops=[], flush_every=100, timestamps=None):
if timestamps is None:
timestamps = all_timestamps(sim)

ph.InfoDiagnostics(
quantity="particle_count",
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.InfoDiagnostics(quantity="particle_count", write_timestamps=timestamps)
# commented out because not working propertly at the moment
# but we keep it there for when it does
# ph.MetaDiagnostics(
# quantity="tags",
# write_timestamps=timestamps,
# compute_timestamps=timestamps,
# write_timestamps=timestamps
# )

for quantity in ["density", "bulkVelocity", "pressure_tensor"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
flush_every=flush_every,
)

Expand All @@ -46,15 +40,13 @@ def dump_all_diags(pops=[], flush_every=100, timestamps=None):
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
flush_every=flush_every,
population_name=pop,
)

for quantity in ["domain", "levelGhost", "patchGhost"]:
ph.ParticleDiagnostics(
quantity=quantity,
compute_timestamps=timestamps,
write_timestamps=timestamps,
flush_every=flush_every,
population_name=pop,
Expand All @@ -64,6 +56,5 @@ def dump_all_diags(pops=[], flush_every=100, timestamps=None):
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
flush_every=flush_every,
)
12 changes: 2 additions & 10 deletions tests/functional/alfven_wave/alfven_wave1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,10 @@ def vthz(x):
timestamps = all_timestamps(sim)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
7 changes: 1 addition & 6 deletions tests/functional/conservation/conserv.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,11 @@ def vthz(x):
timestamps = np.arange(0, sim.final_time, 50 * sim.time_step)

for quantity in ["B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for name in ["domain", "levelGhost", "patchGhost"]:
ph.ParticleDiagnostics(
quantity=name,
compute_timestamps=timestamps,
write_timestamps=timestamps,
population_name="protons",
)
Expand Down
18 changes: 3 additions & 15 deletions tests/functional/dispersion/dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ def vthz(x):
timestamps = np.arange(0, sim.final_time + sim.time_step, sim.time_step)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down Expand Up @@ -172,18 +168,10 @@ def vthz(x):
timestamps = np.arange(0, sim.final_time + sim.time_step, sim.time_step)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
11 changes: 2 additions & 9 deletions tests/functional/ionIonBeam/ion_ion_beam1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,11 @@ def vth(x):
timestamps = np.arange(0, sim.final_time, 0.1)

for quantity in ["B", "E"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for pop_name in ["main", "beam"]:
ph.ParticleDiagnostics(
quantity="domain",
population_name=pop_name,
write_timestamps=timestamps,
compute_timestamps=timestamps,
quantity="domain", population_name=pop_name, write_timestamps=timestamps
)
return sim

Expand Down
12 changes: 2 additions & 10 deletions tests/functional/shock/shock.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,10 @@ def vthz(x):
timestamps = dt * np.arange(nt)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
7 changes: 1 addition & 6 deletions tests/functional/td/td1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,12 @@ def vthz(x):
timestamps = np.linspace(0, sim.final_time, n_dump)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
return sim

Expand Down
13 changes: 2 additions & 11 deletions tests/functional/tdtagged/td1dtagged.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,14 @@ def config(**options):
timestamps = all_timestamps(sim)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)
for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

for pop in sim.model.populations:
for quantity in ["domain"]:
ph.ParticleDiagnostics(
quantity=quantity,
compute_timestamps=timestamps[: particle_diagnostics["count"] + 1],
write_timestamps=timestamps[: particle_diagnostics["count"] + 1],
population_name=pop,
)
Expand Down
24 changes: 4 additions & 20 deletions tests/functional/translation/translat1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,10 @@ def vthz(x):
timestamps = all_timestamps(sim)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down Expand Up @@ -188,18 +180,10 @@ def vthz(x):
timestamps = all_timestamps(sim)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
12 changes: 2 additions & 10 deletions tests/simulator/refinement/test_2d_10_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,10 @@ def vthz(x, y):
timestamps = dt * np.arange(nt)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
12 changes: 2 additions & 10 deletions tests/simulator/refinement/test_2d_2_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,10 @@ def vthz(x, y):
timestamps = dt * np.arange(nt)

for quantity in ["E", "B"]:
ph.ElectromagDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.ElectromagDiagnostics(quantity=quantity, write_timestamps=timestamps)

for quantity in ["density", "bulkVelocity"]:
ph.FluidDiagnostics(
quantity=quantity,
write_timestamps=timestamps,
compute_timestamps=timestamps,
)
ph.FluidDiagnostics(quantity=quantity, write_timestamps=timestamps)

return sim

Expand Down
Loading