AbstractSaveRoutine

class plasmapy.simulation.particle_tracker.save_routines.AbstractSaveRoutine(
output_directory: Path | None = None,
output_basename: str = 'output',
)[source]

Bases: ABC

Abstract base class containing the necessary methods for a ParticleTracker save routine.

The save routine class is responsible for defining the conditions and hooks for saving.

Parameters:
  • output_directory (Path, optional) – Output for objects that are saved to disk. If a directory is not specified then a memory save routine is used.

  • output_basename (str, optional) – Optional string basename for saved files.

Notes

After every push, the post_push_hook method is called with the respective ParticleTracker object passed as a parameter. Then, the hook calls save_now to determine whether or not the simulation state should be saved.

Attributes Summary

require_synchronized_dt

Return if this save routine requires a synchronized time step.

results

Return the results of the simulation.

save_now

Determine if to save on the current push step.

tracker

Return the ParticleTracker object for this stop condition.

Methods Summary

post_push_hook()

Function called after a push step.

save()

Save the current state of the simulation to memory.

Attributes Documentation

require_synchronized_dt

Return if this save routine requires a synchronized time step.

results

Return the results of the simulation. The quantities returned depend on those defined in the body of the save routine.

save_now

Determine if to save on the current push step.

tracker

Return the ParticleTracker object for this stop condition.

Methods Documentation

post_push_hook() None[source]

Function called after a push step.

This function is responsible for handling two steps of save routine, namely:
  • Deciding to save on the current time step

  • How the simulation data is saved (i.e. to disk or memory)

save() None[source]

Save the current state of the simulation to memory.

If an output directory is specified then the state will also be saved to the disk.