animate_observation#
- pyvisgrid.plotting.animations.animate_observation(gridder: Gridder, series: GridDataSeries, fps: float, save_to: str | PathLike, max_values: tuple[GridData, np.ndarray, np.ndarray, np.ndarray] | None = None, uv_max_extension: float = 0.2, plot_positions: list[list[str]] | None = None, dirty_image_mode: str = 'real', mask_mode: str = 'amp_phase', swap_masks: bool = False, mask_crop: tuple[list[float | None]] = ([None, None], [None, None]), axes_options: dict | None = None, show_progress: bool = True, dpi: int | str = 'figure') None[source]#
Creates an animation from the given GridDataSeries.
- Parameters:
- gridderGridder
The
Gridderwith which the series was gridded.- seriesGridDataSeries
The series of gridded observations.
- fpsfloat
The frame rate for the animation in frames per second.
- save_tostr | PathLike
The path to save the animation to. This has to include the filename and extensions.
- max_valuestuple[GridData, np.ndarray, np.ndarray, np.ndarray] | None, optional
The maximum values of the gridded and ungridded data and the timestamps. These values are used to configure the maximum scale for the plot axes and colorbars. The values have to be in the following order:
[GridData, ungridded u, ungridded v, times]. If set toNone, the maximum will be taken from the last element of theseries. Default isNone.- uv_max_extensionfloat, optional
The fractional extension of the uv plot’s axes limits. A value of e.g.
0.5would correspond to 50% larger u and v axes. Default is0.2.- plot_positionsdict[str] | None, optional
The mosaic layout of the plot. The following keys are available:
uv: Refers to the ungridded :math:(u,v) coordinates plot.di: Refers to the dirty image plot.earth: Refers to the plot of the source position and theantennas on the earth’s surface.
mask_hi: Refers to the upper plot of the gridded visibility masks.mask_lo: Refers to the lower plot of the gridded visibility masks.
Note the layout should be valid to be used in a
matplotlib.pyplot.subplot_mosaiccall. Default is[["mask_hi", "earth", "uv"], ["mask_lo", "earth", "di"]]
- dirty_image_modestr, optional
The mode specifying which values of the dirty image should be plotted. Possible values are:
real: Plots the real part of the dirty image.imag: Plots the imaginary part of the dirty image.abs/amp: Plot the absolute value of the dirty image.
Default is
real.- mask_modestr, optional
The mode specifying which representation of the visibility masks should be used. Possible values are:
amp_phase: Plots the amplitude and phase of the complex numbers.real_imag: Plots the real and imaginary parts of the complex numbers.
Default is
amp_phase.- swap_masksbool, optional
Whether to swap the mask order which is used to determine which mask part is used as
mask_hiand which asmask_lo. By default the order is:mask_hi = amplitude | realandmask_lo = phase | imaginary. Default isFalse.- mask_croptuple[list[float | None]], optional
The crop of the masks. This has to have the format
([x_left, x_right], [y_left, y_right]), where the left and right values for each axis are the upper and lower limits of the axes which should be shown. Default is ([None, None], [None, None])- axes_optionsdict | None, optional
Options for the different subplots of the mosaic plot. The given dictionary will be merged with the default option dictionary. This means that options which are given in this parameter overwrite the option in the default configuration. The default configuration is:
{ "uv": { "show_title": True, "title_fontsize": "medium", "axes_ticks": False, "axes_labels": True, "axes_fontsize": "x-small", "show_times": True, "cmap": "magma", "show_cbar": True, "cbar_ticks": True, "cbar_label": True, "cbar_fontsize": "small", "color": _default_colors[4], "aspect": "equal", }, "di": { "show_title": True, "title_fontsize": "medium", "axes_ticks": False, "axes_labels": False, "axes_fontsize": "x-small", "cmap": "inferno", "norm": "sqrt", "show_cbar": True, "cbar_ticks": False, "cbar_label": True, "cbar_fontsize": "small", "mode_in_label": True, }, "mask_hi": { "show_title": True, "title_fontsize": "medium", "axes_ticks": False, "axes_labels": False, "axes_fontsize": "x-small", "cmap": mask_cmaps[0], "label": mask_labels[0], "norm": mask_norms[0], "show_cbar": True, "cbar_ticks": False, "cbar_label": True, "cbar_fontsize": "small", }, "mask_lo": { "show_title": True, "title_fontsize": "medium", "axes_ticks": False, "axes_labels": False, "axes_fontsize": "x-small", "cmap": mask_cmaps[1], "label": mask_labels[1], "norm": mask_norms[1], "show_cbar": True, "cbar_ticks": False, "cbar_label": True, "cbar_fontsize": "small", }, "earth": { "show_title": True, "title_fontsize": "small", "show_legend": True, "legend_args": None, "legend_fontsize": "x-small", "coastline_width": 0.7, "show_terrain_texture": True, "show_grid_lines": True, "show_night_shade": True, "marker_sizes": None, "plot_colors": None, }, }
- show_progressbool, optional
Whether to show the progress of saving the animation. Default is
True.- dpiint | str, optional
The DPI (Dots Per Inch) of the animation. Default is
'figure'.