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

(*,+) Movie and summary changes, new parameter to shut off neutrino reactions. #32

Merged
merged 12 commits into from
Nov 15, 2024
Merged
149 changes: 97 additions & 52 deletions bin/movie_script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,154 +2,199 @@

This folder contains a script to analyze a WinNet run. It will show or save a movie of the mass fractions over time in the nuclear chart, inspired by the movie of SkyNet (done by J. Lippuner).

To create a video, the run must have snapshot output enabled (parameters [snapshots_every](https://nuc-astro.github.io/WinNet/parameters.html#h_snapshot_every) or [h_snapshots_every](https://nuc-astro.github.io/WinNet/parameters.html#h_snapshot_every)).
Also timescales ([timescales_every](https://nuc-astro.github.io/WinNet/parameters.html#timescales_every) or [h_timescales_every](https://nuc-astro.github.io/WinNet/parameters.html#h_timescales_every)),
mainout properties ([mainout_every](https://nuc-astro.github.io/WinNet/parameters.html#mainout_every) or [h_mainout_every](https://nuc-astro.github.io/WinNet/parameters.html#h_mainout_every)),
energy generation ([engen_every](https://nuc-astro.github.io/WinNet/parameters.html#engen_every) or [h_engen_every](https://nuc-astro.github.io/WinNet/parameters.html#h_engen_every)),
tracked nuclei ([track_nuclei_every](https://nuc-astro.github.io/WinNet/parameters.html#track_nuclei_every) or [h_track_nuclei_every](https://nuc-astro.github.io/WinNet/parameters.html#h_track_nuclei_every)),
To create a video, the run must have snapshot output enabled (parameters [snapshots_every](https://nuc-astro.github.io/WinNet/parameters.html#h_snapshot_every) or [h_snapshots_every](https://nuc-astro.github.io/WinNet/parameters.html#h_snapshot_every)).
Also timescales ([timescales_every](https://nuc-astro.github.io/WinNet/parameters.html#timescales_every) or [h_timescales_every](https://nuc-astro.github.io/WinNet/parameters.html#h_timescales_every)),
mainout properties ([mainout_every](https://nuc-astro.github.io/WinNet/parameters.html#mainout_every) or [h_mainout_every](https://nuc-astro.github.io/WinNet/parameters.html#h_mainout_every)),
energy generation ([engen_every](https://nuc-astro.github.io/WinNet/parameters.html#engen_every) or [h_engen_every](https://nuc-astro.github.io/WinNet/parameters.html#h_engen_every)),
tracked nuclei ([track_nuclei_every](https://nuc-astro.github.io/WinNet/parameters.html#track_nuclei_every) or [h_track_nuclei_every](https://nuc-astro.github.io/WinNet/parameters.html#h_track_nuclei_every)),
or abundance flows ([flow_every](https://nuc-astro.github.io/WinNet/parameters.html#flow_every) or [h_flow_every](https://nuc-astro.github.io/WinNet/parameters.html#h_flow_every))
can be plotted if the frequency of the output is **set to the same value as the one of the snapshots**.
can be plotted if the frequency of the output is **set to the same value as the one of the snapshots**.

An example command to generate the video is:

```bash
python winnet_movie.py -i ../../runs/Example_NSM_dyn_ejecta_rosswog
```
```

This command will display the movie in a separate window. Note that this process may be slow as the movie is generated in real-time. For a smoother experience, you can save the video to a file using the --save option.

#### Options

- `-h`, `--help`
- `-h`, `--help`
Show this help message and exit.

- `-i RUNDIR`, `--input=RUNDIR`
- `-i RUNDIR`, `--input=RUNDIR`
Simulation directory to visualize (default: current directory).

- `--disable_flow`
- `--disable_flow`
Whether or not to plot the flow arrows.

- `--flow_min=FLOW_MIN`
- `--flow_min=FLOW_MIN`
Lower limit of the flow.

- `--flow_max=FLOW_MAX`
- `--flow_max=FLOW_MAX`
Upper limit of the flow.

- `--fix_flows`
- `--fix_flows`
Whether or not the flows are adapted to the data or lie between `flow_min` and `flow_max`.

- `--flow_range=FLOW_RANGE`
- `--flow_range=FLOW_RANGE`
Log range of the flows in case they are not fixed.

- `--fix_flow_arrow_width`
- `--fix_flow_arrow_width`
Fix the width of the flow arrows to a constant width.

- `--flow_cmap=FLOW_CMAP`
- `--flow_cmap=FLOW_CMAP`
Colormap of the flows.

- `--separate_fission`
- `--separate_fission`
Whether or not to show arrows also for fission. If not present, hatched areas will be plotted.

- `--fission_minflow=FISSION_MINFLOW`
- `--fission_minflow=FISSION_MINFLOW`
Minimum flow to get indicated as a fission region in case the separate fission flag is not given.

- `--x_min=X_MIN`
- `--x_min=X_MIN`
Lower limit of the mass fraction.

- `--x_max=X_MAX`
- `--x_max=X_MAX`
Upper limit of the mass fraction.

- `--x_cmap=X_CMAP`
- `--x_cmap=X_CMAP`
Colormap of the mass fractions.

- `--disable_abar`
- `--disable_abar`
Whether or not disabling the indication of Abar.

- `--mass_bins_cmap=MASS_BINS_CMAP`
- `--mass_bins_cmap=MASS_BINS_CMAP`
Colormap of the background colors.

- `--disable_magic`
- `--disable_magic`
Whether or not disabling the indication for the magic number.

- `--additional_plot=ADDITIONAL_PLOT`
Whether or not to show an additional plot in the top left corner. Possible options are 'timescales', 'tracked', or 'energy'
- `--additional_plot=ADDITIONAL_PLOT`
Whether or not to show an additional plot in the top left corner. Possible options are 'timescales', 'tracked', or 'energy'
for plotting average timescales, mass fractions of tracked nuclei, or nuclear energy generation.

- `--tau_min=TAU_MIN`
- `--tau_min=TAU_MIN`
Lower limit of the average timescales.

- `--tau_max=TAU_MAX`
- `--tau_max=TAU_MAX`
Upper limit of the average timescales.

- `--engen_min=ENGEN_MIN`
- `--engen_min=ENGEN_MIN`
Lower limit of the Energy.

- `--engen_max=ENGEN_MAX`
- `--engen_max=ENGEN_MAX`
Upper limit of the Energy.

- `--tracked_min=TRACKED_MIN`
- `--tracked_min=TRACKED_MIN`
Lower limit of the tracked nuclei mass fractions.

- `--tracked_max=TRACKED_MAX`
- `--tracked_max=TRACKED_MAX`
Upper limit of the tracked nuclei mass fractions.

- `--time_min=T_MIN`
- `--amainout_min=AMAINOUT_MIN`
Lower limit of the additional mainout abundances.

- `--amainout_max=AMAINOUT_MAX`
Upper limit of the additional mainout abundances.

- `--time_min=T_MIN`
Lower limit of the time.

- `--time_max=T_MAX`
- `--time_max=T_MAX`
Upper limit of the time.

- `--disable_mainout`
- `--disable_mainout`
Whether or not disabling the mainout plot.

- `--density_min=DENSITY_MIN`
- `--density_min=DENSITY_MIN`
Lower limit of the density.

- `--density_max=DENSITY_MAX`
- `--density_max=DENSITY_MAX`
Upper limit of the density.

- `--temperature_min=TEMPERATURE_MIN`
- `--temperature_min=TEMPERATURE_MIN`
Lower limit of the temperatures.

- `--temperature_max=TEMPERATURE_MAX`
- `--temperature_max=TEMPERATURE_MAX`
Upper limit of the temperature.

- `--ye_min=YE_MIN`
- `--ye_min=YE_MIN`
Lower limit of the electron fraction.

- `--ye_max=YE_MAX`
- `--ye_max=YE_MAX`
Upper limit of the electron fraction.

- `--frame_min=FRAME_MIN`
- `--indicate_r_path`
Whether or not to indicate a theoretical r-process path that has been calculated assuming (n,gamma)(gamma,n) equilibrium.

- `--frame_min=FRAME_MIN`
Value of the first frame (default: 1).

- `--frame_max=FRAME_MAX`
- `--frame_max=FRAME_MAX`
Value of the last frame (default: end of the simulation).

- `--save`
- `--interactive`
Whether to show the movie in interactive mode.

- `--save`
Whether or not saving the movie.

- `--save_frames`
- `--save_frames`
Whether or not saving the frames of the movie, not compatible with the save option.

- `--output=OUTPUT_NAME`
- `--output=OUTPUT_NAME`
Output name of the movie.

- `--parallel_save`
- `--parallel_save`
Whether or not to save the movie or frames in parallel.

- `--parallel_cpus=PARALLEL_CPUS`
- `--parallel_cpus=PARALLEL_CPUS`
Number of CPUs to use for parallel saving.

- `--interval=INTERVAL`
- `--interval=INTERVAL`
Interval of the movie (larger value equals slower).

- `--mpirun_path=MPIRUN_PATH`
- `--mpirun_path=MPIRUN_PATH`
Path of the `mpirun` command to use for parallel saving.


#### Example

An example output could look like the following:

![Simulation visualization](../../doc/doxygen/figures/winteler_mhd.gif)


#### Interactive Mode

The **Interactive Mode** enhances the functionality of the nuclear reaction flow visualization by enabling real-time interaction with the plots. Below are the features and instructions for using the interactive mode effectively:


1. **Dynamic Controls:**
- **Slider**: Allows the user to navigate through the simulation timeline seamlessly.
- **Play/Pause Button**: Toggles the animation playback.
- **Zoom Button**: Enables zooming in and out on the low mass region of the chart.

2. **Toggle Data Layers:**
- Activate or deactivate specific plots (e.g., `tracked nuclei`, `timescales`, `energy`) with dedicated buttons.

3. **R-process path**
- Highlight the r-process path that is calculated assuming (n,gamma) equilibrium.

4. **Highlight sunet**
- Highlight the nuclei that have been used in the calculation with a red outline.

5. **Neutron freezeout**
- Neutron freezeout is indicated as red vertical line on the slider.

6. **Flow and Abundance Adjustments:**
- Fine-tune flow and abundance ranges dynamically using buttons to increment, decrement, or reset the values.
- Toggle visualization elements such as arrows for flow or background mass fractions.

7. **Custom Backgrounds:**
- Switch between different background visualizations (e.g., Binding energy, Neutron separation energy) for a tailored view of nuclear properties.


![Interactive mode](../../doc/doxygen/figures/interactive.png)
1 change: 1 addition & 0 deletions bin/movie_script/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
h5py
matplotlib>=3.8.4
numba
mpi4py
numpy
pandas
Expand Down
Loading
Loading