Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More plot options, runtime plots, unnormalized pdf plots #78

Merged
merged 17 commits into from
Mar 27, 2023

Conversation

johnomotani
Copy link
Collaborator

@johnomotani johnomotani commented Sep 13, 2022

  • Option to make gifs of ppar, qpar and vth
  • Function to add a line showing the lab-frame v_parallel=0 on z/vpa 2d plots
  • If runtime_plots = true is passed in the input, output some summary plots into latest_plots.png at each output step - useful for monitoring long-running simulations
  • Option to make a gif of the unnormalized pdf against lab-frame z and v_parallel (using linear and logarithmic colour scales) - set animate_f_unnormalized = true in post_processing_input.jl
    • Would need an update to Plots.jl (Allow 2d coordinates for heatmap plots in PyPlot backend JuliaPlots/Plots.jl#4298, which is not yet complete) to work using Plots.jl. As a workaround, use PyPlot.jl directly. Unfortunately, this is less neat in terms of code, and produces output not quite consistent with the Plots.jl output (different colour scale, and probably spacing). We can revert the workaround if/when Plots.jl is ever updated.
  • Allow analyze_and_plot_data() to accept multiple directories/output files. If multiple simulations are passed, they are overlaid on line plots, and put side-by-side in 2d plots. Animations are truncated to the length of the shortest of the inputs.
    • Adds some complication to the code in post_processing.jl as just about every variable is now a Tuple with one entry for each simulation, but I think worth it for comparing different runs.

Note: when I added PyCall and PyPlot to the dependencies, the Manifest was re-generated with Julia-1.7.2. I don't expect that to cause a problem but if you're using an earlier version of Julia and get weird errors, it might be worth updating.

Can be useful to monitor an ongoing simulation. This cannot be done by
reading the output file, because opening the NetCDF file from two
programs at once may corrupt it and crash either/both programs. Instead,
if `runtime_plots = true` is passed in the input, a .png file with a
bunch of plots of moments and distribution functions is produced at each
output step. The plots are created in serial, and may take some time
(~10s?) for high-resolution simulations.
These can be useful for post-processing.
Also requires updated version of Plots.jl (to be added later if/when
JuliaPlots/Plots.jl#4298 is merged).
`export analyze_and_plot` -> `export analyze_and_plot_data`
Making animations directly with PyPlot.jl and matplotlib is not as neat,
and the output is not consistent with Plots.jl, but it works without
needing the update to Plots.jl in
JuliaPlots/Plots.jl#4298
Needed when using PyCall to import matplotlib.
@johnomotani johnomotani added the enhancement New feature or request label Sep 13, 2022
Using the system Python is the default on Linux, but not macOS (or
Windows). This commit explicitly sets the ENV["PYTHON"] variable so that
all platforms use the system Python. This was needed to get PyCall to
work correctly on macOS - previously Julia's internal Conda-installed
Python had linking errors when using matplotlib.
When creating figures for multiple runs, we need to set the figure size
explicitly for 2d plots (it should get wider when there are more runs to
avoid squashing the figures). This commit changes the settings so that
the size of the plot for each run matches the Plots.jl default size for
a single plot.
After switching between PyPlot interface and Plots interface, the Figure
apparently does not get cleaned up without an explicit call to
Plots.closeall().
Includes some refactoring of functions used to get/plot unnormalized f
so that they can be reused in more ways.
Base automatically changed from update-moment-equations to master March 27, 2023 19:46
@johnomotani johnomotani merged commit 413b3f6 into master Mar 27, 2023
@johnomotani johnomotani deleted the update-plotting branch March 27, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant