plot_observation_state#

pyvisgrid.plotting.plot_observation_state(gridder: Gridder, vis_data: GridData, u: np.ndarray, v: np.ndarray, times: np.ndarray, 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', dirty_image_crop: tuple[list[float | None]] = ([None, None], [None, None]), mask_mode: str = 'amp_phase', swap_masks: bool = False, mask_crop: tuple[list[float | None]] = ([None, None], [None, None]), axes_options: dict | None = None, save_to: str | PathLike | None = None, save_args: dict | None = None) tuple[mpl.figure.Figure, dict[mpl.axes.Axes], dict[mpl.artist.Artist], dict][source]#

Plot several visualizations for a given state of an observation.

Parameters:
gridderGridder

The Gridder with which the series was gridded.

vis_dataGridData

The grid data returned by the Gridder.

unumpy.ndarray

The ungridded \(u\) coordinates.

vnumpy.ndarray

The ungridded \(v\) coordinates.

timesnumpy.ndarray

The MJD timestamps of the \((u,v)\) points.

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]. Default is None.

uv_max_extensionfloat, optional

The fractional extension of the uv plot’s axes limits. A value of e.g. 0.5 would correspond to 50% larger u and v axes. Default is 0.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 the

    antennas 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_mosaic call. 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.

dirty_image_croptuple[list[float | None]], optional

The crop of the dirty image. 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])

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_hi and which as mask_lo. By default the order is: mask_hi = amplitude | real and mask_lo = phase | imaginary. Default is False.

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,
    },
}
save_tostr | PathLike | None, optional

The location to save the plot to. If set to None, the plot won’t be saved. Default is None.

save_argsdict | None, optional

Additional arguments to provide to the Figure.savefig method. Default is {"bbox_inches":"tight"}.

Returns:
tuple[mpl.figure.Figure, mpl.axes.Axes, dict[mpl.artist.Artist], dict]:

The figure object, mosaic subplot axes and dictionary of the artists of the plots. The last dict contains all plot options.