gif
intsharp/monitors/gif.py
Animated GIF Monitor
Creates animated GIFs from field snapshots. Supports both single-field and multi-field (comparison) modes, with different visualization options for 1D and 2D domains.
For MP4 output, see mp4.
Modes
| Mode | Parameter | Description |
|---|---|---|
| Single-field | field | Visualize one field |
| Multi-field | compare_fields | Overlay multiple fields |
Visualization by Dimension
| Dimension | Single-field | Multi-field |
|---|---|---|
| 1D | Line plot | Overlaid line plots with legend |
| 2D | Pcolormesh (default) or contour lines | Overlaid contour lines |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
field | string | — | Field name (single-field mode) |
compare_fields | list | — | Fields to compare (multi-field mode) |
style | string | pcolormesh | 2D single-field: pcolormesh or contour |
contour_levels | list | [0.5] | Contour levels for 2D contour mode |
every_n_steps | int | — | Output frequency (steps) |
compare_fields Options
Each item in compare_fields can specify:
| Key | Type | Default | Description |
|---|---|---|---|
field | string | (required) | Field name |
color | string | auto | Line color |
linestyle | string | - | Line style (-, --, :, etc.) |
contour_levels | list | [0.5] | Contour levels (2D only) |
Output
- Single-field:
{field}.gif - Multi-field:
compare.gif
Examples
1D Single-field
monitors:
- type: gif
every_n_steps: 10
field: alpha
1D Multi-field Comparison
monitors:
- type: gif
every_n_steps: 10
compare_fields:
- field: alpha_no_sharp
color: blue
linestyle: "-"
- field: alpha_pm
color: red
linestyle: "--"
2D Single-field (pcolormesh)
monitors:
- type: gif
every_n_steps: 20
field: alpha
2D Single-field (contour)
monitors:
- type: gif
every_n_steps: 20
field: alpha
style: contour
contour_levels: [0.25, 0.5, 0.75]
2D Multi-field Comparison
monitors:
- type: gif
every_n_steps: 20
compare_fields:
- field: alpha_no_sharp
contour_levels: [0.5]
color: blue
linestyle: "-"
- field: alpha_pm
contour_levels: [0.5]
color: red
linestyle: "--"