Post-Processing¶
Main Postprocessing Function¶
- finds.postprocessing.process_data(...)¶
Processes the data stored within the output directory. Each state and simulation time are read in sequentially, one at a time, so the data is processed using “processing modules” that append one-at-a-time (to reduce the load on system memory).
- Parameters:
output_dir (Path) – The output directory to read from/write to.
generate_animation (bool) – Whether or not to generate an animation of the simulation.
Post-Processing Modules¶
- class finds.processingmodules.ProcessingModule.ProcessingModule¶
Bases:
ABCThis is an abstract class for all “processing modules” so that they can operate in parallel to reduce the amount of data read to the disk at one time (such as generating figures, performing calculations, etc).
- output_dir¶
- begin(output_dir)¶
Instructs the processing module to initialize such that it can produce data.
- Parameters:
output_dir (Path) – The output directory to write to.
- abstractmethod append_state(system, time, frame, num_frames)¶
Appends the state \(\mathbf{X}\) and time \(t\) to the current process being generated (whether by animating it, including it in a computation, etc.).
- Parameters:
system (NDArray) – The state of the system at time \(t\).
time (float) – The time, \(t\).
frame (int) – The index for this frame
num_frames (int) – The total number of frames for this simulation
- end()¶
- class finds.processingmodules.AnimationGenerator.AnimationGenerator(...)¶
Bases:
ProcessingModuleGenerates a 3-D animation of the full fish simulation, taking (0,0) to be the origin. Allows for rapid customization of simulation colors, viewing, and debug parameters as well.
- Variables:
fps (int) – The frames-per-second of the simulation, or how fast the animation will be. Default is 30 FPS.
dpi (int) – The resolution of the video in dots per inch. Defaults to 300.
video_output_filename (str) – The output filename of the video to generate. Default is
animation3d.mp4max_bounds (ArrayLike) – The maximum (unsigned) bounds for the perspective. Putting in \((x_0, y_0, z_0)\) means that the \(x\)-axis varies from \(-x_0\) to \(x_0\), and so on. Default is \((100, 100, 100)\).
particle_radius (int) – The radius for each particle (default 30).
orientation_width (int) – The width for the line depicting the orientation (default 5).
orientation_length (int) – The length for the line depicting the orientation (default 5).
padding (float) – The padding for the viewport/unit box (default 0.1).
figsize (tuple[int]) – The size of the resulting figure (not the viewport, default \((8,8)\)).
particle_color (str) – The color of the particle, default
tab:cyan.orientation_color (str) – The color of the orientation line, default
tab:orange.
- begin(output_dir)¶
Sets up the MatPlotLib animation for rendering.
- append_state(system, time, frame, num_frames)¶
Draws the current state to the animation.
- end()¶
Closes the animation and saves the file.
- class finds.processingmodules.DensityAnimationGenerator.DensityAnimationGenerator(...)¶
Bases:
ProcessingModuleProduces an animation of the radial mass distribution of fish from the center-of-mass for each time step, \(\delta t\).
- Variables:
fps (int) – The frames-per-second of the animation. Default 30 FPS.
dpi (int) – The dots-per-inch of the animation. Default 300.
n_bins (int) – The number of bins to use in the histogram. Default 30.
max_radius (float) – The maximum radius to display on the histogram. Default 100.
figsize (tuple[int]) – The MatPlotLib figure dimensions for the video.
video_output_filename (str) – The filename to output the video to.
- begin(output_dir)¶
Instructs the processing module to initialize such that it can produce data.
- Parameters:
output_dir (Path) – The output directory to write to.
- append_state(system, time, frame, num_frames)¶
Appends the state \(\mathbf{X}\) and time \(t\) to the current process being generated (whether by animating it, including it in a computation, etc.).
- Parameters:
system (NDArray) – The state of the system at time \(t\).
time (float) – The time, \(t\).
frame (int) – The index for this frame
num_frames (int) – The total number of frames for this simulation
- end()¶
- class finds.processingmodules.CrossSectionGenerator.CrossSectionGenerator(...)¶
Bases:
ProcessingModuleGenerates a cross-section for the first frame along the xy-plane at z=0.
- Variables:
particle_radius (int) – The radius for each particle (default 30).
orientation_width (int) – The width for the line depicting the orientation (default 0.25).
orientation_length (int) – The length for the line depicting the orientation (default 5).
figsize (tuple[int]) – The size of the resulting figure (not the viewport, default \((10,10)\)).
particle_color (str) – The color of the particle, default
tab:cyan.orientation_color (str) – The color of the orientation line, default
tab:orange.output_filename (str) – The output filename of the image to generate. Default is
animation3d.mp4generated (bool) – Whether or not we have already generated the cross-section figure.
dpi (int) – The resolution of the fig in dots per inch. Defaults to 200.
- begin(output_dir)¶
Instructs the processing module to initialize such that it can produce data.
- Parameters:
output_dir (Path) – The output directory to write to.
- append_state(system, time, frame, num_frames)¶
Appends the state \(\mathbf{X}\) and time \(t\) to the current process being generated (whether by animating it, including it in a computation, etc.).
- Parameters:
system (NDArray) – The state of the system at time \(t\).
time (float) – The time, \(t\).
frame (int) – The index for this frame
num_frames (int) – The total number of frames for this simulation
- end()¶
- class finds.processingmodules.MeanRadialDistancePlot.MeanRadialDistancePlot(...)¶
Bases:
ProcessingModuleProduces a plot of the mean radial mass distribution of fish from the center-of-mass as a function of time, including errorbars for the standard deviations.
- Variables:
dpi (int) – The dots-per-inch of the animation. Default 300.
figsize (tuple[int]) – The MatPlotLib figure dimensions for the video.
plot_output_filename (str) – The filename to output the figure to.
- begin(output_dir)¶
Instructs the processing module to initialize such that it can produce data.
- Parameters:
output_dir (Path) – The output directory to write to.
- append_state(system, time, frame, num_frames)¶
Appends the state \(\mathbf{X}\) and time \(t\) to the current process being generated (whether by animating it, including it in a computation, etc.).
- Parameters:
system (NDArray) – The state of the system at time \(t\).
time (float) – The time, \(t\).
frame (int) – The index for this frame
num_frames (int) – The total number of frames for this simulation
- end()¶